Class ColumnListsCache

java.lang.Object
org.apache.drill.exec.store.hive.ColumnListsCache

public class ColumnListsCache extends Object
The class represents "cache" for partition and table columns. Used to reduce physical plan for Hive tables. Only unique partition lists of columns stored in the column lists cache. Table columns should be stored at index 0.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ColumnListsCache(org.apache.hadoop.hive.metastore.api.Table table)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    addOrGet(List<org.apache.hadoop.hive.metastore.api.FieldSchema> columns)
    Checks if column list has been added before and returns position of column list.
    List<org.apache.hadoop.hive.metastore.api.FieldSchema>
    getColumns(int index)
    Returns list of columns at the specified position in fields list, or null if index is negative or greater than fields list size.
    List<List<org.apache.hadoop.hive.metastore.api.FieldSchema>>
     
    List<org.apache.hadoop.hive.metastore.api.FieldSchema>
    Safely retrieves Hive table columns from cache.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ColumnListsCache

      public ColumnListsCache(org.apache.hadoop.hive.metastore.api.Table table)
    • ColumnListsCache

      public ColumnListsCache()
  • Method Details

    • addOrGet

      public int addOrGet(List<org.apache.hadoop.hive.metastore.api.FieldSchema> columns)
      Checks if column list has been added before and returns position of column list. If list is unique, adds list to the fields list and returns it position. Returns -1, if equals null.
      Parameters:
      columns - list of columns
      Returns:
      index of or -1, if equals null
    • getColumns

      public List<org.apache.hadoop.hive.metastore.api.FieldSchema> getColumns(int index)
      Returns list of columns at the specified position in fields list, or null if index is negative or greater than fields list size.
      Parameters:
      index - index of column list to return
      Returns:
      list of columns at the specified position in fields list or null if index is negative or greater than fields list size
    • getTableSchemaColumns

      public List<org.apache.hadoop.hive.metastore.api.FieldSchema> getTableSchemaColumns()
      Safely retrieves Hive table columns from cache.
      Returns:
      list of table columns defined in hive
    • getFields

      public List<List<org.apache.hadoop.hive.metastore.api.FieldSchema>> getFields()