java.lang.Object
org.apache.drill.exec.store.easy.json.loader.FieldDefn

public class FieldDefn extends Object
Describes a new field within an object. Allows the listener to control how to handle the field: as unprojected, parsed as a typed field, as text, as JSON, or as a custom parser.
  • Constructor Details

  • Method Details

    • key

      public String key()
      Returns the field name.
    • tupleParser

      public TupleParser tupleParser()
    • tokenizer

      public TokenIterator tokenizer()
      Token stream which allows a custom parser to look ahead as needed. The caller must "unget" all tokens to leave the tokenizer at the present location. Note that the underlying Jackson parser will return text for the last token consumed, even if tokens are unwound using the token iterator, so do not look ahead past the first field name or value; on look ahead over "static" tokens such as object and array start characters.
    • parser

      public JsonStructureParser parser()
      Returns the parent parser which is needed to construct standard parsers.
    • lookahead

      public ValueDef lookahead()
      Looks ahead to guess the field type based on JSON tokens. While this is helpful, it really only works if the JSON is structured like a list of tuples, if the initial value is not null, and if initial arrays are not empty. The structure parser cannot see into the future beyond the first field value; the value listener for each field must handle "type-deferral" if needed to handle missing or null values. That is, type-consistency is a semantic task handled by the listener, not a syntax task handled by the parser.
    • writer

      public TupleWriter writer()
    • providedColumn

      public ColumnMetadata providedColumn()
    • schemaFor

      public ColumnMetadata schemaFor(TypeProtos.MinorType type, boolean isArray)
    • schemaFor

      public ColumnMetadata schemaFor(TypeProtos.MinorType type, boolean isArray, boolean forUnknownSchema)
    • mode

      public TypeProtos.DataMode mode(boolean isArray)
    • scalarWriterFor

      public ScalarWriter scalarWriterFor(TypeProtos.MinorType type, boolean isArray)
    • scalarWriterFor

      public ScalarWriter scalarWriterFor(ColumnMetadata colSchema)
    • fieldWriterFor

      public ObjectWriter fieldWriterFor(ColumnMetadata colSchema)