Package org.apache.druid.data.input.impl
Class MapInputRowParser
java.lang.Object
org.apache.druid.data.input.impl.MapInputRowParser
-
Method Summary
Modifier and TypeMethodDescriptionfindDimensions(TimestampSpec timestampSpec, DimensionsSpec dimensionsSpec, Set<String> fields) Finds the final set of dimension names to use forInputRow.static InputRowstatic InputRowparse(InputRowSchema inputRowSchema, Map<String, Object> theMap) static org.joda.time.DateTimeparseTimestamp(TimestampSpec timestampSpec, Map<String, Object> theMap) static org.joda.time.DateTimeparseTimestampOrThrowParseException(Object timeValue, TimestampSpec timestampSpec, Supplier<Map<String, ?>> rawMapSupplier) Given a plain Java Object, extract a timestamp from it using the providedTimestampSpec, or throw aParseExceptionif we can't.
-
Method Details
-
parse
public static InputRow parse(InputRowSchema inputRowSchema, Map<String, Object> theMap) throws ParseException- Throws:
ParseException
-
parse
public static InputRow parse(TimestampSpec timestampSpec, List<String> dimensions, Map<String, Object> theMap) throws ParseException- Throws:
ParseException
-
findDimensions
public static List<String> findDimensions(TimestampSpec timestampSpec, DimensionsSpec dimensionsSpec, Set<String> fields) Finds the final set of dimension names to use forInputRow. There are 3 cases here. 1) IfDimensionsSpec.isIncludeAllDimensions()is set, the returned list includes _both_DimensionsSpec.getDimensionNames()and the dimensions in the given map (rawInputRow#keySet()). 2) If isIncludeAllDimensions is not set andDimensionsSpec.getDimensionNames()is not empty, the dimensions in dimensionsSpec is returned. 3) If isIncludeAllDimensions is not set andDimensionsSpec.getDimensionNames()is empty, the dimensions in the given map is returned. In any case, the returned list does not include any dimensions inDimensionsSpec.getDimensionExclusions()orTimestampSpec.getTimestampColumn(). -
parseTimestamp
public static org.joda.time.DateTime parseTimestamp(TimestampSpec timestampSpec, Map<String, Object> theMap) -
parseTimestampOrThrowParseException
public static org.joda.time.DateTime parseTimestampOrThrowParseException(Object timeValue, TimestampSpec timestampSpec, Supplier<Map<String, ?>> rawMapSupplier) Given a plain Java Object, extract a timestamp from it using the providedTimestampSpec, or throw aParseExceptionif we can't.- Parameters:
timeValue- object to interpret as timestmaptimestampSpec- timestamp specrawMapSupplier- supplier of the original raw data that this object came from. Used for error messages.
-