1fanwang commented on code in PR #5539:
URL: https://github.com/apache/datafusion-comet/pull/5539#discussion_r3886857057
##########
spark/src/main/scala/org/apache/comet/vector/NativeUtil.scala:
##########
@@ -254,15 +254,29 @@ class NativeUtil {
def importVector(arrays: Array[ArrowArray], schemas: Array[ArrowSchema]):
Seq[CometVector] = {
val arrayVectors = mutable.ArrayBuffer.empty[CometVector]
- (0 until arrays.length).foreach { i =>
- val arrowSchema = schemas(i)
- val arrowArray = arrays(i)
+ try {
+ (0 until arrays.length).foreach { i =>
+ val arrowSchema = schemas(i)
+ val arrowArray = arrays(i)
- arrayVectors += CometVector.getVector(
- importer.importVector(arrowArray, arrowSchema, dictionaryProvider),
- dictionaryProvider)
+ arrayVectors += CometVector.getVector(
+ importer.importVector(arrowArray, arrowSchema, dictionaryProvider),
+ dictionaryProvider)
+ }
+ arrayVectors.toSeq
+ } catch {
+ case failure: Throwable =>
+ val firstUnconsumed = arrayVectors.length
+ arrayVectors.foreach { vector =>
Review Comment:
Done in
https://github.com/apache/datafusion-comet/commit/1f098bb49c90c63f21a94adafdaab482f25d5bc6.
Cleanup now uses Arrow's AutoCloseables . NativeUtil implements
AutoCloseable , and the test vectors use Using.resource .
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]