diff --git a/substrait_consumer/functional/join_relation_configs.py b/substrait_consumer/functional/join_relation_configs.py new file mode 100644 index 0000000..c1d8230 --- /dev/null +++ b/substrait_consumer/functional/join_relation_configs.py @@ -0,0 +1,83 @@ +from substrait_consumer.functional.queries.sql.relations.join_relations import ( + JOIN_RELATIONS) + +JOIN_RELATION_TESTS = ( + { + "test_name": "inner_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["inner_join"], + "ibis_expr": None + }, + { + "test_name": "left_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["left_join"], + "ibis_expr": None + }, + { + "test_name": "right_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["right_join"], + "ibis_expr": None + }, + { + "test_name": "full_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["full_join"], + "ibis_expr": None + }, + { + "test_name": "cross_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["cross_join"], + "ibis_expr": None + }, + { + "test_name": "left_semi_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["left_semi_join"], + "ibis_expr": None + }, + { + "test_name": "right_semi_join", + "file_names": ["orders_small.parquet", "customer_small.parquet"], + "sql_query": JOIN_RELATIONS["right_semi_join"], + "ibis_expr": None + }, + { + "test_name": "left_anti_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["left_anti_join"], + "ibis_expr": None + }, + { + "test_name": "right_anti_join", + "file_names": ["orders_small.parquet", "lineitem_small.parquet"], + "sql_query": JOIN_RELATIONS["right_anti_join"], + "ibis_expr": None + }, + { + "test_name": "left_single_join", + "file_names": ["customer_small.parquet", "customer_small.parquet"], + "sql_query": JOIN_RELATIONS["left_single_join"], + "ibis_expr": None + }, + { + "test_name": "right_single_join", + "file_names": ["customer_small.parquet", "customer_small.parquet"], + "sql_query": JOIN_RELATIONS["right_single_join"], + "ibis_expr": None + }, + { + "test_name": "left_mark_join", + "file_names": ["orders_small.parquet", "customer_small.parquet"], + "sql_query": JOIN_RELATIONS["left_mark_join"], + "ibis_expr": None + }, + { + "test_name": "right_mark_join", + "file_names": ["customer_small.parquet", "orders_small.parquet"], + "sql_query": JOIN_RELATIONS["right_mark_join"], + "ibis_expr": None + }, +) diff --git a/substrait_consumer/functional/queries/sql/relations/join_relations.py b/substrait_consumer/functional/queries/sql/relations/join_relations.py new file mode 100644 index 0000000..1393074 --- /dev/null +++ b/substrait_consumer/functional/queries/sql/relations/join_relations.py @@ -0,0 +1,217 @@ +from substrait_consumer.producers.duckdb_producer import DuckDBProducer +from substrait_consumer.producers.datafusion_producer import DataFusionProducer +from substrait_consumer.producers.isthmus_producer import IsthmusProducer + +JOIN_RELATIONS = { + "inner_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME, + o.O_ORDERKEY + FROM + '{}' c + INNER JOIN + '{}' o + ON + c.C_CUSTKEY = o.O_CUSTKEY; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "left_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME, + o.O_ORDERKEY + FROM + '{}' c + LEFT JOIN + '{}' o + ON + c.C_CUSTKEY = o.O_CUSTKEY; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "right_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME, + o.O_ORDERKEY + FROM + '{}' c + RIGHT JOIN + '{}' o + ON + c.C_CUSTKEY = o.O_CUSTKEY; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "full_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME, + o.O_ORDERKEY + FROM + '{}' c + FULL JOIN + '{}' o + ON + c.C_CUSTKEY = o.O_CUSTKEY; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "cross_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME, + o.O_ORDERKEY + FROM + '{}' c + CROSS JOIN + '{}' o + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "left_semi_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME + FROM + '{}' c + WHERE + EXISTS ( + SELECT 1 + FROM '{}' o + WHERE o.O_CUSTKEY = c.C_CUSTKEY + ); + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "right_semi_join": ( + """ + SELECT + o.O_ORDERKEY, + o.O_CUSTKEY + FROM + '{}' o + WHERE + EXISTS ( + SELECT 1 + FROM '{}' c + WHERE c.C_CUSTKEY = o.O_CUSTKEY + ); + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "left_anti_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME + FROM + '{}' c + WHERE + NOT EXISTS ( + SELECT 1 + FROM '{}' o + WHERE o.O_CUSTKEY = c.C_CUSTKEY + ); + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "right_anti_join": ( + """ + SELECT + o.O_ORDERKEY, + o.O_CUSTKEY + FROM + '{}' o + WHERE + NOT EXISTS ( + SELECT 1 + FROM '{}' l + WHERE l.L_ORDERKEY = o.O_ORDERKEY + ); + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "left_single_join": ( + """ + SELECT + c1.C_CUSTKEY AS c1key, + c1.C_NAME AS c1name, + c1.C_NATIONKEY AS c1nationakey, + c2.C_CUSTKEY AS c2key, + c2.C_NAME AS c2name, + c2.C_NATIONKEY AS c2nationakey + FROM + '{}' c1 + LEFT JOIN + '{}' c2 + ON + c1.C_NATIONKEY = c2.C_NATIONKEY + AND c1.C_CUSTKEY <> c2.C_CUSTKEY; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "right_single_join": ( + """ + SELECT + c1.C_CUSTKEY AS c1key, + c1.C_NAME AS c1name, + c1.C_NATIONKEY AS c1nationakey, + c2.C_CUSTKEY AS c2key, + c2.C_NAME AS c2name, + c2.C_NATIONKEY AS c2nationakey + FROM + '{}' c1 + RIGHT JOIN + '{}' c2 + ON + c1.C_NATIONKEY = c2.C_NATIONKEY + AND c1.C_CUSTKEY <> c2.C_CUSTKEY; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "left_mark_join": ( + """ + SELECT + c.C_CUSTKEY, + c.C_NAME, + CASE + WHEN EXISTS ( + SELECT 1 + FROM '{}' o + WHERE o.O_CUSTKEY = c.C_CUSTKEY + ) THEN 'Marked' + ELSE 'Not Marked' + END + FROM + '{}' c; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), + "right_mark_join": ( + """ + SELECT + o.O_ORDERKEY, + o.O_CUSTKEY, + CASE + WHEN EXISTS ( + SELECT 1 + FROM '{}' c + WHERE c.C_CUSTKEY = o.O_CUSTKEY + ) THEN 'Marked' + ELSE 'Not Marked' + END + FROM + '{}' o; + """, + [DuckDBProducer, DataFusionProducer, IsthmusProducer], + ), +} diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/cross_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/cross_join_plan.json new file mode 100644 index 0000000..bddfdf5 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/cross_join_plan.json @@ -0,0 +1,81 @@ +{ + "relations": [ + { + "root": { + "input": { + "cross": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {} + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + } + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/full_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/full_join_plan.json new file mode 100644 index 0000000..e64bb2a --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/full_join_plan.json @@ -0,0 +1,150 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_OUTER" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/inner_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/inner_join_plan.json new file mode 100644 index 0000000..b2b24a1 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/inner_join_plan.json @@ -0,0 +1,150 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_INNER" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_anti_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_anti_join_plan.json new file mode 100644 index 0000000..36b71de --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_anti_join_plan.json @@ -0,0 +1,117 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_ANTI" + } + }, + "names": [ + "c_custkey", + "c_name" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_join_plan.json new file mode 100644 index 0000000..c1c0cae --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_join_plan.json @@ -0,0 +1,150 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_LEFT" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_semi_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_semi_join_plan.json new file mode 100644 index 0000000..0d427fd --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_semi_join_plan.json @@ -0,0 +1,117 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_SEMI" + } + }, + "names": [ + "c_custkey", + "c_name" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_single_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_single_join_plan.json new file mode 100644 index 0000000..cabdc17 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/left_single_join_plan.json @@ -0,0 +1,239 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "not_equal" + } + }, + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "functionAnchor": 1, + "name": "equal" + } + }, + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "functionAnchor": 2, + "name": "and" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + }, + { + "field": 3 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + }, + { + "field": 3 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "functionReference": 2, + "arguments": [ + { + "value": { + "scalarFunction": { + "functionReference": 1, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 5 + } + } + } + } + } + ] + } + } + }, + { + "value": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + } + } + ] + } + } + } + ] + } + }, + "type": "JOIN_TYPE_LEFT" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 4 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 5 + } + } + } + } + ] + } + }, + "names": [ + "c1key", + "c1name", + "c1nationakey", + "c2key", + "c2name", + "c2nationakey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_anti_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_anti_join_plan.json new file mode 100644 index 0000000..daabccc --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_anti_join_plan.json @@ -0,0 +1,123 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "l_orderkey", + "l_partkey", + "l_suppkey", + "l_linenumber", + "l_quantity", + "l_extendedprice", + "l_discount", + "l_tax", + "l_returnflag", + "l_linestatus", + "l_shipdate", + "l_commitdate", + "l_receiptdate", + "l_shipinstruct", + "l_shipmode", + "l_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {} + ] + } + }, + "namedTable": { + "names": [ + "lineitem_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_ANTI" + } + }, + "names": [ + "o_orderkey", + "o_custkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_join_plan.json new file mode 100644 index 0000000..b64e04f --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_join_plan.json @@ -0,0 +1,150 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_RIGHT" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_semi_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_semi_join_plan.json new file mode 100644 index 0000000..f629f0d --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_semi_join_plan.json @@ -0,0 +1,117 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "equal" + } + } + ], + "relations": [ + { + "root": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + } + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {} + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + } + ] + } + }, + "type": "JOIN_TYPE_SEMI" + } + }, + "names": [ + "o_orderkey", + "o_custkey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_single_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_single_join_plan.json new file mode 100644 index 0000000..6521325 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DataFusionProducer/right_single_join_plan.json @@ -0,0 +1,239 @@ +{ + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "name": "not_equal" + } + }, + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "functionAnchor": 1, + "name": "equal" + } + }, + { + "extensionFunction": { + "extensionUriReference": 4294967295, + "functionAnchor": 2, + "name": "and" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + }, + { + "field": 3 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ] + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + }, + { + "field": 3 + } + ] + } + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "functionReference": 2, + "arguments": [ + { + "value": { + "scalarFunction": { + "functionReference": 1, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 5 + } + } + } + } + } + ] + } + } + }, + { + "value": { + "scalarFunction": { + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + } + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + } + } + ] + } + } + } + ] + } + }, + "type": "JOIN_TYPE_RIGHT" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 4 + } + } + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 5 + } + } + } + } + ] + } + }, + "names": [ + "c1key", + "c1name", + "c1nationakey", + "c2key", + "c2name", + "c2nationakey" + ] + } + } + ], + "version": { + "minorNumber": 51, + "producer": "datafusion" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/cross_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/cross_join_plan.json new file mode 100644 index 0000000..3204a55 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/cross_join_plan.json @@ -0,0 +1,216 @@ +{ + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "cross": { + "left": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "date": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {} + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + } + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 48, + "producer": "DuckDB" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/inner_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/inner_join_plan.json new file mode 100644 index 0000000..71d392c --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/inner_join_plan.json @@ -0,0 +1,313 @@ +{ + "extensionUris": [ + { + "extensionUriAnchor": 1, + "uri": "https://github.com/substrait-io/substrait/blob/main/extensions/" + } + ], + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 1, + "functionAnchor": 1, + "name": "equal:i64_i64" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "date": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + }, + {} + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + } + } + ] + } + }, + "type": "JOIN_TYPE_INNER" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": {} + } + } + ] + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 48, + "producer": "DuckDB" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/left_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/left_join_plan.json new file mode 100644 index 0000000..735b449 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/left_join_plan.json @@ -0,0 +1,313 @@ +{ + "extensionUris": [ + { + "extensionUriAnchor": 1, + "uri": "https://github.com/substrait-io/substrait/blob/main/extensions/" + } + ], + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 1, + "functionAnchor": 1, + "name": "equal:i64_i64" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "date": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + }, + {} + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + } + } + ] + } + }, + "type": "JOIN_TYPE_LEFT" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": {} + } + } + ] + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": {} + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 48, + "producer": "DuckDB" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/left_semi_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/left_semi_join_plan.json new file mode 100644 index 0000000..1b88a5a --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/left_semi_join_plan.json @@ -0,0 +1,295 @@ +{ + "extensionUris": [ + { + "extensionUriAnchor": 1, + "uri": "https://github.com/substrait-io/substrait/blob/main/extensions/" + } + ], + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 1, + "functionAnchor": 1, + "name": "is_not_distinct_from:i64_i64" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "right": { + "project": { + "input": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "date": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + } + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + ] + } + }, + "expression": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + } + } + ] + } + }, + "type": "JOIN_TYPE_SEMI" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + } + ] + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name" + ] + } + } + ], + "version": { + "minorNumber": 48, + "producer": "DuckDB" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/right_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/right_join_plan.json new file mode 100644 index 0000000..4af36ec --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/right_join_plan.json @@ -0,0 +1,315 @@ +{ + "extensionUris": [ + { + "extensionUriAnchor": 1, + "uri": "https://github.com/substrait-io/substrait/blob/main/extensions/" + } + ], + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 1, + "functionAnchor": 1, + "name": "equal:i64_i64" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "date": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + }, + {} + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "right": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {}, + { + "field": 1 + } + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "expression": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + } + } + ] + } + }, + "type": "JOIN_TYPE_LEFT" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": {} + } + } + ] + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + } + ] + } + }, + "names": [ + "c_custkey", + "c_name", + "o_orderkey" + ] + } + } + ], + "version": { + "minorNumber": 48, + "producer": "DuckDB" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/right_semi_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/right_semi_join_plan.json new file mode 100644 index 0000000..fdedd48 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/DuckDBProducer/right_semi_join_plan.json @@ -0,0 +1,293 @@ +{ + "extensionUris": [ + { + "extensionUriAnchor": 1, + "uri": "https://github.com/substrait-io/substrait/blob/main/extensions/" + } + ], + "extensions": [ + { + "extensionFunction": { + "extensionUriReference": 1, + "functionAnchor": 1, + "name": "is_not_distinct_from:i64_i64" + } + } + ], + "relations": [ + { + "root": { + "input": { + "project": { + "input": { + "project": { + "input": { + "join": { + "left": { + "read": { + "baseSchema": { + "names": [ + "o_orderkey", + "o_custkey", + "o_orderstatus", + "o_totalprice", + "o_orderdate", + "o_orderpriority", + "o_clerk", + "o_shippriority", + "o_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "date": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + { + "field": 1 + }, + {} + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "orders_small" + ] + } + } + }, + "right": { + "project": { + "input": { + "read": { + "baseSchema": { + "names": [ + "c_custkey", + "c_name", + "c_address", + "c_nationkey", + "c_phone", + "c_acctbal", + "c_mktsegment", + "c_comment" + ], + "struct": { + "types": [ + { + "i64": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "i32": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + { + "string": { + "nullability": "NULLABILITY_NULLABLE" + } + } + ], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "projection": { + "select": { + "structItems": [ + {} + ] + }, + "maintainSingularStruct": true + }, + "namedTable": { + "names": [ + "customer_small" + ] + } + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + ] + } + }, + "expression": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_NULLABLE" + } + }, + "arguments": [ + { + "value": { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + }, + { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 2 + } + }, + "rootReference": {} + } + } + } + ] + } + }, + "type": "JOIN_TYPE_SEMI" + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + } + ] + } + }, + "expressions": [ + { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": {} + } + }, + { + "selection": { + "directReference": { + "structField": {} + }, + "rootReference": {} + } + } + ] + } + }, + "names": [ + "o_orderkey", + "o_custkey" + ] + } + } + ], + "version": { + "minorNumber": 48, + "producer": "DuckDB" + } +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/cross_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/cross_join_plan.json new file mode 100644 index 0000000..d9e5b2f --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/cross_join_plan.json @@ -0,0 +1,162 @@ +{ + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [17, 18, 19] + } + }, + "input": { + "cross": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + } + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME", "O_ORDERKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/full_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/full_join_plan.json new file mode 100644 index 0000000..dee70c2 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/full_join_plan.json @@ -0,0 +1,206 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [17, 18, 19] + } + }, + "input": { + "join": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "expression": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 9 + } + }, + "rootReference": { + } + } + } + }] + } + }, + "type": "JOIN_TYPE_OUTER" + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME", "O_ORDERKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/inner_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/inner_join_plan.json new file mode 100644 index 0000000..c28d77a --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/inner_join_plan.json @@ -0,0 +1,206 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [17, 18, 19] + } + }, + "input": { + "join": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "expression": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 9 + } + }, + "rootReference": { + } + } + } + }] + } + }, + "type": "JOIN_TYPE_INNER" + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME", "O_ORDERKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_anti_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_anti_join_plan.json new file mode 100644 index 0000000..985f630 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_anti_join_plan.json @@ -0,0 +1,232 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_boolean.yaml" + }, { + "extensionUriAnchor": 2, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "not:bool" + } + }, { + "extensionFunction": { + "extensionUriReference": 2, + "functionAnchor": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [8, 9] + } + }, + "input": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "condition": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "subquery": { + "setPredicate": { + "predicateOp": "PREDICATE_OP_EXISTS", + "tuples": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "condition": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "outerReference": { + "stepsOut": 1 + } + } + } + }] + } + } + } + } + } + } + } + }] + } + } + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_join_plan.json new file mode 100644 index 0000000..bbc8406 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_join_plan.json @@ -0,0 +1,206 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [17, 18, 19] + } + }, + "input": { + "join": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "expression": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 9 + } + }, + "rootReference": { + } + } + } + }] + } + }, + "type": "JOIN_TYPE_LEFT" + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME", "O_ORDERKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_semi_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_semi_join_plan.json new file mode 100644 index 0000000..a1a0fe0 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_semi_join_plan.json @@ -0,0 +1,211 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [8, 9] + } + }, + "input": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "condition": { + "subquery": { + "setPredicate": { + "predicateOp": "PREDICATE_OP_EXISTS", + "tuples": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "condition": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "outerReference": { + "stepsOut": 1 + } + } + } + }] + } + } + } + } + } + } + } + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_single_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_single_join_plan.json new file mode 100644 index 0000000..bfa5ae4 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/left_single_join_plan.json @@ -0,0 +1,295 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_boolean.yaml" + }, { + "extensionUriAnchor": 2, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "and:bool" + } + }, { + "extensionFunction": { + "extensionUriReference": 2, + "functionAnchor": 1, + "name": "equal:any_any" + } + }, { + "extensionFunction": { + "extensionUriReference": 2, + "functionAnchor": 2, + "name": "not_equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [16, 17, 18, 19, 20, 21] + } + }, + "input": { + "join": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "expression": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 11 + } + }, + "rootReference": { + } + } + } + }] + } + } + }, { + "value": { + "scalarFunction": { + "functionReference": 2, + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + } + }] + } + } + }] + } + }, + "type": "JOIN_TYPE_LEFT" + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 9 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 11 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C1KEY", "C1NAME", "C1NATIONAKEY", "C2KEY", "C2NAME", "C2NATIONAKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_anti_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_anti_join_plan.json new file mode 100644 index 0000000..e22e13b --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_anti_join_plan.json @@ -0,0 +1,269 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_boolean.yaml" + }, { + "extensionUriAnchor": 2, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "not:bool" + } + }, { + "extensionFunction": { + "extensionUriReference": 2, + "functionAnchor": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [9, 10] + } + }, + "input": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "condition": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "subquery": { + "setPredicate": { + "predicateOp": "PREDICATE_OP_EXISTS", + "tuples": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["L_ORDERKEY", "L_PARTKEY", "L_SUPPKEY", "L_LINENUMBER", "L_QUANTITY", "L_EXTENDEDPRICE", "L_DISCOUNT", "L_TAX", "L_RETURNFLAG", "L_LINESTATUS", "L_SHIPDATE", "L_COMMITDATE", "L_RECEIPTDATE", "L_SHIPINSTRUCT", "L_SHIPMODE", "L_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["LINEITEM_SMALL"] + } + } + }, + "condition": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "outerReference": { + "stepsOut": 1 + } + } + } + }] + } + } + } + } + } + } + } + }] + } + } + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["O_ORDERKEY", "O_CUSTKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_join_plan.json new file mode 100644 index 0000000..74b26e2 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_join_plan.json @@ -0,0 +1,206 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [17, 18, 19] + } + }, + "input": { + "join": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "expression": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 9 + } + }, + "rootReference": { + } + } + } + }] + } + }, + "type": "JOIN_TYPE_RIGHT" + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C_CUSTKEY", "C_NAME", "O_ORDERKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_semi_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_semi_join_plan.json new file mode 100644 index 0000000..e1750dd --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_semi_join_plan.json @@ -0,0 +1,211 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [9, 10] + } + }, + "input": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "date": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["ORDERS_SMALL"] + } + } + }, + "condition": { + "subquery": { + "setPredicate": { + "predicateOp": "PREDICATE_OP_EXISTS", + "tuples": { + "filter": { + "common": { + "direct": { + } + }, + "input": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "condition": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "outerReference": { + "stepsOut": 1 + } + } + } + }] + } + } + } + } + } + } + } + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["O_ORDERKEY", "O_CUSTKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_single_join_plan.json b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_single_join_plan.json new file mode 100644 index 0000000..4c3dd2d --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/IsthmusProducer/right_single_join_plan.json @@ -0,0 +1,295 @@ +{ + "extensionUris": [{ + "extensionUriAnchor": 1, + "uri": "/functions_boolean.yaml" + }, { + "extensionUriAnchor": 2, + "uri": "/functions_comparison.yaml" + }], + "extensions": [{ + "extensionFunction": { + "extensionUriReference": 1, + "name": "and:bool" + } + }, { + "extensionFunction": { + "extensionUriReference": 2, + "functionAnchor": 1, + "name": "equal:any_any" + } + }, { + "extensionFunction": { + "extensionUriReference": 2, + "functionAnchor": 2, + "name": "not_equal:any_any" + } + }], + "relations": [{ + "root": { + "input": { + "project": { + "common": { + "emit": { + "outputMapping": [16, 17, 18, 19, 20, 21] + } + }, + "input": { + "join": { + "common": { + "direct": { + } + }, + "left": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "right": { + "read": { + "common": { + "direct": { + } + }, + "baseSchema": { + "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"], + "struct": { + "types": [{ + "i64": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "i32": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "decimal": { + "scale": 2, + "precision": 15, + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }, { + "string": { + "nullability": "NULLABILITY_REQUIRED" + } + }], + "nullability": "NULLABILITY_REQUIRED" + } + }, + "namedTable": { + "names": ["CUSTOMER_SMALL"] + } + } + }, + "expression": { + "scalarFunction": { + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "scalarFunction": { + "functionReference": 1, + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 11 + } + }, + "rootReference": { + } + } + } + }] + } + } + }, { + "value": { + "scalarFunction": { + "functionReference": 2, + "outputType": { + "bool": { + "nullability": "NULLABILITY_REQUIRED" + } + }, + "arguments": [{ + "value": { + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + } + }, { + "value": { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + } + }] + } + } + }] + } + }, + "type": "JOIN_TYPE_RIGHT" + } + }, + "expressions": [{ + "selection": { + "directReference": { + "structField": { + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 1 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 3 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 8 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 9 + } + }, + "rootReference": { + } + } + }, { + "selection": { + "directReference": { + "structField": { + "field": 11 + } + }, + "rootReference": { + } + } + }] + } + }, + "names": ["C1KEY", "C1NAME", "C1NATIONAKEY", "C2KEY", "C2NAME", "C2NATIONAKEY"] + } + }] +} \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/cross_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/cross_join_result.txt new file mode 100644 index 0000000..d85b281 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/cross_join_result.txt @@ -0,0 +1,6 @@ +1 + +Customer#000000001 + +1 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/full_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/full_join_result.txt new file mode 100644 index 0000000..d85b281 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/full_join_result.txt @@ -0,0 +1,6 @@ +1 + +Customer#000000001 + +1 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/inner_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/inner_join_result.txt new file mode 100644 index 0000000..d85b281 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/inner_join_result.txt @@ -0,0 +1,6 @@ +1 + +Customer#000000001 + +1 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_anti_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_anti_join_result.txt new file mode 100644 index 0000000..cb9bb59 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_anti_join_result.txt @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_join_result.txt new file mode 100644 index 0000000..d85b281 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_join_result.txt @@ -0,0 +1,6 @@ +1 + +Customer#000000001 + +1 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_mark_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_mark_join_result.txt new file mode 100644 index 0000000..e7bec01 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_mark_join_result.txt @@ -0,0 +1,6 @@ +1 + +Customer#000000001 + +Marked + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_semi_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_semi_join_result.txt new file mode 100644 index 0000000..4a2730d --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_semi_join_result.txt @@ -0,0 +1,4 @@ +1 + +Customer#000000001 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_single_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_single_join_result.txt new file mode 100644 index 0000000..a5e434d --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/left_single_join_result.txt @@ -0,0 +1,12 @@ +1 + +Customer#000000001 + +15 + +None + +None + +None + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_anti_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_anti_join_result.txt new file mode 100644 index 0000000..cb9bb59 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_anti_join_result.txt @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_join_result.txt new file mode 100644 index 0000000..d85b281 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_join_result.txt @@ -0,0 +1,6 @@ +1 + +Customer#000000001 + +1 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_mark_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_mark_join_result.txt new file mode 100644 index 0000000..4981f46 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_mark_join_result.txt @@ -0,0 +1,6 @@ +1 + +1 + +Marked + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_semi_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_semi_join_result.txt new file mode 100644 index 0000000..9a83c03 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_semi_join_result.txt @@ -0,0 +1,4 @@ +1 + +1 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_single_join_result.txt b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_single_join_result.txt new file mode 100644 index 0000000..d0b5f72 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/join_relation_snapshots/relation_test_results/right_single_join_result.txt @@ -0,0 +1,12 @@ +None + +None + +None + +1 + +Customer#000000001 + +15 + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/relations/test_join_relation.py b/substrait_consumer/tests/functional/relations/test_join_relation.py new file mode 100644 index 0000000..05ac689 --- /dev/null +++ b/substrait_consumer/tests/functional/relations/test_join_relation.py @@ -0,0 +1,136 @@ +from typing import Callable, Iterable + +import duckdb +from ibis.expr.types.relations import Table +from ibis_substrait.tests.compiler.conftest import * + +from substrait_consumer.functional.join_relation_configs import ( + JOIN_RELATION_TESTS) +from substrait_consumer.functional.common import ( + generate_snapshot_results, + substrait_consumer_sql_test, substrait_producer_sql_test) +from substrait_consumer.parametrization import custom_parametrization + + +@pytest.fixture +def mark_producer_tests_as_xfail(request): + """Marks a subset of tests as expected to be fail.""" + producer = request.getfixturevalue('producer') + test_case_name = request.node.callspec.id.split('-')[-1] + if producer.__class__.__name__ == 'DuckDBProducer': + if test_case_name == "full_join": + pytest.skip(reason='INTERNAL Error: Unsupported join type FULL') + elif test_case_name in ["left_anti_join", "right_anti_join"]: + pytest.skip(reason='INTERNAL Error: Unsupported join type ANTI') + elif test_case_name in ["left_single_join", "right_single_join"]: + pytest.skip(reason='INTERNAL Error: Unsupported join comparison: !=') + elif test_case_name in ["left_mark_join", "right_mark_join"]: + pytest.skip(reason='INTERNAL Error: Unsupported join type MARK') + +@pytest.fixture +def mark_consumer_tests_as_xfail(request): + """Marks a subset of tests as expected to be fail.""" + producer = request.getfixturevalue('producer') + consumer = request.getfixturevalue('consumer') + test_case_name = request.node.callspec.id.split('-')[-1] + if consumer.__class__.__name__ == 'DuckDBConsumer': + if producer.__class__.__name__ != 'DuckDBProducer': + pytest.skip(reason=f'Unsupported Integration: DuckDBConsumer with non {producer.__class__.__name__}') + elif consumer.__class__.__name__ == 'DataFusionConsumer': + if producer.__class__.__name__ != 'DataFusionProducer': + pytest.skip(reason=f'Unsupported Integration: DataFusionConsumer with non {producer.__class__.__name__}') + + +@pytest.mark.usefixtures("prepare_small_tpch_parquet_data") +class TestJoinRelation: + """ + Test Class verifying different consumers are able to run substrait plans + that include substrait join relations. + """ + + @staticmethod + @pytest.fixture(scope="class", autouse=True) + def setup_teardown_class(request): + cls = request.cls + + cls.db_connection = duckdb.connect() + cls.db_connection.execute("install substrait") + cls.db_connection.execute("load substrait") + cls.created_tables = set() + + yield + + cls.db_connection.close() + + @custom_parametrization(JOIN_RELATION_TESTS) + @pytest.mark.produce_substrait_snapshot + @pytest.mark.usefixtures('mark_producer_tests_as_xfail') + def test_producer_join_relations( + self, + snapshot, + test_name: str, + file_names: Iterable[str], + sql_query: tuple, + ibis_expr: Callable[[Table], Table], + producer, + partsupp + ) -> None: + test_name = f"join_relation_snapshots:{test_name}" + substrait_producer_sql_test( + test_name, + snapshot, + self.db_connection, + self.created_tables, + file_names, + sql_query, + ibis_expr, + producer, + partsupp, + validate=True + ) + + @custom_parametrization(JOIN_RELATION_TESTS) + @pytest.mark.consume_substrait_snapshot + @pytest.mark.usefixtures('mark_consumer_tests_as_xfail') + def test_consumer_join_relations( + self, + snapshot, + test_name: str, + file_names: Iterable[str], + sql_query: tuple, + ibis_expr: Callable[[Table], Table], + producer, + consumer, + ) -> None: + test_name = f"join_relation_snapshots:{test_name}" + substrait_consumer_sql_test( + test_name, + snapshot, + self.db_connection, + self.created_tables, + file_names, + sql_query, + ibis_expr, + producer, + consumer, + ) + + @custom_parametrization(JOIN_RELATION_TESTS) + @pytest.mark.generate_function_snapshots + def test_generate_join_relation_results( + self, + snapshot, + test_name: str, + file_names: Iterable[str], + sql_query: tuple, + ibis_expr: Callable[[Table], Table], + ) -> None: + test_name = f"join_relation_snapshots:{test_name}" + generate_snapshot_results( + test_name, + snapshot, + self.db_connection, + self.created_tables, + file_names, + sql_query, + )