philo-he commented on code in PR #12976:
URL: https://github.com/apache/gluten/pull/12976#discussion_r3971839129
##########
backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala:
##########
@@ -550,6 +550,37 @@ class ScalarFunctionsValidateSuite extends
FunctionsValidateSuite {
}
}
+ test("map_from_arrays offloads to Velox") {
+ runQueryAndCompare(
+ "select map_from_arrays(array(l_orderkey, l_orderkey + 1), " +
+ "array(l_partkey, l_suppkey)) from lineitem limit 10") {
+ checkGlutenPlan[ProjectExecTransformer]
+ }
+ }
+
+ test("map_from_arrays under LAST_WIN keeps the first position of a duplicate
key " +
+ "and its last value") {
+ withSQLConf(SQLConf.MAP_KEY_DEDUP_POLICY.key ->
SQLConf.MapKeyDedupPolicy.LAST_WIN.toString) {
+ runQueryAndCompare(
+ "select map_from_arrays(array(l_orderkey, l_orderkey + 1, l_orderkey),
" +
+ "array(l_partkey, l_suppkey, l_linenumber)) as m, " +
+ "map_keys(map_from_arrays(array(l_orderkey, l_orderkey + 1,
l_orderkey), " +
+ "array(l_partkey, l_suppkey, l_linenumber))) as k from lineitem
limit 10") {
+ checkGlutenPlan[ProjectExecTransformer]
+ }
+ }
+ }
+
+ test("map_from_arrays honors a lower-case mapKeyDedupPolicy value") {
+ withSQLConf(SQLConf.MAP_KEY_DEDUP_POLICY.key -> "last_win") {
Review Comment:
Spark's SQLConf parses enum configs case-insensitively, so Gluten always
receives a normalized enum value from Spark. Testing lower-case inputs in
Gluten isn't necessary since that behavior is already guaranteed by Spark.
https://github.com/apache/spark/blob/21c906234f27a5744457aa8fa3da215b0c3be5de/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala#L6737
##########
backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala:
##########
@@ -550,6 +550,37 @@ class ScalarFunctionsValidateSuite extends
FunctionsValidateSuite {
}
}
+ test("map_from_arrays offloads to Velox") {
+ runQueryAndCompare(
+ "select map_from_arrays(array(l_orderkey, l_orderkey + 1), " +
+ "array(l_partkey, l_suppkey)) from lineitem limit 10") {
+ checkGlutenPlan[ProjectExecTransformer]
+ }
+ }
+
+ test("map_from_arrays under LAST_WIN keeps the first position of a duplicate
key " +
+ "and its last value") {
+ withSQLConf(SQLConf.MAP_KEY_DEDUP_POLICY.key ->
SQLConf.MapKeyDedupPolicy.LAST_WIN.toString) {
+ runQueryAndCompare(
+ "select map_from_arrays(array(l_orderkey, l_orderkey + 1, l_orderkey),
" +
+ "array(l_partkey, l_suppkey, l_linenumber)) as m, " +
+ "map_keys(map_from_arrays(array(l_orderkey, l_orderkey + 1,
l_orderkey), " +
+ "array(l_partkey, l_suppkey, l_linenumber))) as k from lineitem
limit 10") {
+ checkGlutenPlan[ProjectExecTransformer]
+ }
+ }
Review Comment:
Can we consolidate the above two tests into one test with two cases
included? One is for EXCEPTION policy, producing exception in duplicate case,
and the other is for LAST_WIN policy.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]