Support a literal str argument in native lpad/rpad
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Scala
- Estrellas
- 1.3k
- Forks
- 414
- Merge medio
- 3 d 5 h
- PR fusionados (30 d)
- 210
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/datafusion-comet
-
requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion-comet#7583 ·
Los mantenedores suelen responder en 2 días
-
bug priority:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
apache/datafusion-comet#7559 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
area:writer bug priority:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7558 ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7557 ·
Los mantenedores suelen responder en 2 días
-
`rand` and `randn` with an integer seed fall back to Spark without a fallback reasonPosiblemente ocupada @galaxytemple la tomó hace 3 días. Abiertorequires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7479 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de apache/datafusion-comet
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
chipsalliance/rocket-chip#3845 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
Los mantenedores suelen responder en 13 días
-
gesticulate: the `FastInfoset` suffix is written `fast-infoset`, not the registered `fastinfoset`Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
propensive/soundness#2437 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ergoplatform/ergo#2918 ·
Los mantenedores suelen responder en 3 días