Dandandan commented on code in PR #17632:
URL: https://github.com/apache/datafusion/pull/17632#discussion_r2358640446


##########
datafusion/functions/src/hash.rs:
##########
@@ -0,0 +1,347 @@
+// 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.
+
+//! Hash Arrays UDF: A scalar function that hashes one or more arrays using 
the same algorithm as DataFusion's join operations
+
+use std::any::Any;
+use std::sync::Arc;
+
+use ahash::RandomState;
+use arrow::array::{Array, UInt64Array};
+use arrow::datatypes::DataType;
+use datafusion_common::hash_utils::create_hashes;
+use datafusion_common::{plan_err, Result};
+use datafusion_expr::{
+    ColumnarValue, Documentation, ScalarFunctionArgs, ScalarUDFImpl, Signature,
+    TypeSignature, Volatility,
+};
+use datafusion_macros::user_doc;
+
+#[user_doc(
+    doc_section(label = "Hashing Functions"),
+    description = "Computes hash values for one or more arrays using 
DataFusion's internal hash algorithm. When multiple arrays are provided, their 
hash values are combined using the same logic as multi-column joins.",

Review Comment:
   Ahash probably is faster (didn't benchmark it TBH against all alternatives, 
but it had a lot of benchmarks showing it is faster than xxhash / murmurhash, 
and gave good speedup compared to SipHash which was used before it).
   
   Maybe https://github.com/orlp/foldhash/commits/master/ is a good candidate 
for an alternative speed-wise (is now used by hashbrown instead of aHash as 
default).
   
   There is something to say for keeping it documented as "internal hash" as 
well, as it will allow to change it without breaking the API in the future.



-- 
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: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to