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>>
public class MapInputRowParser extends Object implements InputRowParser<Map<String,Object>>
-
-
Constructor Summary
Constructors Constructor Description MapInputRowParser(ParseSpec parseSpec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<String>
findDimensions(TimestampSpec timestampSpec, DimensionsSpec dimensionsSpec, Set<String> fields)
Finds the final set of dimension names to use forInputRow
.ParseSpec
getParseSpec()
static InputRow
parse(InputRowSchema inputRowSchema, Map<String,Object> theMap)
List<InputRow>
parseBatch(Map<String,Object> theMap)
Parse an input into list ofInputRow
.static org.joda.time.DateTime
parseTimestamp(TimestampSpec timestampSpec, Map<String,Object> theMap)
InputRowParser
withParseSpec(ParseSpec parseSpec)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.data.input.impl.InputRowParser
parse
-
-
-
-
Constructor Detail
-
MapInputRowParser
public MapInputRowParser(ParseSpec parseSpec)
-
-
Method Detail
-
parseBatch
public List<InputRow> parseBatch(Map<String,Object> theMap)
Description copied from interface:InputRowParser
Parse an input into list ofInputRow
. List can contains null for rows that should be thrown away, or throwsParseException
if the input is unparseable. This method should never return null otherwise lots of things will break.- Specified by:
parseBatch
in interfaceInputRowParser<Map<String,Object>>
-
parse
public static InputRow parse(InputRowSchema inputRowSchema, 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)
-
getParseSpec
public ParseSpec getParseSpec()
- Specified by:
getParseSpec
in interfaceInputRowParser<Map<String,Object>>
-
withParseSpec
public InputRowParser withParseSpec(ParseSpec parseSpec)
- Specified by:
withParseSpec
in interfaceInputRowParser<Map<String,Object>>
-
-