Skip to content

Commit

Permalink
Improve the coverage of bit_length testing (apache#13336)
Browse files Browse the repository at this point in the history
* improve the testing coverage of bit_length

* fix the issue links
  • Loading branch information
goldmedal authored Nov 14, 2024
1 parent 66180fa commit a5d0563
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
16 changes: 16 additions & 0 deletions datafusion/sqllogictest/test_files/string/dictionary_utf8.slt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ _ (empty) false false false false
NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL

# TODO: move it back to `string_query.slt.part` after fixing the issue
# see issue https://github.com/apache/datafusion/issues/13329
query IIII
select bit_length(ascii_1), bit_length(ascii_2), bit_length(unicode_1), bit_length(unicode_2) from test_basic_operator;
----
48 8 144 32
72 72 176 176
56 8 240 64
88 88 104 256
56 24 216 288
0 8 0 0
8 16 0 0
8 16 0 0
NULL 8 NULL NULL
NULL 8 NULL 32

#
# common test for string-like functions and operators
#
Expand Down
16 changes: 16 additions & 0 deletions datafusion/sqllogictest/test_files/string/large_string.slt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ _ (empty) false false false false
NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL

# TODO: move it back to `string_query.slt.part` after fixing the issue
# see issue https://github.com/apache/datafusion/issues/13329
query IIII
select bit_length(ascii_1), bit_length(ascii_2), bit_length(unicode_1), bit_length(unicode_2) from test_basic_operator;
----
48 8 144 32
72 72 176 176
56 8 240 64
88 88 104 256
56 24 216 288
0 8 0 0
8 16 0 0
8 16 0 0
NULL 8 NULL NULL
NULL 8 NULL 32

#
# common test for string-like functions and operators
#
Expand Down
16 changes: 16 additions & 0 deletions datafusion/sqllogictest/test_files/string/string.slt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@ _ \_ (empty) (empty) true false false false
percent p%t pan Tadeusz ma iść w kąt Pan Tadeusz ma frunąć stąd w kąt true false true true
under_score un_____core un iść core chrząszcz na łące w 東京都 true false true false

# TODO: move it back to `string_query.slt.part` after fixing the issue
# see issue https://github.com/apache/datafusion/issues/13329
query IIII
select bit_length(ascii_1), bit_length(ascii_2), bit_length(unicode_1), bit_length(unicode_2) from test_basic_operator;
----
48 8 144 32
72 72 176 176
56 8 240 64
88 88 104 256
56 24 216 288
0 8 0 0
8 16 0 0
8 16 0 0
NULL 8 NULL NULL
NULL 8 NULL 32

#
# Clean up
#
Expand Down
9 changes: 5 additions & 4 deletions datafusion/sqllogictest/test_files/string/string_view.slt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ select arrow_cast(col1, 'Utf8View') as c1 from test_substr_base;
statement ok
drop table test_source

# TODO: Revisit this issue after upgrading to the arrow-rs version that includes apache/arrow-rs#6671.
# see issue https://github.com/apache/datafusion/issues/13329
query error DataFusion error: Arrow error: Compute error: bit_length not supported for Utf8View
select bit_length(ascii_1), bit_length(ascii_2), bit_length(unicode_1), bit_length(unicode_2) from test_basic_operator;

#
# common test for string-like functions and operators
#
Expand Down Expand Up @@ -93,10 +98,6 @@ select octet_length(column1_utf8view) from test;
0
NULL

# TODO: Revisit this issue after upgrading to the arrow-rs version that includes apache/arrow-rs#6671.
query error DataFusion error: Arrow error: Compute error: bit_length not supported for Utf8View
select bit_length(column1_utf8view) from test;

query T
select btrim(column1_large_utf8) from test;
----
Expand Down

0 comments on commit a5d0563

Please sign in to comment.