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
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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>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 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 InputFormatConvert the format spec, if any, to an input format.protected BaseInputSourceDefn.AdHocTableFunctionOverridden 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, selectPartialTableColumnsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.catalog.model.table.InputSourceDefn
partialTableFn, typeValue
-
Field Details
-
FORMAT_PARAMETER
- See Also:
-
-
Constructor Details
-
FormattedInputSourceDefn
public FormattedInputSourceDefn()
-
-
Method Details
-
bind
Description copied from interface:InputSourceDefnGather information about the set of format definitions.- Specified by:
bindin interfaceInputSourceDefn- Overrides:
bindin classBaseInputSourceDefn
-
validate
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
Description copied from class:BaseInputSourceDefnOverridden by each subclass to define the parameters needed by each input source.- Specified by:
defineAdHocTableFunctionin classBaseInputSourceDefn
-
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
Description copied from class:BaseInputSourceDefnConvert the format spec, if any, to an input format.- Specified by:
convertTableToFormatin classBaseInputSourceDefn
-
convertArgsToFormat
protected 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
-