Package org.apache.druid.catalog.model
Class TableDefn
- java.lang.Object
-
- org.apache.druid.catalog.model.ObjectDefn
-
- org.apache.druid.catalog.model.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 theParameterizedDefninterface.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDESCRIPTION_PROPERTYHuman-readable description of the datasource.
-
Constructor Summary
Constructors Constructor Description TableDefn(String name, String typeValue, List<ModelProperties.PropertyDefn<?>> properties, List<ModelProperties.PropertyDefn<?>> columnProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(TableDefnRegistry registry)Called after the table definition is added to the registry, along with all other definitions.TableSpecmerge(TableSpec spec, TableSpec update, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)Merge a table spec with an update.List<ColumnSpec>mergeColumns(List<ColumnSpec> columns, List<ColumnSpec> update)Merge the set of columns from an existing spec and an update.voidvalidate(ResolvedTable table)Validate a table spec using the table, field and column definitions defined here.protected voidvalidateColumn(ColumnSpec colSpec)Table-specific validation of a column spec.voidvalidateColumns(List<ColumnSpec> columns)-
Methods inherited from class org.apache.druid.catalog.model.ObjectDefn
mergeProperties, name, properties, property, toPropertyMap, typeValue, validate
-
-
-
-
Field Detail
-
DESCRIPTION_PROPERTY
public static final String DESCRIPTION_PROPERTY
Human-readable description of the datasource.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TableDefn
public TableDefn(String name, String typeValue, List<ModelProperties.PropertyDefn<?>> properties, List<ModelProperties.PropertyDefn<?>> columnProperties)
-
-
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.
-
-