Package org.apache.druid.data.input
Class Rows
java.lang.Object
org.apache.druid.data.input.Rows
-
Method Summary
Modifier and TypeMethodDescriptionstatic NumberobjectToNumber(String name, Object inputValue, boolean throwParseExceptions) Shorthand forobjectToNumber(String, Object, ValueType, boolean)with null expectedType.static NumberobjectToNumber(String name, Object inputValue, ValueType outputType, boolean throwParseExceptions) Convert an object to a number.objectToStrings(Object inputValue) Convert an object to a list of strings.toGroupKey(long timeStamp, InputRow inputRow)
-
Method Details
-
toGroupKey
- Parameters:
timeStamp- rollup up timestamp to be used to create group keyinputRow- input row- Returns:
- groupKey for the given input row
-
objectToStrings
Convert an object to a list of strings. This function translates single value nulls into an empty list, and any nulls inside of a list or array into the string "null". Do not use this method if you don't want this behavior, but note that many implementations ofRow.getDimension(String)do use this method, so it is recommended to useRow.getRaw(String)if you want the actual value without this coercion. For legacy reasons, some stuff counts on this incorrect behavior, (such astoGroupKey(long, InputRow)). -
objectToNumber
@Nullable public static Number objectToNumber(String name, Object inputValue, @Nullable ValueType outputType, boolean throwParseExceptions) Convert an object to a number.- Parameters:
name- field name of the object being converted (may be used for exception messages)inputValue- the actual object being convertedoutputType- expected return type, or null if it should be automatically detectedthrowParseExceptions- whether this method should throw aParseExceptionor use a default/null value when is not numeric- Returns:
- a Number; will not necessarily be the same type as
- Throws:
ParseException- if the input cannot be converted to a number andthrowParseExceptionsis true
-
objectToNumber
Shorthand forobjectToNumber(String, Object, ValueType, boolean)with null expectedType.
-