adriangb commented on code in PR #17632: URL: https://github.com/apache/datafusion/pull/17632#discussion_r2356588276
########## 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: My feeling is that long term we should just switch from using ahash to murmurhash or something so that it is (1) not machine specific (works for distributed use cases, pre-computed hash columns, etc.) and (2) we can specify the algorithm used instead of a generic "internal hash" -- 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