Class FormattedInputSourceDefn
- java.lang.Object
-
- org.apache.druid.catalog.model.table.BaseInputSourceDefn
-
- org.apache.druid.catalog.model.table.FormattedInputSourceDefn
-
- All Implemented Interfaces:
InputSourceDefn
- Direct Known Subclasses:
HttpInputSourceDefn,InlineInputSourceDefn,LocalInputSourceDefn
public abstract class FormattedInputSourceDefn extends BaseInputSourceDefn
Base class for input formats that require an input format (which is most of them.) By default, an input source supports all formats defined in the table registry, but specific input sources can be more restrictive. The list of formats defines the list of SQL function arguments available when defining a table from scratch.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.druid.catalog.model.table.BaseInputSourceDefn
BaseInputSourceDefn.AdHocTableFunction, BaseInputSourceDefn.PartialTableFunction
-
-
Field Summary
Fields Modifier and Type Field Description static StringFORMAT_PARAMETER
-
Constructor Summary
Constructors Constructor Description FormattedInputSourceDefn()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected List<TableFunction.ParameterDefn>addFormatParameters(List<TableFunction.ParameterDefn> properties)Add format properties to the base set, in the order of the formats, in the order defined by the format.protected abstract List<TableFunction.ParameterDefn>adHocTableFnParameters()Overridden by subclasses to provide the list of table function parameters for this specific input format.voidbind(TableDefnRegistry registry)Gather information about the set of format definitions.protected org.apache.druid.data.input.InputFormatconvertArgsToFormat(Map<String,Object> args, List<ColumnSpec> columns, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)Convert SQL arguments, and the column schema, to an input format, if required.protected ExternalTableSpecconvertPartialFormattedTable(ResolvedExternalTable table, Map<String,Object> args, List<ColumnSpec> columns, Map<String,Object> sourceMap)Converted a formatted external table given the table definition, function args, columns and the merged generic JSON map representing the input source.protected org.apache.druid.data.input.InputFormatconvertTableToFormat(ResolvedExternalTable table)Convert the format spec, if any, to an input format.protected BaseInputSourceDefn.AdHocTableFunctiondefineAdHocTableFunction()Overridden by each subclass to define the parameters needed by each input source.voidvalidate(ResolvedExternalTable table)Given a external table catalog spec, with the JSON input source and format properties parsed to generic Java maps, validate that the properties are valid prior to saving the spec into the catalog.-
Methods inherited from class org.apache.druid.catalog.model.table.BaseInputSourceDefn
adHocTableFn, auditInputSource, convertArgsToSource, convertArgsToSourceMap, convertArgsToTable, convertCompletedTable, convertSource, convertTable, convertTableToSource, inputSourceClass, selectPartialTableColumns
-
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.catalog.model.table.InputSourceDefn
partialTableFn, typeValue
-
-
-
-
Field Detail
-
FORMAT_PARAMETER
public static final String FORMAT_PARAMETER
- See Also:
- Constant Field Values
-
-
Method Detail
-
bind
public void bind(TableDefnRegistry registry)
Description copied from interface:InputSourceDefnGather information about the set of format definitions.- Specified by:
bindin interfaceInputSourceDefn- Overrides:
bindin classBaseInputSourceDefn
-
validate
public void validate(ResolvedExternalTable table)
Description copied from interface:InputSourceDefnGiven a external table catalog spec, with the JSON input source and format properties parsed to generic Java maps, validate that the properties are valid prior to saving the spec into the catalog.- Specified by:
validatein interfaceInputSourceDefn- Overrides:
validatein classBaseInputSourceDefn- Parameters:
table- a catalog table spec with the input source and input format properties parsed into generic Java maps
-
defineAdHocTableFunction
protected BaseInputSourceDefn.AdHocTableFunction defineAdHocTableFunction()
Description copied from class:BaseInputSourceDefnOverridden by each subclass to define the parameters needed by each input source.- Specified by:
defineAdHocTableFunctionin classBaseInputSourceDefn
-
adHocTableFnParameters
protected abstract List<TableFunction.ParameterDefn> adHocTableFnParameters()
Overridden by subclasses to provide the list of table function parameters for this specific input format. This list is combined with parameters for input formats. The method is called only once per run.
-
addFormatParameters
protected List<TableFunction.ParameterDefn> addFormatParameters(List<TableFunction.ParameterDefn> properties)
Add format properties to the base set, in the order of the formats, in the order defined by the format. Allow same-named properties across formats, as long as the types are the same.
-
convertTableToFormat
protected org.apache.druid.data.input.InputFormat convertTableToFormat(ResolvedExternalTable table)
Description copied from class:BaseInputSourceDefnConvert the format spec, if any, to an input format.- Specified by:
convertTableToFormatin classBaseInputSourceDefn
-
convertArgsToFormat
protected org.apache.druid.data.input.InputFormat convertArgsToFormat(Map<String,Object> args, List<ColumnSpec> columns, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
Description copied from class:BaseInputSourceDefnConvert SQL arguments, and the column schema, to an input format, if required.- Overrides:
convertArgsToFormatin classBaseInputSourceDefn
-
convertPartialFormattedTable
protected ExternalTableSpec convertPartialFormattedTable(ResolvedExternalTable table, Map<String,Object> args, List<ColumnSpec> columns, Map<String,Object> sourceMap)
Converted a formatted external table given the table definition, function args, columns and the merged generic JSON map representing the input source.- Parameters:
table- the resolved external table from the catalogargs- values of arguments from an SQL table function. Here we consider only the format arguments; input source arguments should already have been handledcolumns- the set of columns provided by the SQL table functionsourceMap- the generic JSON map for the input source with function parameters merged into the definition in the catalog- Returns:
- an external table spec to be used to create a Calcite table
-
-