You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@auron.apache.org by "yew1eb (via GitHub)" <gi...@apache.org> on 2025/12/03 02:24:17 UTC

[PR] [AURON #1688] Fix type mismatch: cast lpad/rpad len (2nd arg) to LongType [auron]

yew1eb opened a new pull request, #1689:
URL: https://github.com/apache/auron/pull/1689

   
   
   # Which issue does this PR close?
   
   Closes #1688 .
   
    # Rationale for this change
   Current lpad/rpad functions use the DataFusion implementation. Native execution panics when the len (2nd arg) is INT (Int32), because DataFusion expects len to be Int64, leading to a cast failure.  
   
   # What changes are included in this PR?
   - cast len (2nd arg) to LongType in NativeConverters for lpad/rpad.  
   
   # Are there any user-facing changes?
   
   # How was this patch tested?
   unit tests.
   


-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AURON #1688] Fix type mismatch: cast lpad/rpad len (2nd arg) to LongType [auron]

Posted by "ShreyeshArangath (via GitHub)" <gi...@apache.org>.
ShreyeshArangath commented on code in PR #1689:
URL: https://github.com/apache/auron/pull/1689#discussion_r2596435730


##########
spark-extension-shims-spark/src/test/scala/org.apache.auron/AuronQuerySuite.scala:
##########
@@ -281,20 +281,24 @@ class AuronQuerySuite extends AuronQueryTest with BaseAuronSQLSuite with AuronSQ
   }
 
   test("lpad/rpad basic") {
-    Seq(
-      ("select lpad('abc', 5, '*')", Row("**abc")),
-      ("select rpad('abc', 5, '*')", Row("abc**")),
-      ("select lpad('spark', 2, '0')", Row("sp")),
-      ("select rpad('spark', 2, '0')", Row("sp")),
-      ("select lpad('9', 5, 'ab')", Row("abab9")),
-      ("select rpad('9', 5, 'ab')", Row("9abab")),
-      ("select lpad('hi', 5, '')", Row("hi")),
-      ("select rpad('hi', 5, '')", Row("hi")),
-      ("select lpad('x', 0, 'a')", Row("")),
-      ("select rpad('x', -1, 'a')", Row("")),
-      ("select lpad('Z', 3, '++')", Row("++Z")),
-      ("select rpad('Z', 3, 'AB')", Row("ZAB"))).foreach { case (q, expected) =>
-      checkAnswer(sql(q), Seq(expected))
+    withTable("pad_tbl") {
+      sql(s"CREATE TABLE pad_tbl(id INT, txt STRING, len INT, pad STRING) USING parquet")
+      sql(s"""
+             |INSERT INTO pad_tbl VALUES
+             | (1, 'abc', 5, ''),
+             | (2, 'abc', 5, ' '),
+             | (3, 'spark', 2, '0'),
+             | (4, 'spark', 2, '0'),
+             | (5, '9', 5, 'ab'),
+             | (6, '9', 5, 'ab'),
+             | (7, 'hi', 5, ''),
+             | (8, 'hi', 5, ''),
+             | (9, 'x', 0, 'a'),
+             | (10,'x', -1, 'a'),
+             | (11,'Z', 3, '++'),
+             | (12,'Z', 3, 'AB')
+      """.stripMargin)
+      checkSparkAnswerAndOperator("SELECT LPAD(txt, len, pad), rpad(txt, len, pad) FROM pad_tbl")

Review Comment:
   nit: just to stay consistent with the rest of the statement
   
   ```suggestion
         checkSparkAnswerAndOperator("SELECT LPAD(txt, len, pad), RPAD(txt, len, pad) FROM pad_tbl")
   ```



-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AURON #1688] Fix type mismatch: cast lpad/rpad len (2nd arg) to LongType [auron]

Posted by "richox (via GitHub)" <gi...@apache.org>.
richox merged PR #1689:
URL: https://github.com/apache/auron/pull/1689


-- 
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: commits-unsubscribe@auron.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org