jichen20210919 opened a new pull request, #6453:
URL: https://github.com/apache/paimon/pull/6453

   When we write rows to arrow format with empty paimon schema,following 
exception will raise
   `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)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)`
   
   After code analysis,
   it is because following line in org/apache/paimon/arrow/ArrowUtils.java:L212
           BufferAllocator bufferAllocator = vsr.getVector(0).getAllocator();
   assume there are at least 1 fields presents in the vector schema root. it is 
not valid for this use case.
   We fix this by explicitly use bufferAllocator in realWriter object.
   
   <!-- Please specify the module before the PR name: [paimon-arrow] ... or 
[flink] ... -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: open #6452
   https://github.com/apache/paimon/issues/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
   
   


-- 
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]

Reply via email to