Class Externals
java.lang.Object
org.apache.druid.sql.calcite.external.Externals
Conversion functions to-from the SQL, catalog and MSQ representations
of external tables.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExternalTablebuildExternalTable(ExternalTableSpec spec, com.fasterxml.jackson.databind.ObjectMapper jsonMapper) Create an MSQ ExternalTable given an external table spec.convertArguments(TableFunction fn, List<?> arguments) Convert the list of Calcite function arguments to a map of non-null arguments.static List<ColumnSpec>convertColumns(org.apache.calcite.sql.SqlNodeList schema) Converts from a list of (identifier, type, ...) pairs to list of column specs.static List<org.apache.calcite.schema.FunctionParameter>Convert parameters from Catalog external table definition form to the SQL form used for a table macro and its function.static List<org.apache.calcite.rel.type.RelDataType>Extract the data types (only) from a list of SQL parameters.static ResourceActionexternalRead(String name) static ExternalTabletoExternalTable(ExternalTableSpec spec, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, com.google.common.base.Supplier<Set<String>> inputSourceTypesSupplier) static org.apache.calcite.sql.type.SqlOperandMetadataDefine a variadic (variable arity) type checker that allows an argument count that ranges from the number of required parameters to the number of available parameters.
-
Field Details
-
EXTERNAL_RESOURCE_ACTION
-
-
Constructor Details
-
Externals
public Externals()
-
-
Method Details
-
convertParameters
Convert parameters from Catalog external table definition form to the SQL form used for a table macro and its function. -
dataTypes
public static List<org.apache.calcite.rel.type.RelDataType> dataTypes(List<org.apache.calcite.schema.FunctionParameter> parameters) Extract the data types (only) from a list of SQL parameters. -
variadic
public static org.apache.calcite.sql.type.SqlOperandMetadata variadic(List<org.apache.calcite.schema.FunctionParameter> params) Define a variadic (variable arity) type checker that allows an argument count that ranges from the number of required parameters to the number of available parameters. We have to define this because the Calcite form does not allow optional parameters, but we allow any parameter to be optional. We are also not fussy about the type: we catch any type errors from the declared types. We catch missing required parameters at conversion time, where we also catch invalid values, incompatible values, and so on. -
convertArguments
Convert the list of Calcite function arguments to a map of non-null arguments. The resulting map must be mutable as processing may rewrite values. -
convertColumns
Converts from a list of (identifier, type, ...) pairs to list of column specs. The schema itself comes from the Druid-specific EXTEND syntax added to the parser. -
buildExternalTable
public static ExternalTable buildExternalTable(ExternalTableSpec spec, com.fasterxml.jackson.databind.ObjectMapper jsonMapper) Create an MSQ ExternalTable given an external table spec. Enforces type restructions (which should be revisited.) -
externalRead
-
toExternalTable
public static ExternalTable toExternalTable(ExternalTableSpec spec, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, com.google.common.base.Supplier<Set<String>> inputSourceTypesSupplier)
-