Skip to content

Commit

Permalink
Refine tests
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Liu <[email protected]>
  • Loading branch information
austin362667 committed Nov 9, 2024
1 parent a168548 commit fe442e3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
41 changes: 41 additions & 0 deletions datafusion/sqllogictest/test_files/string/string_literal.slt
Original file line number Diff line number Diff line change
Expand Up @@ -816,3 +816,44 @@ query B
SELECT starts_with('foobar', 'bar')
----
false

# test utf8, largeutf8, utf8view, DictionaryString for bit_length
query IIII
SELECT
bit_length('Andrew'),
bit_length('datafusion数据融合'),
bit_length('💖'),
bit_length('josé')
;
----
48 176 32 40

query IIII
SELECT
bit_length(arrow_cast('Andrew', 'LargeUtf8')),
bit_length(arrow_cast('datafusion数据融合', 'LargeUtf8')),
bit_length(arrow_cast('💖', 'LargeUtf8')),
bit_length(arrow_cast('josé', 'LargeUtf8'))
;
----
48 176 32 40

query IIII
SELECT
bit_length(arrow_cast('Andrew', 'Utf8View')),
bit_length(arrow_cast('datafusion数据融合', 'Utf8View')),
bit_length(arrow_cast('💖', 'Utf8View')),
bit_length(arrow_cast('josé', 'Utf8View'))
;
----
48 176 32 40

query IIII
SELECT
bit_length(arrow_cast('Andrew', 'Dictionary(Int32, Utf8)')),
bit_length(arrow_cast('datafusion数据融合', 'Dictionary(Int32, Utf8)')),
bit_length(arrow_cast('💖', 'Dictionary(Int32, Utf8)')),
bit_length(arrow_cast('josé', 'Dictionary(Int32, Utf8)'))
;
----
48 176 32 40
17 changes: 0 additions & 17 deletions datafusion/sqllogictest/test_files/string/string_query.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -1096,20 +1096,3 @@ Rapha Raphael NULL datafusionДатаФус datafusionДатаФусион NULL
und under_score NULL un iść core un iść core NULL
p percent NULL pan Tadeusz ma iść w kąt pan Tadeusz ma iść w kąt NULL
NULL NULL NULL NULL NULL NULL

# TODO: Support Utf8View for bit_length array string function
# --------------------------------------
# Test BIT_LENGTH
# --------------------------------------
# query II
# SELECT
# BIT_LENGTH(ascii_1),
# BIT_LENGTH(unicode_1)
# FROM test_basic_operator;
# ----
# 48 144
# 72 176
# 56 240
# 88 104
# 56 216
# NULL NULL
11 changes: 1 addition & 10 deletions datafusion/sqllogictest/test_files/string/string_view.slt
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,7 @@ select octet_length(column1_utf8view) from test;
7
NULL

query IIII
SELECT
BIT_LENGTH(arrow_cast('Andrew', 'Utf8View')),
BIT_LENGTH(arrow_cast('datafusion数据融合', 'Utf8View')),
BIT_LENGTH(arrow_cast('💖', 'Utf8View')),
BIT_LENGTH(arrow_cast('josé', 'Utf8View'))
;
----
48 176 32 40

# 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;

Expand Down

0 comments on commit fe442e3

Please sign in to comment.