Class BigtableTableSchema
bigtable table: which column is the row key, and which column family
and qualifier every other column addresses.
The model is the HBase connector's, so that a table definition moves between the two with its schema intact:
Abbreviated, not compiled: deployment-specific connector options are omitted.
CREATE TABLE bt (
rowkey STRING,
cf1 ROW<qual1 STRING, qual2 BIGINT>,
cf2 ROW<metric DOUBLE>,
PRIMARY KEY (rowkey) NOT ENFORCED
) WITH ('connector' = 'bigtable', ...)
Exactly one column is neither a ROW nor a MAP, and that column is the row key;
every ROW column is a column family whose nested field names are the qualifiers. Upstream
google/flink-connector-gcp's alternative — a value.format per family — was weighed and
declined on #34: it
cannot give a single qualifier its own type, and it ties a family to a format.
A MAP<STRING, V> or MAP<BYTES, V> column is a column family too, declared
without its qualifiers: each entry is one qualifier and its latest cell, every value has the one
type V, and the family is read and written whole. This is how GoogleSQL for Bigtable
presents a family, and it is the form a schema derived from table metadata alone can take, since
Bigtable stores families but neither qualifiers nor cell types (ADR-0172). The HBase connector
has no such form, so a DDL using one does not move to it.
Column order is preserved, because it is what a projection's indexes refer to.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne column family: aROWcolumn whose nested fields are its qualifiers, or aMAPcolumn whose entries are.static final classOne qualifier: a nested field of a column family'sROW. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the column families, in DDL order.intReturns the physical row's field count: its row key and its column families.intReturns the position of the row-key column in the physical row.Returns the name of the row-key column.org.apache.flink.table.types.logical.LogicalTypeReturns the declared type of the row-key column.inthashCode()static BigtableTableSchemaof(org.apache.flink.table.types.logical.RowType rowType) Reads the model out of a table's physical row type.
-
Method Details
-
of
Reads the model out of a table's physical row type.- Parameters:
rowType- the physical columns, in DDL order- Returns:
- the parsed schema
- Throws:
org.apache.flink.table.api.ValidationException- if the columns do not describe one row key and zero or more column families, or if a column's type, or a map's key or value type, has no cell encoding
-
getRowKeyIndex
public int getRowKeyIndex()Returns the position of the row-key column in the physical row. -
getRowKeyName
Returns the name of the row-key column. -
getRowKeyType
public org.apache.flink.table.types.logical.LogicalType getRowKeyType()Returns the declared type of the row-key column. -
getFamilies
Returns the column families, in DDL order. -
getFieldCount
public int getFieldCount()Returns the physical row's field count: its row key and its column families. -
equals
-
hashCode
public int hashCode()
-