Skip to content

Commit

Permalink
fix some more tests with projection
Browse files Browse the repository at this point in the history
  • Loading branch information
scgkiran committed Jan 13, 2025
1 parent 7dbf89e commit 3a0ec33
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/sql/test_struct_types.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ PRAGMA enable_verification
query I
CALL get_substrait_json('select * from parquet_scan(''data/bug-17/test_table.parquet'') ')
----
{"relations":[{"root":{"input":{"project":{"input":{"read":{"baseSchema":{"names":["r","a","b"],"struct":{"types":[{"struct":{"types":[{"i64":{"nullability":"NULLABILITY_NULLABLE"}},{"string":{"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_REQUIRED"}},"projection":{"select":{"structItems":[{}]},"maintainSingularStruct":true},"localFiles":{"items":[{"uriFile":"data/bug-17/test_table.parquet","parquet":{}}]}}},"expressions":[{"selection":{"directReference":{"structField":{}},"rootReference":{}}}]}},"names":["r","a","b"]}}],"version":{"minorNumber":53,"producer":"DuckDB"}}
{"relations":[{"root":{"input":{"read":{"baseSchema":{"names":["r","a","b"],"struct":{"types":[{"struct":{"types":[{"i64":{"nullability":"NULLABILITY_NULLABLE"}},{"string":{"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_REQUIRED"}},"projection":{"select":{"structItems":[{}]},"maintainSingularStruct":true},"localFiles":{"items":[{"uriFile":"data/bug-17/test_table.parquet","parquet":{}}]}}},"names":["r","a","b"]}}],"version":{"minorNumber":53,"producer":"DuckDB"}}


query I
CALL from_substrait_json('{"relations":[{"root":{"input":{"project":{"input":{"read":{"baseSchema":{"names":["r"],"struct":{"types":[{"struct":{"types":[{"i64":{"nullability":"NULLABILITY_NULLABLE"}},{"string":{"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_REQUIRED"}},"projection":{"select":{"structItems":[{}]},"maintainSingularStruct":true},"localFiles":{"items":[{"uriFile":"data/bug-17/test_table.parquet","parquet":{}}]}}},"expressions":[{"selection":{"directReference":{"structField":{}},"rootReference":{}}}]}},"names":["r"]}}],"version":{"minorNumber":48,"producer":"DuckDB"}}')
CALL from_substrait_json('{"relations":[{"root":{"input":{"read":{"baseSchema":{"names":["r"],"struct":{"types":[{"struct":{"types":[{"i64":{"nullability":"NULLABILITY_NULLABLE"}},{"string":{"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_REQUIRED"}},"projection":{"select":{"structItems":[{}]},"maintainSingularStruct":true},"localFiles":{"items":[{"uriFile":"data/bug-17/test_table.parquet","parquet":{}}]}}},"names":["r"]}}],"version":{"minorNumber":48,"producer":"DuckDB"}}')
----
{'a': 1, 'b': b}

Expand All @@ -38,7 +38,7 @@ create table mytesttable as from parquet_scan('data/bug-17/test_table.parquet');
query I
CALL get_substrait_json('select * from mytesttable ')
----
{"relations":[{"root":{"input":{"project":{"input":{"read":{"baseSchema":{"names":["r","a","b"],"struct":{"types":[{"struct":{"types":[{"i64":{"nullability":"NULLABILITY_NULLABLE"}},{"string":{"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_REQUIRED"}},"projection":{"select":{"structItems":[{}]},"maintainSingularStruct":true},"namedTable":{"names":["mytesttable"]}}},"expressions":[{"selection":{"directReference":{"structField":{}},"rootReference":{}}}]}},"names":["r","a","b"]}}],"version":{"minorNumber":53,"producer":"DuckDB"}}
{"relations":[{"root":{"input":{"read":{"baseSchema":{"names":["r","a","b"],"struct":{"types":[{"struct":{"types":[{"i64":{"nullability":"NULLABILITY_NULLABLE"}},{"string":{"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_NULLABLE"}}],"nullability":"NULLABILITY_REQUIRED"}},"projection":{"select":{"structItems":[{}]},"maintainSingularStruct":true},"namedTable":{"names":["mytesttable"]}}},"names":["r","a","b"]}}],"version":{"minorNumber":53,"producer":"DuckDB"}}

statement ok
CALL get_substrait ('select r from mytesttable ')
Expand Down
4 changes: 2 additions & 2 deletions test/sql/test_substrait.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ statement ok
insert into crossfit values ('Push Ups', 3), ('Pull Ups', 5) , ('Push Jerk', 7), ('Bar Muscle Up', 10);

query I
CALL from_substrait('\x12\x09\x1A\x07\x10\x01\x1A\x03lte\x12\x11\x1A\x0F\x10\x02\x1A\x0Bis_not_null\x12\x09\x1A\x07\x10\x03\x1A\x03and\x12\x0B\x1A\x09\x10\x04\x1A\x05count\x1A\xC1\x01\x12\xBE\x01\x0A\xB1\x01:\xAE\x01\x12\xA1\x01\x22\x9E\x01\x12\x8D\x01\x0A\x8A\x01\x12,\x0A\x08exercise\x0A\x0Fdificulty_level\x12\x0F\x0A\x07\xB2\x01\x04\x08\x0D\x18\x01\x0A\x02*\x00\x18\x02\x1AF\x1AD\x08\x03\x1A\x04\x0A\x02\x10\x01\x22 \x1A\x1E\x1A\x1C\x08\x01\x1A\x02*\x00\x22\x0C\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x22\x06\x1A\x04\x0A\x02(\x05\x22\x18\x1A\x16\x1A\x14\x08\x02\x1A\x02*\x00\x22\x0C\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x22\x06\x0A\x02\x0A\x00\x10\x01:\x0A\x0A\x08crossfit\x1A\x00\x22\x0A\x0A\x08\x08\x04*\x04:\x02\x10\x01\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x12\x08exercise2\x0A\x10\x18*\x06DuckDB'::BLOB)
CALL from_substrait('\x12\x09\x1A\x07\x10\x01\x1A\x03lte\x12\x11\x1A\x0F\x10\x02\x1A\x0Bis_not_null\x12\x09\x1A\x07\x10\x03\x1A\x03and\x12\x0B\x1A\x09\x10\x04\x1A\x05count\x1A\xC8\x01\x12\xC5\x01\x0A\xB8\x01:\xB5\x01\x0A\x05\x12\x03\x0A\x01\x01\x12\xA1\x01\x22\x9E\x01\x12\x8D\x01\x0A\x8A\x01\x12,\x0A\x08exercise\x0A\x0Fdificulty_level\x12\x0F\x0A\x07\xB2\x01\x04\x08\x0D\x18\x01\x0A\x02*\x00\x18\x02\x1AF\x1AD\x08\x03\x1A\x04\x0A\x02\x10\x01\x22\x20\x1A\x1E\x1A\x1C\x08\x01\x1A\x02*\x00\x22\x0C\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x22\x06\x1A\x04\x0A\x02(\x05\x22\x18\x1A\x16\x1A\x14\x08\x02\x1A\x02*\x00\x22\x0C\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x22\x06\x0A\x02\x0A\x00\x10\x01:\x0A\x0A\x08crossfit\x1A\x00\x22\x0A\x0A\x08\x08\x04*\x04:\x02\x10\x01\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x12\x08exercise2\x0A\x10\x18*\x06DuckDB'::BLOB)
----
2

# Query with multiple columns
query II
CALL from_substrait('\x1A\x81\x01\x12\x7F\x0Ab:`\x12H\x0AF\x12,\x0A\x08exercise\x0A\x0Fdificulty_level\x12\x0F\x0A\x07\xB2\x01\x04\x08\x0D\x18\x01\x0A\x02*\x00\x18\x02\x22\x0A\x0A\x06\x0A\x00\x0A\x02\x08\x01\x10\x01:\x0A\x0A\x08crossfit\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x12\x08exercise\x12\x0Fdificulty_level2\x0A\x10\x18*\x06DuckDB'::BLOB)
CALL from_substrait('\x1Ag\x12e\x0AH\x0AF\x12,\x0A\x08exercise\x0A\x0Fdificulty_level\x12\x0F\x0A\x07\xB2\x01\x04\x08\x0D\x18\x01\x0A\x02*\x00\x18\x02\x22\x0A\x0A\x06\x0A\x00\x0A\x02\x08\x01\x10\x01:\x0A\x0A\x08crossfit\x12\x08exercise\x12\x0Fdificulty_level2\x0A\x10\x18*\x06DuckDB'::BLOB)
----
Push Ups 3
Pull Ups 5
Expand Down
2 changes: 1 addition & 1 deletion test/sql/test_substrait_parquet.test
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CREATE VIEW lineitem_parquet AS SELECT * FROM parquet_scan('data/parquet-testing

# Verify that we can re-use the query plan on a view instead
query I
CALL from_substrait('\x12\x07\x1A\x05\x10\x01\x1A\x01*\x12\x09\x1A\x07\x10\x02\x1A\x03sum\x1A\xC7\x03\x12\xC4\x03\x0A\xB8\x03:\xB5\x03\x12\xA8\x03\x22\xA5\x03\x12\xEC\x02\x0A\xE9\x02\x12\xC4\x02\x0A\x0Al_orderkey\x0A\x09l_partkey\x0A\x09l_suppkey\x0A\x0Cl_linenumber\x0A\x0Al_quantity\x0A\x0Fl_extendedprice\x0A\x0Al_discount\x0A\x05l_tax\x0A\x0Cl_returnflag\x0A\x0Cl_linestatus\x0A\x0Al_shipdate\x0A\x0Cl_commitdate\x0A\x0Dl_receiptdate\x0A\x0El_shipinstruct\x0A\x0Al_shipmode\x0A\x09l_comment\x12v\x0A\x04:\x02\x10\x01\x0A\x04:\x02\x10\x01\x0A\x04:\x02\x10\x01\x0A\x02*\x00\x0A\x02*\x00\x0A\x04Z\x02\x10\x01\x0A\x04Z\x02\x10\x01\x0A\x04Z\x02\x10\x01\x0A\x07\xB2\x01\x04\x08\x01\x18\x01\x0A\x07\xB2\x01\x04\x08\x01\x18\x01\x0A\x07\xB2\x01\x04\x08\x0A\x18\x01\x0A\x07\xB2\x01\x04\x08\x0A\x18\x01\x0A\x07\xB2\x01\x04\x08\x0A\x18\x01\x0A\x07\xB2\x01\x04\x08\x11\x18\x01\x0A\x07\xB2\x01\x04\x08\x07\x18\x01\x0A\x07\xB2\x01\x04\x08+\x18\x01\x18\x02\x22\x0C\x0A\x08\x0A\x02\x08\x05\x0A\x02\x08\x06\x10\x01:\x12\x0A\x10lineitem_parquet\x1A\x00\x222\x0A0\x08\x02*\x04Z\x02\x10\x01:&\x1A$\x1A\x22\x08\x01\x1A\x04Z\x02\x10\x01\x22\x0A\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x22\x0C\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x12\x07revenue2\x0A\x100*\x06DuckDB'::BLOB)
CALL from_substrait('\x12\x07\x1A\x05\x10\x01\x1A\x01*\x12\x09\x1A\x07\x10\x02\x1A\x03sum\x1A\xB7\x03\x12\xB4\x03\x0A\xA8\x03\x22\xA5\x03\x12\xEC\x02\x0A\xE9\x02\x12\xC4\x02\x0A\x0Al_orderkey\x0A\x09l_partkey\x0A\x09l_suppkey\x0A\x0Cl_linenumber\x0A\x0Al_quantity\x0A\x0Fl_extendedprice\x0A\x0Al_discount\x0A\x05l_tax\x0A\x0Cl_returnflag\x0A\x0Cl_linestatus\x0A\x0Al_shipdate\x0A\x0Cl_commitdate\x0A\x0Dl_receiptdate\x0A\x0El_shipinstruct\x0A\x0Al_shipmode\x0A\x09l_comment\x12v\x0A\x04:\x02\x10\x01\x0A\x04:\x02\x10\x01\x0A\x04:\x02\x10\x01\x0A\x02*\x00\x0A\x02*\x00\x0A\x04Z\x02\x10\x01\x0A\x04Z\x02\x10\x01\x0A\x04Z\x02\x10\x01\x0A\x07\xB2\x01\x04\x08\x01\x18\x01\x0A\x07\xB2\x01\x04\x08\x01\x18\x01\x0A\x07\xB2\x01\x04\x08\x0A\x18\x01\x0A\x07\xB2\x01\x04\x08\x0A\x18\x01\x0A\x07\xB2\x01\x04\x08\x0A\x18\x01\x0A\x07\xB2\x01\x04\x08\x11\x18\x01\x0A\x07\xB2\x01\x04\x08\x07\x18\x01\x0A\x07\xB2\x01\x04\x08+\x18\x01\x18\x02\x22\x0C\x0A\x08\x0A\x02\x08\x05\x0A\x02\x08\x06\x10\x01:\x12\x0A\x10lineitem_parquet\x1A\x00\x222\x0A0\x08\x02*\x04Z\x02\x10\x01:&\x1A$\x1A\x22\x08\x01\x1A\x04Z\x02\x10\x01\x22\x0A\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x22\x0C\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x12\x07revenue2\x0A\x100*\x06DuckDB'::BLOB)
----
19107076.83379995

Expand Down
2 changes: 1 addition & 1 deletion test/sql/test_temporary_view.test
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ statement ok
call get_substrait('SELECT * FROM mytempview')

query II
call from_substrait('\x1Au\x12s\x0Af:d\x12L:J\x122\x0A0\x12\x1B\x0A\x03age\x0A\x04name\x12\x0E\x0A\x04*\x02\x10\x01\x0A\x04b\x02\x10\x01\x18\x02\x22\x0A\x0A\x06\x0A\x00\x0A\x02\x08\x01\x10\x01:\x05\x0A\x03tbl\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x1A\x08\x12\x06\x0A\x02\x12\x00\x22\x00\x1A\x0A\x12\x08\x0A\x04\x12\x02\x08\x01\x22\x00\x12\x03age\x12\x04name2\x0A\x105*\x06DuckDB'::BLOB)
call from_substrait('\x1AA\x12?\x0A2\x0A0\x12\x1B\x0A\x03age\x0A\x04name\x12\x0E\x0A\x04*\x02\x10\x01\x0A\x04b\x02\x10\x01\x18\x02\x22\x0A\x0A\x06\x0A\x00\x0A\x02\x08\x01\x10\x01:\x05\x0A\x03tbl\x12\x03age\x12\x04name2\x0A\x105*\x06DuckDB'::BLOB)
----
1 Alice
2 Bob

0 comments on commit 3a0ec33

Please sign in to comment.