Skip to content

Commit

Permalink
Add end-to-end tests
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Oct 30, 2023
1 parent 69254ff commit 50ac2c8
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions datafusion/sqllogictest/test_files/scalar.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1878,3 +1878,51 @@ query T
SELECT CONCAT('Hello', 'World')
----
HelloWorld

statement ok
CREATE TABLE simple_string(
letter STRING,
letter2 STRING
) as VALUES
('A', 'APACHE'),
('B', 'APACHE'),
('C', 'APACHE'),
('D', 'APACHE')
;

query TT
EXPLAIN SELECT letter, letter = LEFT('APACHE', 1) FROM simple_string;
----
logical_plan
Projection: simple_string.letter, simple_string.letter = Utf8("A") AS simple_string.letter = left(Utf8("APACHE"),Int64(1))
--TableScan: simple_string projection=[letter]
physical_plan
ProjectionExec: expr=[letter@0 as letter, letter@0 = A as simple_string.letter = left(Utf8("APACHE"),Int64(1))]
--MemoryExec: partitions=1, partition_sizes=[1]

query TB
SELECT letter, letter = LEFT('APACHE', 1) FROM simple_string;
----
----
A true
B false
C false
D false

query TT
EXPLAIN SELECT letter, letter = LEFT(letter2, 1) FROM simple_string;
----
logical_plan
Projection: simple_string.letter, simple_string.letter = left(simple_string.letter2, Int64(1))
--TableScan: simple_string projection=[letter, letter2]
physical_plan
ProjectionExec: expr=[letter@0 as letter, letter@0 = left(letter2@1, 1) as simple_string.letter = left(simple_string.letter2,Int64(1))]
--MemoryExec: partitions=1, partition_sizes=[1]

query TB
SELECT letter, letter = LEFT(letter2, 1) FROM simple_string;
----
A true
B false
C false
D false

0 comments on commit 50ac2c8

Please sign in to comment.