Skip to content

Commit

Permalink
Workaround for apache/arrow#30866 for sparse unions
Browse files Browse the repository at this point in the history
  • Loading branch information
FiV0 committed Apr 2, 2024
1 parent acbe71c commit 4731528
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/clojure/xtdb/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(org.apache.arrow.memory AllocationManager ArrowBuf BufferAllocator)
(org.apache.arrow.memory.util ByteFunctionHelpers MemoryUtil)
(org.apache.arrow.vector BaseFixedWidthVector ValueVector VectorLoader VectorSchemaRoot)
(org.apache.arrow.vector.complex ListVector)
(org.apache.arrow.vector.complex ListVector UnionVector)
(org.apache.arrow.vector.ipc ArrowFileWriter ArrowStreamWriter ArrowWriter)
(org.apache.arrow.vector.ipc.message ArrowBlock ArrowFooter MessageSerializer)
xtdb.util.NormalForm))
Expand Down Expand Up @@ -338,6 +338,10 @@
(and (instance? ListVector v) (= 0 start-idx len))
(ListVector/empty (.getName v) (.getAllocator v))

(and (instance? UnionVector v) (= 0 start-idx len))
(doto (UnionVector/empty (.getName v) (.getAllocator v))
(.initializeChildrenFromFields (.getChildren (.getField v))))

;; doesn't preserve nullability otherwise
(instance? BaseFixedWidthVector v)
(-> (.getTransferPair v (.getField v) (.getAllocator v))
Expand Down

0 comments on commit 4731528

Please sign in to comment.