From 6ce68c582369ceaed44f20dc2b004929bbe35522 Mon Sep 17 00:00:00 2001 From: wiedld Date: Wed, 11 Dec 2024 17:23:02 -0800 Subject: [PATCH] fix: temporary commit to update bit_length signature to only accept non-view Utf8s, and test does pass (due to coercion?) --- datafusion/functions/src/string/bit_length.rs | 6 +++++- datafusion/sqllogictest/test_files/string/string_view.slt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/datafusion/functions/src/string/bit_length.rs b/datafusion/functions/src/string/bit_length.rs index 25b56341fcaa3..5ac32591af7c4 100644 --- a/datafusion/functions/src/string/bit_length.rs +++ b/datafusion/functions/src/string/bit_length.rs @@ -40,7 +40,11 @@ impl Default for BitLengthFunc { impl BitLengthFunc { pub fn new() -> Self { Self { - signature: Signature::string(1, Volatility::Immutable), + signature: Signature::uniform( + 1, + vec![DataType::Utf8, DataType::LargeUtf8], + Volatility::Immutable, + ), } } } diff --git a/datafusion/sqllogictest/test_files/string/string_view.slt b/datafusion/sqllogictest/test_files/string/string_view.slt index 997dca7191472..4ad421d402f2c 100644 --- a/datafusion/sqllogictest/test_files/string/string_view.slt +++ b/datafusion/sqllogictest/test_files/string/string_view.slt @@ -91,7 +91,11 @@ select octet_length(column1_utf8view) from test; 7 NULL -query error DataFusion error: Arrow error: Compute error: bit_length not supported for Utf8View +# query error DataFusion error: Arrow error: Compute error: bit_length not supported for Utf8View +# TODO: our patched DF branch is passing this test. +# It does register the type as Utf8View, if I we leave the bit_length signature to accept all strings. +# if we update the bit_length signature to only accepts non-view Utf8, it then coerces to LargeUtf8 and passes. +statement ok select bit_length(column1_utf8view) from test; query T