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.
  • Field Details

  • Constructor Details

    • FormattedInputSourceDefn

      public FormattedInputSourceDefn()
  • Method Details

    • bind

      public void bind(TableDefnRegistry registry)
      Description copied from interface: InputSourceDefn
      Gather information about the set of format definitions.
      Specified by:
      bind in interface InputSourceDefn
      Overrides:
      bind in class BaseInputSourceDefn
    • validate

      public void validate(ResolvedExternalTable table)
      Description copied from interface: InputSourceDefn
      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.
      Specified by:
      validate in interface InputSourceDefn
      Overrides:
      validate in class BaseInputSourceDefn
      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: BaseInputSourceDefn
      Overridden by each subclass to define the parameters needed by each input source.
      Specified by:
      defineAdHocTableFunction in class BaseInputSourceDefn
    • 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 InputFormat convertTableToFormat(ResolvedExternalTable table)
      Description copied from class: BaseInputSourceDefn
      Convert the format spec, if any, to an input format.
      Specified by:
      convertTableToFormat in class BaseInputSourceDefn
    • convertArgsToFormat

      protected InputFormat convertArgsToFormat(Map<String,Object> args, List<ColumnSpec> columns, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
      Description copied from class: BaseInputSourceDefn
      Convert SQL arguments, and the column schema, to an input format, if required.
      Overrides:
      convertArgsToFormat in class BaseInputSourceDefn
    • 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 catalog
      args - values of arguments from an SQL table function. Here we consider only the format arguments; input source arguments should already have been handled
      columns - the set of columns provided by the SQL table function
      sourceMap - 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