Class ResolvedExternalTable

java.lang.Object
org.apache.druid.catalog.model.table.ResolvedExternalTable

public class ResolvedExternalTable extends Object
Internal class to hold the intermediate form of an external table: the input source and input format properties converted to Java maps, and the types of each resolved to the corresponding definitions. Used to validate a table specification, and to convert a table specification to an ExternalTableSpec when used in SQL.
  • Field Details

  • Constructor Details

    • ResolvedExternalTable

      public ResolvedExternalTable(ResolvedTable table)
      Construct a resolved external table by extracting the input source and input format properties, and converting each to a Java map. Validates that the input source is present: the format is optional.

      Note: does not resolve the input source and input format definitions: that is done as a separate step when needed.

  • Method Details

    • resolvedTable

      public ResolvedTable resolvedTable()
    • resolve

      public ResolvedExternalTable resolve(TableDefnRegistry registry)
      Look up the input source type and input format type to find the corresponding definitions in the table registry. Throws an exception if the types are not defined. The input source is required, the format is optional.

      Note, for resolution to work, the name of each definition must be the same as that used as the type key in the serialized JSON.

    • validate

      public void validate(TableDefnRegistry registry)
      Validate that the table spec is correct by resolving the definitions, then converting the JSON to the desired object type. Note that this path requires special handling: the table spec may be partial, which means it is missing information needed to create a complete input source. The input source definition defines which values can be omitted, and defined later in SQL via function parameters. If those values are missing, then the input source defn should provide dummy values so that the validation will succeed (assuming that the properties that are provided are valid.)
    • tableFn

      public TableFunction tableFn()
      Return a table function definition for a partial table as given by this object. The function defines parameters to gather the values needed to convert the partial table into a fully-defined table which can be converted to an ExternalTableSpec.
    • convert

      public ExternalTableSpec convert()
      Return the ExternalTableSpec for a catalog entry for a this object which must be a fully-defined table.