Skip to content

Commit cefccc7

Browse files
authored
test: define current arrow_cast behavior for BinaryView (#12200)
1 parent 8746e07 commit cefccc7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

datafusion/sqllogictest/test_files/arrow_typeof.slt

+11-7
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ query error Error unrecognized word: unknown
102102
SELECT arrow_cast('1', 'unknown')
103103

104104
# Round Trip tests:
105-
query TTTTTTTTTTTTTTTTTTTTTTTT
105+
query TTTTTTTTTTTTTTTTTTTTTTTTT
106106
SELECT
107107
arrow_typeof(arrow_cast(1, 'Int8')) as col_i8,
108108
arrow_typeof(arrow_cast(1, 'Int16')) as col_i16,
@@ -117,6 +117,7 @@ SELECT
117117
arrow_typeof(arrow_cast(1, 'Float64')) as col_f64,
118118
arrow_typeof(arrow_cast('foo', 'Utf8')) as col_utf8,
119119
arrow_typeof(arrow_cast('foo', 'LargeUtf8')) as col_large_utf8,
120+
arrow_typeof(arrow_cast('foo', 'Utf8View')) as col_utf8_view,
120121
arrow_typeof(arrow_cast('foo', 'Binary')) as col_binary,
121122
arrow_typeof(arrow_cast('foo', 'LargeBinary')) as col_large_binary,
122123
arrow_typeof(arrow_cast(to_timestamp('2020-01-02 01:01:11.1234567890Z'), 'Timestamp(Second, None)')) as col_ts_s,
@@ -129,7 +130,7 @@ SELECT
129130
arrow_typeof(arrow_cast(to_timestamp('2020-01-02 01:01:11.1234567890Z'), 'Timestamp(Nanosecond, Some("+08:00"))')) as col_tstz_ns,
130131
arrow_typeof(arrow_cast('foo', 'Dictionary(Int32, Utf8)')) as col_dict
131132
----
132-
Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float16 Float32 Float64 Utf8 LargeUtf8 Binary LargeBinary Timestamp(Second, None) Timestamp(Millisecond, None) Timestamp(Microsecond, None) Timestamp(Nanosecond, None) Timestamp(Second, Some("+08:00")) Timestamp(Millisecond, Some("+08:00")) Timestamp(Microsecond, Some("+08:00")) Timestamp(Nanosecond, Some("+08:00")) Dictionary(Int32, Utf8)
133+
Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float16 Float32 Float64 Utf8 LargeUtf8 Utf8View Binary LargeBinary Timestamp(Second, None) Timestamp(Millisecond, None) Timestamp(Microsecond, None) Timestamp(Nanosecond, None) Timestamp(Second, Some("+08:00")) Timestamp(Millisecond, Some("+08:00")) Timestamp(Microsecond, Some("+08:00")) Timestamp(Nanosecond, Some("+08:00")) Dictionary(Int32, Utf8)
133134

134135

135136

@@ -211,21 +212,23 @@ statement ok
211212
create table foo as select
212213
arrow_cast('foo', 'Utf8') as col_utf8,
213214
arrow_cast('foo', 'LargeUtf8') as col_large_utf8,
215+
arrow_cast('foo', 'Utf8View') as col_utf8_view,
214216
arrow_cast('foo', 'Binary') as col_binary,
215217
arrow_cast('foo', 'LargeBinary') as col_large_binary
216218
;
217219

218220
## Ensure each column in the table has the expected type
219221

220-
query TTTT
222+
query TTTTT
221223
SELECT
222224
arrow_typeof(col_utf8),
223225
arrow_typeof(col_large_utf8),
226+
arrow_typeof(col_utf8_view),
224227
arrow_typeof(col_binary),
225228
arrow_typeof(col_large_binary)
226229
FROM foo;
227230
----
228-
Utf8 LargeUtf8 Binary LargeBinary
231+
Utf8 LargeUtf8 Utf8View Binary LargeBinary
229232

230233

231234
statement ok
@@ -427,6 +430,7 @@ select arrow_cast('MyAwesomeString', 'Utf8View'), arrow_typeof(arrow_cast('MyAwe
427430
----
428431
MyAwesomeString Utf8View
429432

430-
# Fails until we update arrow-rs with support for https://github.com/apache/arrow-rs/pull/5894
431-
query error DataFusion error: SQL error: ParserError\("Expected: an SQL statement, found: arrow_cast"\)
432-
arrow_cast('MyAwesomeString', 'BinaryView'), arrow_typeof(arrow_cast('MyAwesomeString', 'BinaryView'))
433+
# Fails until we update to use the arrow-cast release with support for casting utf8 types to BinaryView
434+
# refer to merge commit https://github.com/apache/arrow-rs/commit/4bd737dab2aa17aca200259347909d48ed793ba1
435+
query error DataFusion error: This feature is not implemented: Unsupported CAST from Utf8 to BinaryView
436+
select arrow_cast('MyAwesomeString', 'BinaryView'), arrow_typeof(arrow_cast('MyAwesomeString', 'BinaryView'))

0 commit comments

Comments
 (0)