This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 8326f577bc upper and lower functions only work correctly on ascii 
character #9053 (#9054)
8326f577bc is described below

commit 8326f577bc3331d73da3663bf33fc4438ed46a0e
Author: Bruce Ritchie <[email protected]>
AuthorDate: Mon Jan 29 15:36:19 2024 -0500

    upper and lower functions only work correctly on ascii character #9053 
(#9054)
---
 datafusion/physical-expr/src/string_expressions.rs |  4 ++--
 datafusion/sqllogictest/test_files/functions.slt   | 22 +++++++++++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/datafusion/physical-expr/src/string_expressions.rs 
b/datafusion/physical-expr/src/string_expressions.rs
index d5344773cf..34a436ebe3 100644
--- a/datafusion/physical-expr/src/string_expressions.rs
+++ b/datafusion/physical-expr/src/string_expressions.rs
@@ -343,7 +343,7 @@ pub fn instr<T: OffsetSizeTrait>(args: &[ArrayRef]) -> 
Result<ArrayRef> {
 /// Converts the string to all lower case.
 /// lower('TOM') = 'tom'
 pub fn lower(args: &[ColumnarValue]) -> Result<ColumnarValue> {
-    handle(args, |string| string.to_ascii_lowercase(), "lower")
+    handle(args, |string| string.to_lowercase(), "lower")
 }
 
 enum TrimType {
@@ -555,7 +555,7 @@ where
 /// Converts the string to all upper case.
 /// upper('tom') = 'TOM'
 pub fn upper(args: &[ColumnarValue]) -> Result<ColumnarValue> {
-    handle(args, |string| string.to_ascii_uppercase(), "upper")
+    handle(args, |string| string.to_uppercase(), "upper")
 }
 
 /// Prints random (v4) uuid values per row
diff --git a/datafusion/sqllogictest/test_files/functions.slt 
b/datafusion/sqllogictest/test_files/functions.slt
index d3f81cc61e..7a4d7ef197 100644
--- a/datafusion/sqllogictest/test_files/functions.slt
+++ b/datafusion/sqllogictest/test_files/functions.slt
@@ -623,10 +623,20 @@ SELECT upper('foo')
 FOO
 
 query T
-select upper(arrow_cast('foo', 'Dictionary(Int32, Utf8)'))
+SELECT upper(arrow_cast('foo', 'Dictionary(Int32, Utf8)'))
 ----
 FOO
 
+query T
+SELECT upper('árvore ação αβγ')
+----
+ÁRVORE AÇÃO ΑΒΓ
+
+query T
+SELECT upper(arrow_cast('árvore ação αβγ', 'Dictionary(Int32, Utf8)'))
+----
+ÁRVORE AÇÃO ΑΒΓ
+
 query T
 SELECT btrim('   foo  ')
 ----
@@ -672,6 +682,16 @@ SELECT lower(arrow_cast('FOObar', 'Dictionary(Int32, 
Utf8)'))
 ----
 foobar
 
+query T
+SELECT lower('ÁRVORE AÇÃO ΑΒΓ')
+----
+árvore ação αβγ
+
+query T
+SELECT lower(arrow_cast('ÁRVORE AÇÃO ΑΒΓ', 'Dictionary(Int32, Utf8)'))
+----
+árvore ação αβγ
+
 query T
 SELECT ltrim('   foo')
 ----

Reply via email to