Class TableDefn

  • Direct Known Subclasses:
    DatasourceDefn, ExternalTableDefn

    public class TableDefn
    extends ObjectDefn
    Definition for all tables in the catalog. All tables have both properties and a schema. Subclasses define specific table types such as datasources or input tables. Some tables may be parameterized to allow the table to appear in a SQL table function by implementing the ParameterizedDefn interface.
    • Field Detail

      • DESCRIPTION_PROPERTY

        public static final String DESCRIPTION_PROPERTY
        Human-readable description of the datasource.
        See Also:
        Constant Field Values
    • Method Detail

      • bind

        public void bind​(TableDefnRegistry registry)
        Called after the table definition is added to the registry, along with all other definitions. Allows external tables to look up additional information, such as the set of input formats.
      • validate

        public void validate​(ResolvedTable table)
        Validate a table spec using the table, field and column definitions defined here. The column definitions validate the type of each property value using the object mapper.
      • validateColumns

        public void validateColumns​(List<ColumnSpec> columns)
      • validateColumn

        protected void validateColumn​(ColumnSpec colSpec)
        Table-specific validation of a column spec. Override for table definitions that need table-specific validation rules.
      • merge

        public TableSpec merge​(TableSpec spec,
                               TableSpec update,
                               com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
        Merge a table spec with an update. The merge affects both the properties and the list of columns.
      • mergeColumns

        public List<ColumnSpec> mergeColumns​(List<ColumnSpec> columns,
                                             List<ColumnSpec> update)
        Merge the set of columns from an existing spec and an update. Columns are matched by name. If the column exists, then it is updated. If the column does not exist, then the new column is appended to the existing list. This merge operation cannot remove columns or change order.