From 4967ae6bb7e900eda777d6f1416fd50a14365093 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 7d162e7d411b..ac9f6c852174 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 b6dc696d271f..88fbf37cbd5b 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