|
21 | 21 | import org.apache.arrow.adapter.avro.producers.AvroBigIntProducer; |
22 | 22 | import org.apache.arrow.adapter.avro.producers.AvroBooleanProducer; |
23 | 23 | import org.apache.arrow.adapter.avro.producers.AvroBytesProducer; |
24 | | -import org.apache.arrow.adapter.avro.producers.AvroDenseUnionProducer; |
25 | 24 | import org.apache.arrow.adapter.avro.producers.AvroFixedSizeBinaryProducer; |
26 | 25 | import org.apache.arrow.adapter.avro.producers.AvroFixedSizeListProducer; |
27 | 26 | import org.apache.arrow.adapter.avro.producers.AvroFloat2Producer; |
|
40 | 39 | import org.apache.arrow.adapter.avro.producers.AvroUint2Producer; |
41 | 40 | import org.apache.arrow.adapter.avro.producers.AvroUint4Producer; |
42 | 41 | import org.apache.arrow.adapter.avro.producers.AvroUint8Producer; |
43 | | -import org.apache.arrow.adapter.avro.producers.AvroUnionProducer; |
44 | 42 | import org.apache.arrow.adapter.avro.producers.BaseAvroProducer; |
45 | 43 | import org.apache.arrow.adapter.avro.producers.CompositeAvroProducer; |
46 | 44 | import org.apache.arrow.adapter.avro.producers.Producer; |
|
94 | 92 | import org.apache.arrow.vector.UInt8Vector; |
95 | 93 | import org.apache.arrow.vector.VarBinaryVector; |
96 | 94 | import org.apache.arrow.vector.VarCharVector; |
97 | | -import org.apache.arrow.vector.complex.DenseUnionVector; |
98 | 95 | import org.apache.arrow.vector.complex.FixedSizeListVector; |
99 | 96 | import org.apache.arrow.vector.complex.ListVector; |
100 | 97 | import org.apache.arrow.vector.complex.MapVector; |
101 | 98 | import org.apache.arrow.vector.complex.StructVector; |
102 | | -import org.apache.arrow.vector.complex.UnionVector; |
103 | 99 | import org.apache.arrow.vector.types.FloatingPointPrecision; |
104 | 100 | import org.apache.arrow.vector.types.TimeUnit; |
105 | 101 | import org.apache.arrow.vector.types.Types; |
@@ -158,11 +154,11 @@ public class ArrowToAvroUtils { |
158 | 154 | * of its child fields are nullable. The schema for a nullable union will always contain a null |
159 | 155 | * type,none of the direct child types will be nullable. |
160 | 156 | * |
161 | | - * <p>List fields must contain precisely one child field, which may be nullable. Map fields must |
162 | | - * contain precisely two child fields, the key field and the value field. The key field must |
163 | | - * always be of type STRING (Utf8) and cannot be nullable. The value can be of any type and may be |
164 | | - * nullable. Record types must contain at least one child field and cannot contain multiple fields |
165 | | - * with the same name |
| 157 | + * <p>List fields must contain precisely one child field, which may be nullable. Map fields are |
| 158 | + * represented as a list of structs, where the struct fields are "key" and "value". The key field |
| 159 | + * must always be of type STRING (Utf8) and cannot be nullable. The value can be of any type and |
| 160 | + * may be nullable. Record types must contain at least one child field and cannot contain multiple |
| 161 | + * fields with the same name |
166 | 162 | * |
167 | 163 | * @param arrowFields The arrow fields used to generate the Avro schema |
168 | 164 | * @param typeName Name of the top level Avro record type |
@@ -707,27 +703,9 @@ private static BaseAvroProducer<?> createProducer(FieldVector vector, boolean nu |
707 | 703 | new AvroStructProducer(entryVector, new Producer<?>[] {keyProducer, valueProducer}); |
708 | 704 | return new AvroMapProducer(mapVector, entryProducer); |
709 | 705 |
|
710 | | - case UNION: |
711 | | - UnionVector unionVector = (UnionVector) vector; |
712 | | - List<FieldVector> unionChildVectors = unionVector.getChildrenFromFields(); |
713 | | - Producer<?>[] unionChildProducers = new Producer<?>[unionChildVectors.size()]; |
714 | | - for (int i = 0; i < unionChildVectors.size(); i++) { |
715 | | - FieldVector unionChildVector = unionChildVectors.get(i); |
716 | | - unionChildProducers[i] = |
717 | | - createProducer(unionChildVector, /* nullable = */ false); // Do not nest union types |
718 | | - } |
719 | | - return new AvroUnionProducer(unionVector, unionChildProducers); |
720 | | - |
721 | | - case DENSEUNION: |
722 | | - DenseUnionVector denseUnionVector = (DenseUnionVector) vector; |
723 | | - List<FieldVector> denseChildVectors = denseUnionVector.getChildrenFromFields(); |
724 | | - Producer<?>[] denseChildProducers = new Producer<?>[denseChildVectors.size()]; |
725 | | - for (int i = 0; i < denseChildVectors.size(); i++) { |
726 | | - FieldVector denseChildVector = denseChildVectors.get(i); |
727 | | - denseChildProducers[i] = |
728 | | - createProducer(denseChildVector, /* nullable = */ false); // Do not nest union types |
729 | | - } |
730 | | - return new AvroDenseUnionProducer(denseUnionVector, denseChildProducers); |
| 706 | + // Support for UNION and DENSEUNION is not currently available |
| 707 | + // This is pending fixes in the implementation of the union vectors themselves |
| 708 | + // https://github.com/apache/arrow-java/issues/108 |
731 | 709 |
|
732 | 710 | default: |
733 | 711 | // Not all Arrow types are supported for encoding (yet)! |
|
0 commit comments