Package org.apache.druid.data.input.impl
Class MapInputRowParser
java.lang.Object
org.apache.druid.data.input.impl.MapInputRowParser
- All Implemented Interfaces:
InputRowParser<Map<String,Object>>
-
Constructor Summary
Constructors -
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) parseBatch(Map<String, Object> theMap) Parse an input into list ofInputRow.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.withParseSpec(ParseSpec parseSpec) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.data.input.impl.InputRowParser
parse
-
Constructor Details
-
MapInputRowParser
-
-
Method Details
-
parseBatch
Description copied from interface:InputRowParserParse an input into list ofInputRow. List can contains null for rows that should be thrown away, or throwsParseExceptionif the input is unparseable. This method should never return null otherwise lots of things will break.- Specified by:
parseBatchin interfaceInputRowParser<Map<String,Object>>
-
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.
-
getParseSpec
- Specified by:
getParseSpecin interfaceInputRowParser<Map<String,Object>>
-
withParseSpec
- Specified by:
withParseSpecin interfaceInputRowParser<Map<String,Object>>
-