What is the problem the feature request solves?
Writing to Arrow vectors through Comet's ArrowWriter class only uses setSafe on the underlying vectors. This incurs a capacity and resize check for every write. For CometSparkToColumnarExec we know the sizes ahead of time, so this is unnecessary overhead when performing a lot of writes.
Describe the potential solution
For ArrowWriter we should:
- Expose a way to set the capacities for column vectors. Note that
setInitialCapacity on the underlying BaseFixedWidthVector doesn't actually allocate anything, so we may need to call allocateNew as well.
- Extend
ArrowWriter to have unsafe methods that call set on the underlying vectors, probably with assertions that we can elide in release builds.
Additional context
No response
What is the problem the feature request solves?
Writing to Arrow vectors through Comet's
ArrowWriterclass only usessetSafeon the underlying vectors. This incurs a capacity and resize check for every write. ForCometSparkToColumnarExecwe know the sizes ahead of time, so this is unnecessary overhead when performing a lot of writes.Describe the potential solution
For
ArrowWriterwe should:setInitialCapacityon the underlyingBaseFixedWidthVectordoesn't actually allocate anything, so we may need to callallocateNewas well.ArrowWriterto have unsafe methods that callseton the underlying vectors, probably with assertions that we can elide in release builds.Additional context
No response