test: no test on main reaches the folded UnsafeArrayData literal fix from #6666

Đang mở Phù hợp với người mới
#7,458 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 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
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
scala, sql
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu với spark/src/test/resources/sql-tests/operators/one_row_relation.sql, file này thiếu chỉ thị -- ConstantFolding: enabled, và với CometSqlFileTestSuite, suite này bỏ qua constant folding trừ khi một file yêu cầu. Hoặc thêm chỉ thị vào các truy vấn đó, hoặc chuyển chúng sang expressions/array/folded_array_map_literals.sql, và đảm bảo các literal chạy dưới một toán tử Comet, ví dụ bằng cách chiếu (project) trên một bảng. Hoàn thành khi việc hoàn tác các lệnh gọi toArray[Any] trong spark/src/main/scala/org/apache/comet/serde/literals.scala khiến suite thất bại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

requires-triage
Describe the bug

#6666 changed CometLiteral to read array literal values with toArray[Any](elementType) instead of ArrayData.array. A constant-folded array such as sequence(1, 5) is an UnsafeArrayData, and UnsafeArrayData.array() throws. Before the change, planning such a query failed with UNSUPPORTED_CALL.

The test added for that change is the first three queries in spark/src/test/resources/sql-tests/operators/one_row_relation.sql. That file has no -- ConstantFolding: enabled line, and CometSqlFileTestSuite excludes ConstantFolding unless the file asks for it (the directive came in #6731, two days after #6666). So SELECT sequence(1, 5) there never folds. It runs through the native CometSequence, and the CometLiteral lines from #6666 are never reached. I couldn't find another test on main that folds an array into an UnsafeArrayData literal under a Comet operator, so putting .array back should go unnoticed.

Found in #7449, the branch-1.1 backport of the fix, which adds a Scala test that does fold: https://github.com/apache/datafusion-comet/pull/7449#pullrequestreview-5754272211

Steps to reproduce
  1. On main, change the two toArray[Any](...) calls in spark/src/main/scala/org/apache/comet/serde/literals.scala back to .array.
  2. Run CometSqlFileTestSuite for one_row_relation. With folding excluded, sequence(1, 5) stays a Sequence expression, so the reverted lines are never called and the file should still pass.
Expected behavior

A test on main fails when the fix is reverted. Either of these would do it:

  • Add -- ConstantFolding: enabled to the queries in one_row_relation.sql, or move them into a fixture that has it, such as expressions/array/folded_array_map_literals.sql.
  • Port the test from #7449, which projects sequence(1, 5) and array(sequence(1, 3), sequence(4, 5)) over a Parquet table. The nested query covers the inner makeListLiteral call as well.
Additional context

The queries need to read from a table, or run over a OneRowRelation with folding on, so that the folded literal sits under an operator Comet converts.

Ngôn ngữ chính
Scala
Star
1.3k
Fork
405
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
239

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/datafusion-comet

Tất cả issue của apache/datafusion-comet

Issue tương tự

Thêm issue về Scala

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.