Package org.apache.druid.data.input
Interface InputFormat
- All Known Implementing Classes:
CsvInputFormat,DelimitedInputFormat,FlatTextInputFormat,JsonInputFormat,LinesInputFormat,NestedInputFormat,RegexInputFormat
public interface InputFormat
InputFormat abstracts the file format of input data.
It creates a
InputEntityReader to read data and parse it into InputRow.
The created InputEntityReader is used by InputSourceReader.
See NestedInputFormat for nested input formats such as JSON.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncreateReader(InputRowSchema inputRowSchema, InputEntity source, File temporaryDirectory) default RowAdapter<InputRow>createRowAdapter(InputRowSchema inputRowSchema) Returns an adapter that can read the rows fromcreateReader(InputRowSchema, InputEntity, File), given a particularInputRowSchema.default longgetWeightedSize(String path, long size) Computes the weighted size of a given input object of the underyling input format type, weighted for its cost during ingestion.booleanTrait to indicate that a file can be split into multipleInputSplits.
-
Field Details
-
TYPE_PROPERTY
- See Also:
-
-
Method Details
-
isSplittable
boolean isSplittable()Trait to indicate that a file can be split into multipleInputSplits.This method is not being used anywhere for now, but should be considered in
SplittableInputSource.createSplits(org.apache.druid.data.input.InputFormat, org.apache.druid.data.input.SplitHintSpec)in the future. -
createReader
InputEntityReader createReader(InputRowSchema inputRowSchema, InputEntity source, File temporaryDirectory) -
getWeightedSize
Computes the weighted size of a given input object of the underyling input format type, weighted for its cost during ingestion. The weight calculated is dependent on the format type and compression type (CompressionUtils.Format) used if any. Uncompressed newline delimited json is used as baseline with scale factor 1. This means that when computing the byte weight that an uncompressed newline delimited json input object has towards ingestion, we take the file size as is, 1:1.- Parameters:
path- The path of the input object. Used to tell whether any compression is used.size- The size of the input object in bytes.- Returns:
- The weighted size of the input object.
-
createRowAdapter
Returns an adapter that can read the rows fromcreateReader(InputRowSchema, InputEntity, File), given a particularInputRowSchema. Note thatRowAdapters.standardRow()always works, but the one returned by this method may be more performant.
-