Class TableInfo

java.lang.Object
io.trino.spi.eventlistener.TableInfo

public class TableInfo extends Object
This class is JSON serializable for convenience and serialization compatibility is not guaranteed across versions.
  • Constructor Details

  • Method Details

    • getCatalog

      public String getCatalog()
    • getSchema

      public String getSchema()
    • getTable

      public String getTable()
    • getAuthorization

      public String getAuthorization()
    • getFilters

      public List<String> getFilters()
    • getColumns

      public List<ColumnInfo> getColumns()
    • isDirectlyReferenced

      public boolean isDirectlyReferenced()
    • getViewText

      public Optional<String> getViewText()
      If this object refers to a view or materialized view, return the SQL text of the view.
      Returns:
      The SQL text of the view, or empty if this object does not refer to a view.
    • getReferenceChain

      public List<TableReferenceInfo> getReferenceChain()
      Get the reference chain for this table. Contains entries for view-like expressions such as views, column masks, and row filters. Note that in contrast to getFilters() and getColumns(), this has information about the reference chain leading this table to be included in the query, rather than information about which filters/masks were applied to this table scan.

      Let us assume the following setup, with default catalog "default" and default schema "db":

       CREATE TABLE t_base (a INT, b INT);
       CREATE VIEW v1 AS SELECT * FROM t_base;
       CREATE VIEW v2 AS SELECT * FROM v1;
      
       Row filter for t_base:      a NOT IN (SELECT * FROM t_filter)
       Column mask for t_base.b:   IF(b IN (SELECT * FROM t_mask), b, NULL)
       
      If we execute SELECT * FROM v2, we will see the following values for referenceChain:
       v2 -> []
       v1 -> [{"view", "default", "db", "v2"}]
       t_base -> [{"view", "default", "db", "v2"}, {"view", "default", "db", "v1"}]
       t_filter -> [{"view", "default", "db", "v2"}, {"view", "default", "db", "v1"}, {"rowFilter", "a NOT IN (SELECT * FROM t_filter)", "default", "db", "t_base"}]
       t_mask -> [{"view", "default", "db", "v2"}, {"view", "default", "db", "v1"}, {"columnMask", "IF(b IN SELECT * FROM t_mask, b, NULL)", "default", "db", "t_base"}]
       
      Returns:
      The reference chain leading to this table, in order.