Class TableDefnRegistry

java.lang.Object
org.apache.druid.catalog.model.TableDefnRegistry

public class TableDefnRegistry extends Object
Registry of the table types supported in the catalog. This registry is used to validate insertions and updates. A table spec has a type field. That spec is said to be "resolved" when we use that type field to look up the definition for that type, and combine them into a ResolvedTable.

Note an inherent race condition: once a record is written into the metadata DB, that record has a life independent of what happens in this table. It may be that a catalog entry is created for a table type defined in an extension. Later, that extension is removed. The system must still work with the now "unknown" table types in the DB. But, we won't allow the use of, changes to, or new instances of that type. The choice is to delete the now undefined table, or restore the extension.

Holds onto the JSON mapper to simplify the resolution process: the ResolvedTable provides the mapper used to serialize the table spec.

  • Constructor Details

    • TableDefnRegistry

      public TableDefnRegistry(@Nullable List<TableDefn> tableDefnExtns, @Nullable List<InputSourceDefn> inputSourceDefnExtns, @Nullable List<InputFormatDefn> inputFormatDefnExtns, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
    • TableDefnRegistry

      @Inject public TableDefnRegistry(com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
  • Method Details

    • tableDefnFor

      public TableDefn tableDefnFor(String type)
    • jsonMapper

      public com.fasterxml.jackson.databind.ObjectMapper jsonMapper()
    • resolve

      public ResolvedTable resolve(TableSpec spec)
    • inputSourceDefnFor

      public InputSourceDefn inputSourceDefnFor(String type)
      Return input source definition for the given input source type name, or null if there is no such definition.
    • inputFormatDefnFor

      public InputFormatDefn inputFormatDefnFor(String type)
      Return input format definition for the given input format type name, or null if there is no such definition.
    • formats

      public Map<String,InputFormatDefn> formats()