This is an automated email from the ASF dual-hosted git repository.

taiyang-li pushed a commit to branch fake_add_bolt_backend
in repository https://gitbox.apache.org/repos/asf/gluten.git

commit f9aa6e0ffa774b2f05acaeb6fad47fbd627b3b17
Author: liyang.127 <[email protected]>
AuthorDate: Fri Jun 26 18:05:19 2026 +0800

    [GLUTEN][VL] Support format_number function in Velox backend
    
    Register the Spark format_number expression mapping (and the
    FORMAT_NUMBER expression name) so it can be offloaded to Velox, which
    natively supports format_number. Add a UT covering column inputs
    (non constant-folding) and update the scalar function support doc.
    
    Generated-by: TraeCli openrouter-3o
---
 .../gluten/functions/ScalarFunctionsValidateSuite.scala       | 11 +++++++++++
 docs/velox-backend-scalar-function-support.md                 |  4 ++--
 .../org/apache/gluten/expression/ExpressionMappings.scala     |  1 +
 .../scala/org/apache/gluten/expression/ExpressionNames.scala  |  1 +
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala
 
b/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala
index 38db4e9b3a..7e9f433142 100644
--- 
a/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala
+++ 
b/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala
@@ -551,6 +551,17 @@ abstract class ScalarFunctionsValidateSuite extends 
FunctionsValidateSuite {
     }
   }
 
+  test("format_number function with column inputs offloaded to native") {
+    runQueryAndCompare("""SELECT format_number(l_extendedprice, 2), l_orderkey
+                         | from lineitem limit 100""".stripMargin) {
+      checkGlutenPlan[ProjectExecTransformer]
+    }
+    runQueryAndCompare("""SELECT format_number(l_quantity, l_linenumber), 
l_orderkey
+                         | from lineitem limit 100""".stripMargin) {
+      checkGlutenPlan[ProjectExecTransformer]
+    }
+  }
+
   test("map_from_arrays optimized by Spark constant folding") {
     withSQLConf(("spark.sql.optimizer.excludedRules", "")) {
       runQueryAndCompare("""SELECT map_from_arrays(sequence(1, 5),sequence(1, 
5)), l_orderkey
diff --git a/docs/velox-backend-scalar-function-support.md 
b/docs/velox-backend-scalar-function-support.md
index 1da7586a6d..617c06f9b5 100644
--- a/docs/velox-backend-scalar-function-support.md
+++ b/docs/velox-backend-scalar-function-support.md
@@ -1,6 +1,6 @@
 # Scalar Functions Support Status
 
-**Out of 357 scalar functions in Spark 3.5, Gluten currently fully supports 
243 functions and partially supports 25 functions.**
+**Out of 357 scalar functions in Spark 3.5, Gluten currently fully supports 
244 functions and partially supports 25 functions.**
 
 ## Array Functions
 
@@ -369,7 +369,7 @@
 | encode             | Encode                      |          |                
                                         |
 | endswith           | EndsWithExpressionBuilder   | PS       | BinaryType 
unsupported                                  |
 | find_in_set        | FindInSet                   | S        |                
                                         |
-| format_number      | FormatNumber                |          |                
                                         |
+| format_number      | FormatNumber                | S        |                
                                         |
 | format_string      | FormatString                |          |                
                                         |
 | initcap            | InitCap                     | S        |                
                                         |
 | instr              | StringInstr                 | S        |                
                                         |
diff --git 
a/gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionMappings.scala
 
b/gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionMappings.scala
index d0ed9347b6..5193f31d66 100644
--- 
a/gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionMappings.scala
+++ 
b/gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionMappings.scala
@@ -107,6 +107,7 @@ object ExpressionMappings {
     Sig[UnBase64](UNBASE64),
     Sig[Base64](BASE64),
     Sig[FormatString](FORMAT_STRING),
+    Sig[FormatNumber](FORMAT_NUMBER),
 
     // URL functions
     Sig[ParseUrl](PARSE_URL),
diff --git 
a/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
 
b/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
index ca05f0ade1..03c41ebc49 100644
--- 
a/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
+++ 
b/shims/common/src/main/scala/org/apache/gluten/expression/ExpressionNames.scala
@@ -142,6 +142,7 @@ object ExpressionNames {
   final val BASE64 = "base64"
   final val MASK = "mask"
   final val FORMAT_STRING = "format_string"
+  final val FORMAT_NUMBER = "format_number"
   final val LUHN_CHECK = "luhn_check"
   final val TO_PRETTY_STRING = "to_pretty_string"
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to