Class 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.
    • Constructor Detail

      • FormattedInputSourceDefn

        public FormattedInputSourceDefn()
    • Method Detail

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