org.apache.arrow.vector.types.pojo.DictionaryEncoding Java Examples

The following examples show how to use org.apache.arrow.vector.types.pojo.DictionaryEncoding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BackwardCompatibleSchemaDe.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public Field deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
  JsonNode node = jsonParser.getCodec().readTree(jsonParser);

  JsonNode nameNode = node.get("name");
  final String name;
  if (nameNode instanceof NullNode) {
    name = null;
  } else {
    name = nameNode.asText();
  }

  boolean nullable = node.get("nullable").asBoolean();

  JsonNode arrowTypeNode = node.get("type");
  ArrowType arrowType = mapper.convertValue(arrowTypeNode, ArrowType.class);
  JsonNode dictionaryNode = node.get("dictionary");
  DictionaryEncoding dictionary = mapper.convertValue(dictionaryNode, DictionaryEncoding.class);
  JsonNode childrenNode = node.get("children");

  List<Field> children = fieldsReader.readValue(childrenNode);

  JsonNode metadataNode = node.get("metadata");
  Map<String,String> metadata = mapper.convertValue(metadataNode, Map.class);

  FieldType fieldType = new FieldType(nullable, arrowType, dictionary, metadata);
  return new Field(name, fieldType, children);
}