Package org.apache.nifi.sql
Class NiFiTable
java.lang.Object
org.apache.nifi.sql.NiFiTable
- All Implemented Interfaces:
Closeable,AutoCloseable
A table that can be queried in a
CalciteDatabase-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ResettableDataSourceprivate final Set<NiFiTableEnumerator> private final org.apache.nifi.logging.ComponentLogprivate intprivate final Stringprivate final NiFiTableSchema -
Constructor Summary
ConstructorsConstructorDescriptionNiFiTable(String name, NiFiTableSchema schema, org.apache.nifi.logging.ComponentLog logger) Created a NiFi table without yet establishing the datasource.NiFiTable(String name, ResettableDataSource dataSource, org.apache.nifi.logging.ComponentLog logger) Created a NiFi table with a datasource already established. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()(package private) CalciteTableprivate org.apache.calcite.rel.type.RelDataTypecreateTableDefinition(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory) booleangetName()intinthashCode()voidsetDataSource(ResettableDataSource dataSource) Updates the datasource to use for retrieving rows of data.toString()
-
Field Details
-
name
-
tableSchema
-
logger
private final org.apache.nifi.logging.ComponentLog logger -
enumerators
-
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 datalogger- the logger to use
-
NiFiTable
Created a NiFi table without yet establishing the datasource. This table cannot be queried until the datasource is established by callingsetDataSource(ResettableDataSource).- Parameters:
name- the name of the table. This is the name that should be referenced in SQL statements.schema- the table's schemalogger- the logger to use
-
-
Method Details
-
getName
-
setDataSource
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
-
hashCode
public int hashCode() -
toString
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-