Class BigtableTableSchema

java.lang.Object
io.github.flink.gcp.connector.bigtable.table.BigtableTableSchema

@Internal public final class BigtableTableSchema extends Object
The DDL schema of a 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 not a ROW 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.

Column order is preserved, because it is what a projection's indexes refer to.

  • Method Details

    • of

      public static BigtableTableSchema of(org.apache.flink.table.types.logical.RowType rowType)
      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 has no cell encoding
    • getRowKeyIndex

      public int getRowKeyIndex()
      Returns the position of the row-key column in the physical row.
    • getRowKeyName

      public String 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

      public List<BigtableTableSchema.Family> 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

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

      public int hashCode()
      Overrides:
      hashCode in class Object