Skip to content

Commit f56c2ad

Browse files
committed
update slt
1 parent 77bfbf4 commit f56c2ad

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

datafusion/sqllogictest/test_files/struct.slt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,12 @@ Struct("r": Utf8, "c": Float64)
492492
statement ok
493493
drop table t;
494494

495-
query error DataFusion error: Optimizer rule 'simplify_expressions' failed[\s\S]*Arrow error: Cast error: Cannot cast string 'a' to value of Float64 type
495+
statement ok
496496
create table t as values({r: 'a', c: 1}), ({c: 2.3, r: 'b'});
497497

498+
statement ok
499+
drop table t;
500+
498501
##################################
499502
## Test Coalesce with Struct
500503
##################################
@@ -560,10 +563,12 @@ create table t(a struct(r varchar, c int), b struct(r varchar, c float)) as valu
560563
(row('purple', 1), row('green', 2.3));
561564

562565
# out of order struct literal
563-
# TODO: This query should not fail
564-
statement error DataFusion error: Optimizer rule 'simplify_expressions' failed[\s\S]*Arrow error: Cast error: Cannot cast string 'b' to value of Int32 type
566+
statement ok
565567
create table t(a struct(r varchar, c int)) as values ({r: 'a', c: 1}), ({c: 2, r: 'b'});
566568

569+
statement ok
570+
drop table t;
571+
567572
##################################
568573
## Test Array of Struct
569574
##################################
@@ -573,9 +578,11 @@ select [{r: 'a', c: 1}, {r: 'b', c: 2}];
573578
----
574579
[{r: a, c: 1}, {r: b, c: 2}]
575580

576-
# Can't create a list of struct with different field types
577-
query error
581+
# out of order struct literal in array
582+
query ?
578583
select [{r: 'a', c: 1}, {c: 2, r: 'b'}];
584+
----
585+
[{c: 1, r: a}, {c: 2, r: b}]
579586

580587
statement ok
581588
create table t(a struct(r varchar, c int), b struct(r varchar, c float)) as values (row('a', 1), row('b', 2.3));
@@ -592,9 +599,11 @@ drop table t;
592599
statement ok
593600
create table t(a struct(r varchar, c int), b struct(c float, r varchar)) as values (row('a', 1), row(2.3, 'b'));
594601

595-
# create array with different struct type is not valid
596-
query error
602+
# create array with different struct field order
603+
query T
597604
select arrow_typeof([a, b]) from t;
605+
----
606+
List(Struct("c": Float32, "r": Utf8View))
598607

599608
statement ok
600609
drop table t;

0 commit comments

Comments
 (0)