Support a literal str argument in native lpad/rpad
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Start with spark/src/main/scala/org/apache/comet/serde/strings.scala and confirm PR #7450 provides the scalar-string kernel support this change depends on. Remove the literal str rejection in both serdes, update the lpad and rpad notes in docs/source/user-guide/latest/expressions.md, and adjust string_lpad.sql and string_rpad.sql expectations. Done when literal str cases with literal pad use native dispatch, column pad cases still use codegen dispatch, and tests account for Spark constant folding.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is the problem the feature request solves?
CometStringLPad and CometStringRPad (spark/src/main/scala/org/apache/comet/serde/strings.scala) return Unsupported when the str argument is a Literal, so queries such as lpad('hi', len, 'xy') run through codegen dispatch instead of the native kernel.
The check was added in https://github.com/apache/datafusion-comet/pull/2630 because the native read_side_padding kernel only accepted a string array, and a literal str failed at runtime. https://github.com/apache/datafusion-comet/pull/7450 adds a scalar-string arm to the kernel: it handles a scalar str with a scalar or an array length, a NULL str, and a NULL length, without expanding the scalar. So the reason for the check no longer holds.
Raised by @coderfender in the #7450 review.
Describe the potential solution
- Drop the
expr.str.isInstanceOf[Literal]check (andPadReasons.literalStrReason) from both serdes. Thepadargument still has to be a literal. - Update the
lpad/rpadnotes indocs/source/user-guide/latest/expressions.md, which say literal strings use codegen dispatch. - In
string_lpad.sqlandstring_rpad.sql, switch the queries with a literalstrand a literalpad, such aslpad('hi', len, 'xy')andlpad('hi', len), fromexpect_dispatchtoexpect_native. Queries whosepadis a column stay on codegen dispatch. - An all-literal call is constant-folded by Spark, so the tests need a column length, or
ConstantFoldingexcluded.
Additional context
Depends on https://github.com/apache/datafusion-comet/pull/7450.
Willingness to contribute
I would be willing to contribute a fix for this bug with guidance from the DataFusion community
- Ngôn ngữ chính
- Scala
- Star
- 1.3k
- Fork
- 414
- Merge trung bình
- 3 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 210
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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
-
requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion-comet#7583 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
apache/datafusion-comet#7559 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:writer bug priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7558 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7557 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`rand` and `randn` with an integer seed fall back to Spark without a fallback reasonCó thể đã có người làm @galaxytemple đã nhận 3 ngày trước. Đang mởrequires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7479 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của apache/datafusion-comet
Issue tương tự
-
A-api C-bug S-ready-for-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ergoplatform/ergo#2932 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
lichess-org/lila#22454 ·
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 76/100
chipsalliance/rocket-chip#3845 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 13 ngày