Package org.apache.calcite.schema
Interface TableFactory<T extends Table>
- Type Parameters:
T- Sub-type of table created by this factory
- All Known Implementing Classes:
CsvStreamTableFactory,CsvTableFactory,CsvTableFactory,DruidTableFactory,InfiniteOrdersStreamTableFactory,KafkaTableFactory,OrdersStreamTableFactory,PigTableFactory,PreferredAlbumsTableFactory,PreferredGenresTableFactory,ProductsTableFactory,RedisTableFactory
public interface TableFactory<T extends Table>
Factory for
Table objects.
A table factory allows you to include custom tables in a model file. For example, here is a model that contains a custom table that generates a range of integers.
{
version: '1.0',
defaultSchema: 'MATH',
schemas: [
{
name: 'MATH',
tables: [
{
name: 'INTEGERS',
type: 'custom',
factory: 'com.acme.IntegerTable',
operand: {
start: 3,
end: 7,
column: 'N'
}
}
]
}
]
}
Given that schema, the query
SELECT * FROM math.integers
returns
+---+ | N | +---+ | 3 | | 4 | | 5 | | 6 | +---+
A class that implements TableFactory specified in a schema must have a public default constructor.
-
Method Summary
Modifier and TypeMethodDescriptioncreate(SchemaPlus schema, String name, Map<String, Object> operand, @Nullable RelDataType rowType) Creates a Table.
-
Method Details
-
create
Creates a Table.- Parameters:
schema- Schema this table belongs toname- Name of this tableoperand- The "operand" JSON propertyrowType- Row type. Specified if the "columns" JSON property.- Returns:
- created table
-