jichen20210919 opened a new pull request, #6459:
URL: https://github.com/apache/paimon/pull/6459
…(#6452)
###Issue Description:
We have found following corner case for ArrowFormatCWriter, if Paimon schema
has no fields, when we call method ArrowFormatCWriter.toCStruct, following
exception will occur:
`java.lang.IllegalArgumentException
at
org.apache.arrow.util.Preconditions.checkArgument(Preconditions.java:122)
at
org.apache.arrow.vector.VectorSchemaRoot.getVector(VectorSchemaRoot.java:185)
at
org.apache.paimon.arrow.ArrowUtils.serializeToCStruct(ArrowUtils.java:224)
at
org.apache.paimon.arrow.vector.ArrowFormatCWriter.toCStruct(ArrowFormatCWriter.java:72)
at
org.apache.paimon.arrow.vector.ArrowFormatWriterTest.testArrowFormatCWriterWithEmptySchema(ArrowFormatWriterTest.java:292)`
it is because following line in
src/main/java/org/apache/paimon/arrow/ArrowUtils.java:L215
```
BufferAllocator bufferAllocator = vsr.getVector(0).getAllocator();
```
assume there are at least 1 fields in the vector schema root. We fix this by
explicitly use bufferAllocator in realWriter object.
<!-- Please specify the module before the PR name: [core] ... or [flink] ...
-->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: open #6452
<!-- What is the purpose of the change -->
Fix the java.lang.IllegalArgumentException
### Tests
<!-- List UT and IT cases to verify this change -->
ArrowFormatWriterTest.testArrowFormatCWriterWithEmptySchema
### API and Format
<!-- Does this change affect API or storage format -->
No
### Documentation
<!-- Does this change introduce a new feature -->
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]