Class Externals

java.lang.Object
org.apache.druid.sql.calcite.external.Externals

public class Externals extends Object
Conversion functions to-from the SQL, catalog and MSQ representations of external tables.
  • Field Details

    • EXTERNAL_RESOURCE_ACTION

      public static final ResourceAction EXTERNAL_RESOURCE_ACTION
  • Constructor Details

    • Externals

      public Externals()
  • Method Details

    • convertParameters

      public static List<org.apache.calcite.schema.FunctionParameter> convertParameters(TableFunction fn)
      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

      public static Map<String,Object> convertArguments(TableFunction fn, List<?> arguments)
      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

      public static List<ColumnSpec> convertColumns(org.apache.calcite.sql.SqlNodeList schema)
      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

      public static ResourceAction externalRead(String name)
    • toExternalTable

      public static ExternalTable toExternalTable(ExternalTableSpec spec, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, com.google.common.base.Supplier<Set<String>> inputSourceTypesSupplier)