Interface InputFormatDefn
-
- All Known Implementing Classes:
InputFormats.BaseFormatDefn,InputFormats.CsvFormatDefn,InputFormats.DelimitedFormatDefn,InputFormats.FlatTextFormatDefn,InputFormats.JsonFormatDefn
public interface InputFormatDefnMetadata about a DruidInputFormat. Provides the logic to convert from a table spec or SQL function arguments to a specific form ofInputFormat. There is one instance of this interface for each supportedInputFormat.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.druid.data.input.InputFormatconvertFromArgs(Map<String,Object> args, List<ColumnSpec> columns, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)Create an input format instance from the values provided as arguments that correspond to the defined parameters.org.apache.druid.data.input.InputFormatconvertFromTable(ResolvedExternalTable table)Create an input format from a resolved catalog table spec.List<TableFunction.ParameterDefn>parameters()Obtain the parameters used to fully define an input format in a SQL function that defines an external table from scratch.StringtypeValue()voidvalidate(ResolvedExternalTable table)Given a resolved table that has the serialized JSON converted to a Java map, validate the values of that map, typically by converting that map the target input format object (after adjustments and filling in dummy columns.) THe goal is to validate the information the user has provided in the table spec.
-
-
-
Method Detail
-
typeValue
String typeValue()
- Returns:
- the string used to identify the input format type in the serialized
JSON for the input format. This is also the value used in the
formatproperty for SQL functions.
-
validate
void validate(ResolvedExternalTable table)
Given a resolved table that has the serialized JSON converted to a Java map, validate the values of that map, typically by converting that map the target input format object (after adjustments and filling in dummy columns.) THe goal is to validate the information the user has provided in the table spec. The final format information is validated elsewhere.
-
parameters
List<TableFunction.ParameterDefn> parameters()
Obtain the parameters used to fully define an input format in a SQL function that defines an external table from scratch. Note that the final list of table function arguments combines parameters from all the various input sources. It is legal for multiple formats to define the same parameter, as long as both definitions are of the same type.- Returns:
-
convertFromArgs
org.apache.druid.data.input.InputFormat convertFromArgs(Map<String,Object> args, List<ColumnSpec> columns, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
Create an input format instance from the values provided as arguments that correspond to the defined parameters. The map provided is guaranteed to have a value for each parameter defined as non-optional, and those values will be of the type defined in the parameter. The map will also contain values for the input source: the format should ignore values that don't correspond to parameters it defined.- Parameters:
args- the actual arguments for the defined parameterscolumns- the columns provided in SQL, typically via the `EXTEND` clause, but perhaps from an the table spec, if the function is for a partial tablejsonMapper- the mapper to use to perform conversions- Returns:
- an input format as defined by the arguments
- Throws:
org.apache.druid.java.util.common.IAE- if the arguments are not valid
-
convertFromTable
org.apache.druid.data.input.InputFormat convertFromTable(ResolvedExternalTable table)
Create an input format from a resolved catalog table spec. The format is given by the Java map within the given object.- Parameters:
table- resolved form of a table spec, with the format JSON parsed into a JSON map- Returns:
- an input format as defined by the table spec
- Throws:
org.apache.druid.java.util.common.IAE- if the spec is not valid
-
-