Search in sources :

Example 1 with ValueParser

use of org.apache.drill.exec.store.easy.json.parser.ValueParser in project drill by apache.

the class ExtendedTypeFieldFactory method arrayParserFor.

private ElementParser arrayParserFor(FieldDefn fieldDefn) {
    TokenIterator tokenizer = fieldDefn.tokenizer();
    JsonToken token = tokenizer.requireNext();
    if (token != JsonToken.START_OBJECT) {
        tokenizer.unget(token);
        return null;
    }
    ValueParser element = extendedTypeParserFor(fieldDefn, true);
    tokenizer.unget(token);
    if (element == null) {
        return null;
    }
    return scalarArrayParserFor(element);
}
Also used : TokenIterator(org.apache.drill.exec.store.easy.json.parser.TokenIterator) ValueParser(org.apache.drill.exec.store.easy.json.parser.ValueParser) JsonToken(com.fasterxml.jackson.core.JsonToken)

Example 2 with ValueParser

use of org.apache.drill.exec.store.easy.json.parser.ValueParser in project drill by apache.

the class ProvidedFieldFactory method basicParserFor.

private ElementParser basicParserFor(FieldDefn fieldDefn) {
    // Delegate parser creation downward: will be done by the extended
    // types factory, if present, else by inferred field factory.
    ColumnMetadata colSchema = fieldDefn.providedColumn().copy();
    ValueParser scalarParser = child.scalarParserFor(fieldDefn, colSchema);
    if (colSchema.isArray()) {
        return scalarArrayParserFor(scalarParser);
    } else {
        return scalarParser;
    }
}
Also used : ColumnMetadata(org.apache.drill.exec.record.metadata.ColumnMetadata) ValueParser(org.apache.drill.exec.store.easy.json.parser.ValueParser)

Aggregations

ValueParser (org.apache.drill.exec.store.easy.json.parser.ValueParser)2 JsonToken (com.fasterxml.jackson.core.JsonToken)1 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)1 TokenIterator (org.apache.drill.exec.store.easy.json.parser.TokenIterator)1