Class ImplicitColumnUtils.ImplicitColumns

java.lang.Object
org.apache.drill.exec.store.ImplicitColumnUtils.ImplicitColumns
Enclosing class:
ImplicitColumnUtils

public static class ImplicitColumnUtils.ImplicitColumns extends Object
This class represents an implicit column in a dataset. These columns are typically used for metadata that is consistent across an entire dataset. A filename for example, or HTTP response codes. It is a good practice to name implicit fields with an underscore so that these field names do not conflict with fields from the user's data. For example _http_response_code. Implicit fields do not appear in star queries so a user must explicitly include them in queries for them to appear.
  • Constructor Details

    • ImplicitColumns

      public ImplicitColumns(RowSetLoader rowWriter)
  • Method Details

    • addImplicitColumn

      public void addImplicitColumn(String fieldName, TypeProtos.MinorType type)
      Adds an implicit column. If there already is a column with the same name, the previous column will be overwritten.
      Parameters:
      fieldName - Name of the implicit column. Recommended that this start with an underscore.
      type - The Drill MinorType of the implicit column. Currently only supports simple types.
    • getColumn

      public ImplicitColumnUtils.ImplicitColumn getColumn(String fieldName)
      Returns a requested ImplicitColumn. If the column cannot be found, will return null.
      Parameters:
      fieldName - The field name of the desired column
      Returns:
      The specific column requested, null if that column does not exist.
    • writeImplicitColumns

      public void writeImplicitColumns()
      This function writes the data to the implicit columns. This should be called in the next() method in a batch reader so that the columns get populated. If there are no implicit columns, this function will do nothing, so null checks are not necessary.