andygrove commented on code in PR #19627:
URL: https://github.com/apache/datafusion/pull/19627#discussion_r2659156075


##########
datafusion/sqllogictest/test_files/spark/hash/murmur3_hash.slt:
##########
@@ -0,0 +1,152 @@
+# 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.
+
+# Tests for Spark-compatible murmur3_hash (also available as `hash`)
+# Reference: https://spark.apache.org/docs/latest/api/sql/index.html#hash
+
+# Basic integer tests
+query I
+SELECT murmur3_hash(1);
+----
+-1712319331
+
+query I
+SELECT murmur3_hash(0);
+----
+-1670924195
+
+query I
+SELECT murmur3_hash(-1);
+----
+-939490007
+
+# Test with `hash` alias
+query I
+SELECT hash(1);
+----
+-1712319331
+
+query I
+SELECT hash('hello');
+----
+-1008564952

Review Comment:
   ```
   scala> spark.sql("SELECT hash('hello')").show()
   +-----------+
   |hash(hello)|
   +-----------+
   |-1008564952|
   +-----------+
   ```



##########
datafusion/sqllogictest/test_files/spark/hash/xxhash64.slt:
##########
@@ -0,0 +1,141 @@
+# 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.
+
+# Tests for Spark-compatible xxhash64
+# Reference: https://spark.apache.org/docs/latest/api/sql/index.html#xxhash64
+
+# Basic integer tests (Int32 - hashed as 4 bytes)
+query I
+SELECT xxhash64(1);
+----
+-7001672635703045582
+
+query I
+SELECT xxhash64(0);
+----
+-5252525462095825812
+
+query I
+SELECT xxhash64(-1);
+----
+3858142552250413010
+
+# String tests
+query I
+SELECT xxhash64('hello');
+----
+-4367754540140381902

Review Comment:
   ```
   scala> spark.sql("SELECT xxhash64('hello')").show()
   +--------------------+
   |     xxhash64(hello)|
   +--------------------+
   |-4367754540140381902|
   +--------------------+
   ```



-- 
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]

Reply via email to