Class FieldDefn
java.lang.Object
org.apache.drill.exec.store.easy.json.loader.FieldDefn
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 Summary
ConstructorDescriptionFieldDefn
(TupleParser tupleParser, String key, TokenIterator tokenizer) FieldDefn
(TupleParser tupleParser, String key, TokenIterator tokenizer, boolean isArray) -
Method Summary
Modifier and TypeMethodDescriptionfieldWriterFor
(ColumnMetadata colSchema) key()
Returns the field name.Looks ahead to guess the field type based on JSON tokens.mode
(boolean isArray) parser()
Returns the parent parser which is needed to construct standard parsers.scalarWriterFor
(TypeProtos.MinorType type, boolean isArray) scalarWriterFor
(ColumnMetadata colSchema) schemaFor
(TypeProtos.MinorType type, boolean isArray) schemaFor
(TypeProtos.MinorType type, boolean isArray, boolean forUnknownSchema) Token stream which allows a custom parser to look ahead as needed.writer()
-
Constructor Details
-
FieldDefn
-
FieldDefn
-
-
Method Details
-
key
Returns the field name. -
tupleParser
-
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
Returns the parent parser which is needed to construct standard parsers. -
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 notnull
, 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
-
providedColumn
-
schemaFor
-
schemaFor
public ColumnMetadata schemaFor(TypeProtos.MinorType type, boolean isArray, boolean forUnknownSchema) -
mode
-
scalarWriterFor
-
scalarWriterFor
-
fieldWriterFor
-