Skip to content

Commit 2c8a690

Browse files
authored
Add tables with compound fields and JOIN condition tests for compound field access (apache#15556)
1 parent 2cd6ed9 commit 2c8a690

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

datafusion/sqllogictest/test_files/joins.slt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,3 +4742,51 @@ drop table person;
47424742

47434743
statement count 0
47444744
drop table orders;
4745+
4746+
# Create tables for testing compound field access in JOIN conditions
4747+
statement ok
4748+
CREATE TABLE compound_field_table_t
4749+
AS VALUES
4750+
({r: 'a', c: 1}),
4751+
({r: 'b', c: 2.3});
4752+
4753+
statement ok
4754+
CREATE TABLE compound_field_table_u
4755+
AS VALUES
4756+
({r: 'a', c: 1}),
4757+
({r: 'b', c: 2.3});
4758+
4759+
# Test compound field access in JOIN condition with table aliases
4760+
query ??
4761+
SELECT * FROM compound_field_table_t tee JOIN compound_field_table_u you ON tee.column1['r'] = you.column1['r']
4762+
----
4763+
{r: a, c: 1.0} {r: a, c: 1.0}
4764+
{r: b, c: 2.3} {r: b, c: 2.3}
4765+
4766+
# Test compound field access in JOIN condition without table aliases
4767+
query ??
4768+
SELECT * FROM compound_field_table_t JOIN compound_field_table_u ON compound_field_table_t.column1['r'] = compound_field_table_u.column1['r']
4769+
----
4770+
{r: a, c: 1.0} {r: a, c: 1.0}
4771+
{r: b, c: 2.3} {r: b, c: 2.3}
4772+
4773+
# Test compound field access with numeric field access
4774+
query ??
4775+
SELECT * FROM compound_field_table_t tee JOIN compound_field_table_u you ON tee.column1['c'] = you.column1['c']
4776+
----
4777+
{r: a, c: 1.0} {r: a, c: 1.0}
4778+
{r: b, c: 2.3} {r: b, c: 2.3}
4779+
4780+
# Test compound field access with mixed field types
4781+
query ??
4782+
SELECT * FROM compound_field_table_t tee JOIN compound_field_table_u you ON tee.column1['r'] = you.column1['r'] AND tee.column1['c'] = you.column1['c']
4783+
----
4784+
{r: a, c: 1.0} {r: a, c: 1.0}
4785+
{r: b, c: 2.3} {r: b, c: 2.3}
4786+
4787+
# Clean up compound field tables
4788+
statement ok
4789+
DROP TABLE compound_field_table_t;
4790+
4791+
statement ok
4792+
DROP TABLE compound_field_table_u;

0 commit comments

Comments
 (0)