You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "Zouxxyy (via GitHub)" <gi...@apache.org> on 2025/06/07 10:58:07 UTC

[PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Zouxxyy opened a new pull request, #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908

   ## What changes were proposed in this pull request?
   
   Fix fallback sql
   ```
   SELECT map_from_arrays(sequence(1, 5),sequence(1, 5)), string_column from t
   ```
   
   ```
   java.lang.UnsupportedOperationException: Not supported on UnsafeArrayData.
   	at org.apache.spark.sql.catalyst.expressions.UnsafeArrayData.array(UnsafeArrayData.java:103)
   	at org.apache.gluten.substrait.expression.MapLiteralNode.updateLiteralBuilder(MapLiteralNode.java:34)
   	at org.apache.gluten.substrait.expression.MapLiteralNode.updateLiteralBuilder(MapLiteralNode.java:27)
   	at org.apache.gluten.substrait.expression.LiteralNodeWithValue.getLiteral(LiteralNodeWithValue.java:39)
   	at org.apache.gluten.substrait.expression.LiteralNode.toProtobuf(LiteralNode.java:41)
   	at org.apache.gluten.substrait.rel.ProjectRelNode.toProtobuf(ProjectRelNode.java:72)
   	at org.apache.gluten.substrait.plan.PlanNode.toProtobuf(PlanNode.java:74)
   ```
   
   
   In this PR:
   - use `Object get(int ordinal, DataType dataType);` to obtain the value instead of `ArrayData.array()`, so that for UnsafeArrayData or Unsafe map, it can internally automatically parse out safe value
   - Add `parseFromTypeNode` in `ConverterUtils` to parse TypeNode to Spark Data
   - In order to obtain TypeNode's nullable, add `nullable()` in interface TypeNode
   


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#issuecomment-2952354491

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICEGJ-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Thanks for opening a pull request!
   
   Could you open an issue for this pull request on Github Issues?
   
   https://github.com/apache/incubator-gluten/issues
   
   Then could you also rename ***commit message*** and ***pull request title*** in the following format?
   
       [GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/incubator-gluten/pulls/)
   
   


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#issuecomment-2954815711

   @PHILO-HE Can you help with a review, thanks


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "liujiayi771 (via GitHub)" <gi...@apache.org>.
liujiayi771 commented on PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#issuecomment-2955917374

   Thanks for the fix, LGTM.


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#issuecomment-2952354576

   Run Gluten Clickhouse CI on x86


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
PHILO-HE merged PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#issuecomment-2952418109

   Run Gluten Clickhouse CI on x86


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
PHILO-HE commented on code in PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#discussion_r2136747402


##########
backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala:
##########
@@ -511,6 +511,15 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
     }
   }
 
+  test("Test map_from_arrays function optimized by Spark constant folding") {
+    withSQLConf(("spark.sql.optimizer.excludedRules", NullPropagation.ruleName)) {

Review Comment:
   It seems this is to override super class's configuration. And NullPropagation has no impact on this test case. Maybe, we can just set it with empty string for better readability.



##########
backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala:
##########
@@ -511,6 +511,15 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
     }
   }
 
+  test("Test map_from_arrays function optimized by Spark constant folding") {
+    withSQLConf(("spark.sql.optimizer.excludedRules", NullPropagation.ruleName)) {
+      runQueryAndCompare("""SELECT map_from_arrays(sequence(1, 5),sequence(1, 5)), l_orderkey
+                           | from lineitem limit 100""".stripMargin) {

Review Comment:
   Nit:
   Limit 100 is unnecessarily large for result comparison. Let's decrease it to a smaller value, e.g., 10.



##########
backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala:
##########
@@ -511,6 +511,15 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
     }
   }
 
+  test("Test map_from_arrays function optimized by Spark constant folding") {

Review Comment:
   Nit:
   Follow the test name style and , e.g., "map_from_arrays optimized by Spark constant folding"



-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [CORE][VL] Fix fallback for spark literal unsafe map data as input [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9908:
URL: https://github.com/apache/incubator-gluten/pull/9908#issuecomment-2957531400

   Run Gluten Clickhouse CI on x86


-- 
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@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org