Interface TableFactory<T extends Table>

Type Parameters:
T - Sub-type of table created by this factory
All Known Implementing Classes:
CsvStreamTableFactory, CsvTableFactory, DruidTableFactory, KafkaTableFactory, PigTableFactory, PreferredAlbumsTableFactory, PreferredGenresTableFactory, 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 Details

    • create

      T create​(SchemaPlus schema, String name, Map<String,​Object> operand, RelDataType rowType)
      Creates a Table.
      Parameters:
      schema - Schema this table belongs to
      name - Name of this table
      operand - The "operand" JSON property
      rowType - Row type. Specified if the "columns" JSON property.