Class HeaderBuilder

java.lang.Object
org.apache.drill.exec.store.easy.text.reader.HeaderBuilder

public class HeaderBuilder extends Object
Text output that implements a header reader/parser. The caller parses out the characters of each header; this class assembles UTF-8 bytes into Unicode characters, fixes invalid characters (those not legal for SQL symbols), and maps duplicate names to unique names.

That is, this class is as permissive as possible with file headers to avoid spurious query failures for trivial reasons.

  • Field Details

    • MAX_HEADER_LEN

      public static final int MAX_HEADER_LEN
      Maximum Drill symbol length, as enforced for headers.
      See Also:
    • COLUMN_PREFIX

      public static final String COLUMN_PREFIX
      Prefix used to replace non-alphabetic characters at the start of a column name. For example, $foo becomes col_foo. Used because SQL does not allow _foo.
      See Also:
    • ANONYMOUS_COLUMN_PREFIX

      public static final String ANONYMOUS_COLUMN_PREFIX
      Prefix used to create numbered columns for missing headers. Typical names: column_1, column_2, ...
      See Also:
  • Constructor Details

    • HeaderBuilder

      public HeaderBuilder(org.apache.hadoop.fs.Path filePath)
  • Method Details

    • startField

      public void startField(int index)
    • endField

      public boolean endField()
    • endEmptyField

      public boolean endEmptyField()
    • append

      public void append(byte data)
    • finishRecord

      public void finishRecord()
    • startRecord

      public void startRecord()
    • getHeaders

      public String[] getHeaders()
    • getRecordCount

      public long getRecordCount()
    • isFull

      public boolean isFull()