arrays_zip with two same-named inputs fails with "ArrowArray struct has 2 children (expected 1)"
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu từ CometArraysZip.getSupportLevel và so sánh các kiểm tra của nó với CometCreateNamedStruct.getSupportLevel. Chạy lại ba truy vấn arrays_zip từ issue, sau đó để các tên trường trùng lặp chuyển sang fallback thay vì đi tới JVM Arrow import. Xác nhận rằng arrays_zip(a, b) vẫn chạy native và hai trường hợp có cùng tên khớp với Spark mà không có lỗi import.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
arrays_zip over two inputs with the same name fails the task when Comet runs it natively. Spark names each struct field after its input, so arrays_zip(a, a) has type array<struct<a: string, a: string>>, and Comet's native projection returns that struct fine. Importing the result on the JVM then fails, because Java Arrow keys struct children by name and the two a children collapse into one:
java.lang.IllegalStateException: ArrowArray struct has 2 children (expected 1)
at org.apache.arrow.util.Preconditions.checkState(Preconditions.java:562)
at org.apache.arrow.c.ArrayImporter.doImport(ArrayImporter.java:92)
at org.apache.arrow.c.ArrayImporter.importChild(ArrayImporter.java:83)
at org.apache.arrow.c.ArrayImporter.doImport(ArrayImporter.java:101)
at org.apache.arrow.c.ArrayImporter.importArray(ArrayImporter.java:68)
at org.apache.arrow.c.ArrowImporter.importVector(ArrowImporter.java:62)
at org.apache.comet.vector.NativeUtil.importVector(NativeUtil.scala:264)
at org.apache.comet.vector.NativeUtil.getNextBatch(NativeUtil.scala:211)
at org.apache.comet.CometExecIterator.getNextBatch(CometExecIterator.scala:237)
arrays_zip(a, b) over the same table works. Spark returns the zipped rows for all three queries below.
This is the same Java Arrow limitation as #1015 and #5605. CometCreateNamedStruct.getSupportLevel already returns Unsupported when names has duplicates, and DataTypeSupport rejects such structs in operator schemas, but CometArraysZip.getSupportLevel only checks the input types and never looks at expr.names. Two same-named inputs come up naturally after a join, for example arrays_zip(t1.tags, t2.tags).
Steps to reproduce
Default configs, reproduced on main at f7952de73 with Spark 4.1.3:
spark.range(4)
.selectExpr("id", "array(cast(id as string), 'x') as a", "array(id, id + 1) as b")
.write.parquet(path)
val df = spark.read.parquet(path)
df.selectExpr("id", "arrays_zip(a, a) AS r").collect() // IllegalStateException
df.selectExpr("id", "arrays_zip(b, b) AS r").collect() // IllegalStateException
df.selectExpr("id", "arrays_zip(a, b) AS r").collect() // matches Spark
The plan is CometProject over CometNativeScan.
Expected behavior
Either match Spark or fall back. The smallest fix is probably for CometArraysZip.getSupportLevel to return Unsupported when expr.names has duplicates, the same way CometCreateNamedStruct does.
Additional context
Found while reviewing #6036, but unrelated to that PR's change.
- Ngôn ngữ chính
- Scala
- Star
- 1.3k
- Fork
- 377
- Merge trung bình
- 2 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 271
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/datafusion-comet
-
area:ci bug priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
apache/datafusion-comet#6060 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/datafusion-comet#5661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug triage results: 2026-08-31Đang mởrequires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/datafusion-comet#5601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:scan enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
apache/datafusion-comet#5319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ci priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
apache/datafusion-comet#4586 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/datafusion-comet
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ergoplatform/ergo#2579 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
x:action/improve x:size/tiny x:type/content
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
typelevel/sbt-typelevel#929 ·