You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2025/09/21 05:05:33 UTC
Re: [PR] Optimize Hex Function [datafusion]
Jefffrey commented on code in PR #16077:
URL: https://github.com/apache/datafusion/pull/16077#discussion_r2365946163
##########
datafusion/sqllogictest/test_files/spark/math/hex.slt:
##########
@@ -16,24 +16,24 @@
# under the License.
query T
-SELECT hex('Spark SQL');
+SELECT CAST(hex('Spark SQL') AS VARCHAR);
----
537061726B2053514C
query T
-SELECT hex(1234::INT);
+SELECT CAST(hex(1234::INT) AS VARCHAR);
----
4D2
query T
-SELECT hex(a) from VALUES (1234::INT), (NULL), (456::INT) AS t(a);
+SELECT CAST(hex(a) AS VARCHAR) from VALUES (1234::INT), (NULL), (456::INT) AS t(a);
----
4D2
NULL
1C8
query T
-SELECT hex(a) from VALUES ('foo'), (NULL), ('foobarbaz') AS t(a);
+SELECT CAST(hex(a) AS VARCHAR) from VALUES ('foo'), (NULL), ('foobarbaz') AS t(a);
Review Comment:
These tests aren't sufficient to demonstrate the optimization, as they are only casting the output of the hex function to view type.
##########
datafusion/spark/src/function/math/hex.rs:
##########
@@ -75,7 +75,7 @@ impl ScalarUDFImpl for SparkHex {
&self,
_arg_types: &[DataType],
) -> datafusion_common::Result<DataType> {
- Ok(DataType::Utf8)
+ Ok(DataType::Utf8View)
Review Comment:
The implementation must be changed to accomodate this changed DataType
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org