Java Code Examples for org.apache.arrow.vector.types.pojo.ArrowType#Union
The following examples show how to use
org.apache.arrow.vector.types.pojo.ArrowType#Union .
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: ArrowTypeSerDe.java From aws-athena-query-federation with Apache License 2.0 | 5 votes |
@Override protected void doTypedSerialize(ArrowType arrowType, JsonGenerator jgen, SerializerProvider provider) throws IOException { ArrowType.Union union = (ArrowType.Union) arrowType; jgen.writeStringField(MODE_FIELD, union.toString()); jgen.writeArrayFieldStart(TYPE_IDS_FIELD); for (int typeId : union.getTypeIds()) { jgen.writeNumber(typeId); } jgen.writeEndArray(); }
Example 2
Source File: ArrowTypeSerDe.java From aws-athena-query-federation with Apache License 2.0 | 5 votes |
@Override protected ArrowType doTypedDeserialize(JsonParser jparser, DeserializationContext ctxt) throws IOException { UnionMode mode = UnionMode.valueOf(getNextStringField(jparser, MODE_FIELD)); assertFieldName(jparser, TYPE_IDS_FIELD); ImmutableList.Builder<Integer> typeIds = ImmutableList.builder(); while (jparser.nextToken() != JsonToken.END_ARRAY) { typeIds.add(jparser.getValueAsInt()); } return new ArrowType.Union(mode, Ints.toArray(typeIds.build())); }
Example 3
Source File: CompleteType.java From dremio-oss with Apache License 2.0 | 5 votes |
public static CompleteType union(Iterable<Field> fields){ ImmutableList<Field> listOfFields = ImmutableList.copyOf(fields); int[] typeIds = new int[listOfFields.size()]; for (int i =0; i < typeIds.length; i++) { typeIds[i] = MajorTypeHelper.getArrowMinorType(CompleteType.fromField(listOfFields.get(i)).toMinorType()).ordinal(); } return new CompleteType(new ArrowType.Union(UnionMode.Sparse, typeIds), listOfFields); }
Example 4
Source File: ArrowTypeSerDe.java From aws-athena-query-federation with Apache License 2.0 | 4 votes |
private Serializer() { super(ArrowType.class, ArrowType.Union.class); }
Example 5
Source File: ArrowTypeSerDe.java From aws-athena-query-federation with Apache License 2.0 | 4 votes |
private Deserializer() { super(ArrowType.class, ArrowType.Union.class); }
Example 6
Source File: APIFieldDescriber.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public Void visit(ArrowType.Union union) { return writeString(sqlTypeNameVisitor.visit(union)); }