Shekharrajak commented on code in PR #20358:
URL: https://github.com/apache/datafusion/pull/20358#discussion_r2823188990
##########
datafusion/sqllogictest/test_files/spark/collection/size.slt:
##########
@@ -60,12 +60,12 @@ SELECT size(arrow_cast(make_array(1, 2, 3, 4),
'FixedSizeList(4, Int32)'));
# Map size tests
query I
-SELECT size(map(make_array('a', 'b', 'c'), make_array(1, 2, 3)));
+SELECT size(map('a', 1, 'b', 2, 'c', 3));
Review Comment:
We are expecting older unit tests should be passing , right ? Help me
understand why these changes are done.
##########
datafusion/sqllogictest/test_files/spark/map/map.slt:
##########
@@ -0,0 +1,150 @@
+# 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/LICENSE-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.
+
+# Spark map function tests
+# Based on: https://spark.apache.org/docs/latest/api/sql/index.html#map
+#
+# NOTE: map(k1, v1, k2, v2, ...) variadic syntax is handled by the built-in
+# NestedFunctionPlanner::plan_make_map, which splits alternating args into
+# key/value arrays and calls the built-in MapFunc.
+# The Spark Map UDF is only reached via the two-array syntax: map([keys],
[values]).
+
Review Comment:
Add explicit null-key validation. Decide whether to match Spark's LAST_WIN
for duplicates or EXCEPTION, and document the choice.
##########
datafusion/sqllogictest/test_files/spark/map/map.slt:
##########
@@ -0,0 +1,150 @@
+# 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/LICENSE-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.
+
+# Spark map function tests
+# Based on: https://spark.apache.org/docs/latest/api/sql/index.html#map
+#
+# NOTE: map(k1, v1, k2, v2, ...) variadic syntax is handled by the built-in
+# NestedFunctionPlanner::plan_make_map, which splits alternating args into
+# key/value arrays and calls the built-in MapFunc.
+# The Spark Map UDF is only reached via the two-array syntax: map([keys],
[values]).
+
Review Comment:
We can have more tests to cover cases like
test for map_inner directly
type coercion across pairs (e.g. map(1, 'a', 2.5, 'b') where keys are Int64
and Float64)
large number of pairs (performance/correctness of the reorder logic)
--
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]