Package org.apache.druid.data.input
Class Rows
- java.lang.Object
-
- org.apache.druid.data.input.Rows
-
public final class Rows extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Number>
NumberobjectToNumber(String name, Object inputValue, boolean throwParseExceptions)
Convert an object to a number.static List<String>
objectToStrings(Object inputValue)
Convert an object to a list of strings.static List<Object>
toGroupKey(long timeStamp, InputRow inputRow)
-
-
-
Method Detail
-
toGroupKey
public static List<Object> toGroupKey(long timeStamp, InputRow inputRow)
- Parameters:
timeStamp
- rollup up timestamp to be used to create group keyinputRow
- input row- Returns:
- groupKey for the given input row
-
objectToStrings
public static List<String> objectToStrings(Object inputValue)
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 <T extends Number> Number objectToNumber(String name, Object inputValue, boolean throwParseExceptions)
Convert an object to a number. IfNullHandling.replaceWithDefault()
is true, this method will never return null. If false, it will returnNullHandling.defaultLongValue()
instead of null.- Parameters:
name
- field name of the object being converted (may be used for exception messages)inputValue
- the actual object being convertedthrowParseExceptions
- whether this method should throw aParseException
or use a default/null value when {@param inputValue} is not numeric- Returns:
- a Number; will not necessarily be the same type as {@param zeroClass}
- Throws:
ParseException
- if the input cannot be converted to a number andthrowParseExceptions
is true
-
-