Spaarsh commented on code in PR #14367:
URL: https://github.com/apache/datafusion/pull/14367#discussion_r1940500161


##########
datafusion/functions/src/hash/xxhash.rs:
##########
@@ -0,0 +1,279 @@
+// 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.
+
+use arrow::array::{Array, StringArray, Int32Array, Int64Array, UInt32Array, 
UInt64Array};
+use arrow::datatypes::DataType;
+use datafusion_common::{Result, ScalarValue};
+use datafusion_expr::{
+    ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
+};
+use twox_hash::{XxHash64, XxHash32};
+use datafusion_macros::user_doc;
+use std::any::Any;
+use std::hash::Hasher;
+use datafusion_common::DataFusionError;
+use std::sync::Arc;
+
+#[user_doc(
+    doc_section(label = "Hashing Functions"),
+    description = "Computes the XXHash64 hash of a binary string.",
+    syntax_example = "xxhash64(expression)",
+    sql_example = r#"```sql
+> select xxhash64('foo');
++-------------------------------------------+
+| xxhash64(Utf8("foo"))                     |
++-------------------------------------------+
+| <xxhash64_result>                         |
++-------------------------------------------+
+```"#,
+    standard_argument(name = "expression", prefix = "String")
+)]
+#[derive(Debug)]
+pub struct XxHash64Func {
+    signature: Signature,
+}
+
+impl Default for XxHash64Func {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl XxHash64Func {
+    pub fn new() -> Self {
+        use DataType::*;
+        Self {
+            signature: Signature::uniform(
+                1,
+                vec![Utf8View, Utf8, LargeUtf8, Binary, LargeBinary],

Review Comment:
   Sure I'll fix this. I had actually made several changes that had not been 
pushed. Due do a glitch in my device they got wiped off 😅
   
   I removed the Int types from being accepted as input since I was thinking 
that allowing any other form of input other than a string wouldn't be ideal and 
I am anyway casting them to the Utf8 type. And all the hash functions expect 
their input to be of that form only. Even the crate I am using expects the 
same. Allowing for multiple types doesn't serve much of a purpose now that I 
think about it. I would love your thoughts on this!
   
   And should I convert this issue to draft? Since I am still adding the 
optional seed argument.



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