Class NiFiTable

java.lang.Object
org.apache.nifi.sql.NiFiTable
All Implemented Interfaces:
Closeable, AutoCloseable

public class NiFiTable extends Object implements Closeable
A table that can be queried in a CalciteDatabase
  • Field Details

    • name

      private final String name
    • tableSchema

      private final NiFiTableSchema tableSchema
    • logger

      private final org.apache.nifi.logging.ComponentLog logger
    • enumerators

      private final Set<NiFiTableEnumerator> enumerators
    • dataSource

      private volatile ResettableDataSource dataSource
    • maxRecordsRead

      private volatile int maxRecordsRead
  • Constructor Details

    • NiFiTable

      public NiFiTable(String name, ResettableDataSource dataSource, org.apache.nifi.logging.ComponentLog logger)
      Created a NiFi table with a datasource already established. The table's schema will be established as the schema of the datasource.
      Parameters:
      name - the name of the table. This is the name that should be referenced in SQL statements.
      dataSource - the source of data
      logger - the logger to use
    • NiFiTable

      public NiFiTable(String name, NiFiTableSchema schema, org.apache.nifi.logging.ComponentLog logger)
      Created a NiFi table without yet establishing the datasource. This table cannot be queried until the datasource is established by calling setDataSource(ResettableDataSource).
      Parameters:
      name - the name of the table. This is the name that should be referenced in SQL statements.
      schema - the table's schema
      logger - the logger to use
  • Method Details

    • getName

      public String getName()
    • setDataSource

      public void setDataSource(ResettableDataSource dataSource)
      Updates the datasource to use for retrieving rows of data. The given data source must have the same schema as was provided when the table was created.
      Parameters:
      dataSource - the source of data
    • getRecordsRead

      public int getRecordsRead()
      Returns:
      the number of records that were read from the datasource
    • createCalciteTable

      CalciteTable createCalciteTable()
    • createTableDefinition

      private org.apache.calcite.rel.type.RelDataType createTableDefinition(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable