Skip to content

Apache DataFusion SQL Query Engine

test(substrait): update TPCH tests (#12462)

Victor Barua257e1409eca8
diff --git a/datafusion/substrait/src/logical_plan/consumer.rs b/datafusion/substrait/src/logical_plan/consumer.rs
index c9d27237a4..e6bfc67eda 100644
--- a/datafusion/substrait/src/logical_plan/consumer.rs
+++ b/datafusion/substrait/src/logical_plan/consumer.rs
@@ -2064,14 +2064,19 @@ fn from_substrait_literal(
// DF only supports millisecond precision, so for any more granular type we lose precision
let milliseconds = match precision_mode {
Some(PrecisionMode::Microseconds(ms)) => ms / 1000,
+ None =>
+ if *subseconds != 0 {
+ return substrait_err!("Cannot set subseconds field of IntervalDayToSecond without setting precision");
+ } else {
+ 0_i32
+ }
Some(PrecisionMode::Precision(0)) => *subseconds as i32 * 1000,
Some(PrecisionMode::Precision(3)) => *subseconds as i32,
Some(PrecisionMode::Precision(6)) => (subseconds / 1000) as i32,
Some(PrecisionMode::Precision(9)) => (subseconds / 1000 / 1000) as i32,
_ => {
return not_impl_err!(
- "Unsupported Substrait interval day to second precision mode"
- )
+ "Unsupported Substrait interval day to second precision mode: {precision_mode:?}")
}
};
diff --git a/datafusion/substrait/tests/cases/consumer_integration.rs b/datafusion/substrait/tests/cases/consumer_integration.rs
index dad24559a0..b1cc763050 100644
--- a/datafusion/substrait/tests/cases/consumer_integration.rs
+++ b/datafusion/substrait/tests/cases/consumer_integration.rs
@@ -24,569 +24,435 @@
#[cfg(test)]
mod tests {
+ use crate::utils::test::add_plan_schemas_to_ctx;
use datafusion::common::Result;
- use datafusion::execution::options::CsvReadOptions;
use datafusion::prelude::SessionContext;
use datafusion_substrait::logical_plan::consumer::from_substrait_plan;
use std::fs::File;
use std::io::BufReader;
use substrait::proto::Plan;
- async fn create_context(files: Vec<(&str, &str)>) -> Result<SessionContext> {
- let ctx = SessionContext::new();
- for (table_name, file_path) in files {
- ctx.register_csv(table_name, file_path, CsvReadOptions::default())
- .await?;
- }
- Ok(ctx)
- }
- #[tokio::test]
- async fn tpch_test_1() -> Result<()> {
- let ctx = create_context(vec![(
- "FILENAME_PLACEHOLDER_0",
- "tests/testdata/tpch/lineitem.csv",
- )])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_1.json";
+ async fn tpch_plan_to_string(query_id: i32) -> Result<String> {
+ let path =
+ format!("tests/testdata/tpch_substrait_plans/query_{query_id:02}_plan.json");
let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
File::open(path).expect("file not found"),
))
.expect("failed to parse json");
+ let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto)?;
let plan = from_substrait_plan(&ctx, &proto).await?;
+ Ok(format!("{}", plan))
+ }
- let plan_str = format!("{}", plan);
+ #[tokio::test]
+ async fn tpch_test_01() -> Result<()> {
+ let plan_str = tpch_plan_to_string(1).await?;
assert_eq!(
plan_str,
- "Projection: FILENAME_PLACEHOLDER_0.l_returnflag AS L_RETURNFLAG, FILENAME_PLACEHOLDER_0.l_linestatus AS L_LINESTATUS, sum(FILENAME_PLACEHOLDER_0.l_quantity) AS SUM_QTY, sum(FILENAME_PLACEHOLDER_0.l_extendedprice) AS SUM_BASE_PRICE, sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount) AS SUM_DISC_PRICE, sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount * Int32(1) + FILENAME_PLACEHOLDER_0.l_tax) AS SUM_CHARGE, avg(FILENAME_PLACEHOLDER_0.l_quantity) AS AVG_QTY, avg(FILENAME_PLACEHOLDER_0.l_extendedprice) AS AVG_PRICE, avg(FILENAME_PLACEHOLDER_0.l_discount) AS AVG_DISC, count(Int64(1)) AS COUNT_ORDER\
- \n Sort: FILENAME_PLACEHOLDER_0.l_returnflag ASC NULLS LAST, FILENAME_PLACEHOLDER_0.l_linestatus ASC NULLS LAST\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.l_returnflag, FILENAME_PLACEHOLDER_0.l_linestatus]], aggr=[[sum(FILENAME_PLACEHOLDER_0.l_quantity), sum(FILENAME_PLACEHOLDER_0.l_extendedprice), sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount), sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount * Int32(1) + FILENAME_PLACEHOLDER_0.l_tax), avg(FILENAME_PLACEHOLDER_0.l_quantity), avg(FILENAME_PLACEHOLDER_0.l_extendedprice), avg(FILENAME_PLACEHOLDER_0.l_discount), count(Int64(1))]]\
- \n Projection: FILENAME_PLACEHOLDER_0.l_returnflag, FILENAME_PLACEHOLDER_0.l_linestatus, FILENAME_PLACEHOLDER_0.l_quantity, FILENAME_PLACEHOLDER_0.l_extendedprice, FILENAME_PLACEHOLDER_0.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_0.l_discount), FILENAME_PLACEHOLDER_0.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_0.l_discount) * (CAST(Int32(1) AS Decimal128(19, 0)) + FILENAME_PLACEHOLDER_0.l_tax), FILENAME_PLACEHOLDER_0.l_discount\
- \n Filter: FILENAME_PLACEHOLDER_0.l_shipdate <= Date32(\"1998-12-01\") - IntervalDayTime(\"IntervalDayTime { days: 120, milliseconds: 0 }\")\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[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: LINEITEM.L_RETURNFLAG, LINEITEM.L_LINESTATUS, sum(LINEITEM.L_QUANTITY) AS SUM_QTY, sum(LINEITEM.L_EXTENDEDPRICE) AS SUM_BASE_PRICE, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) AS SUM_DISC_PRICE, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT * Int32(1) + LINEITEM.L_TAX) AS SUM_CHARGE, avg(LINEITEM.L_QUANTITY) AS AVG_QTY, avg(LINEITEM.L_EXTENDEDPRICE) AS AVG_PRICE, avg(LINEITEM.L_DISCOUNT) AS AVG_DISC, count(Int64(1)) AS COUNT_ORDER\
+ \n Sort: LINEITEM.L_RETURNFLAG ASC NULLS LAST, LINEITEM.L_LINESTATUS ASC NULLS LAST\
+ \n Aggregate: groupBy=[[LINEITEM.L_RETURNFLAG, LINEITEM.L_LINESTATUS]], aggr=[[sum(LINEITEM.L_QUANTITY), sum(LINEITEM.L_EXTENDEDPRICE), sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT), sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT * Int32(1) + LINEITEM.L_TAX), avg(LINEITEM.L_QUANTITY), avg(LINEITEM.L_EXTENDEDPRICE), avg(LINEITEM.L_DISCOUNT), count(Int64(1))]]\
+ \n Projection: LINEITEM.L_RETURNFLAG, LINEITEM.L_LINESTATUS, LINEITEM.L_QUANTITY, LINEITEM.L_EXTENDEDPRICE, LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT), LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT) * (CAST(Int32(1) AS Decimal128(15, 2)) + LINEITEM.L_TAX), LINEITEM.L_DISCOUNT\
+ \n Filter: LINEITEM.L_SHIPDATE <= Date32(\"1998-12-01\") - IntervalDayTime(\"IntervalDayTime { days: 0, milliseconds: 10368000 }\")\
+ \n TableScan: LINEITEM projection=[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]"
);
Ok(())
}
#[tokio::test]
- async fn tpch_test_2() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/part.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/supplier.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/partsupp.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/nation.csv"),
- ("FILENAME_PLACEHOLDER_4", "tests/testdata/tpch/region.csv"),
- ("FILENAME_PLACEHOLDER_5", "tests/testdata/tpch/partsupp.csv"),
- ("FILENAME_PLACEHOLDER_6", "tests/testdata/tpch/supplier.csv"),
- ("FILENAME_PLACEHOLDER_7", "tests/testdata/tpch/nation.csv"),
- ("FILENAME_PLACEHOLDER_8", "tests/testdata/tpch/region.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_2.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
+ async fn tpch_test_02() -> Result<()> {
+ let plan_str = tpch_plan_to_string(2).await?;
assert_eq!(
plan_str,
- "Projection: FILENAME_PLACEHOLDER_1.s_acctbal AS S_ACCTBAL, FILENAME_PLACEHOLDER_1.s_name AS S_NAME, FILENAME_PLACEHOLDER_3.N_NAME, FILENAME_PLACEHOLDER_0.p_partkey AS P_PARTKEY, FILENAME_PLACEHOLDER_0.p_mfgr AS P_MFGR, FILENAME_PLACEHOLDER_1.s_address AS S_ADDRESS, FILENAME_PLACEHOLDER_1.s_phone AS S_PHONE, FILENAME_PLACEHOLDER_1.s_comment AS S_COMMENT\
- \n Limit: skip=0, fetch=100\
- \n Sort: FILENAME_PLACEHOLDER_1.s_acctbal DESC NULLS FIRST, FILENAME_PLACEHOLDER_3.N_NAME ASC NULLS LAST, FILENAME_PLACEHOLDER_1.s_name ASC NULLS LAST, FILENAME_PLACEHOLDER_0.p_partkey ASC NULLS LAST\
- \n Projection: FILENAME_PLACEHOLDER_1.s_acctbal, FILENAME_PLACEHOLDER_1.s_name, FILENAME_PLACEHOLDER_3.N_NAME, FILENAME_PLACEHOLDER_0.p_partkey, FILENAME_PLACEHOLDER_0.p_mfgr, FILENAME_PLACEHOLDER_1.s_address, FILENAME_PLACEHOLDER_1.s_phone, FILENAME_PLACEHOLDER_1.s_comment\
- \n Filter: FILENAME_PLACEHOLDER_0.p_partkey = FILENAME_PLACEHOLDER_2.ps_partkey AND FILENAME_PLACEHOLDER_1.s_suppkey = FILENAME_PLACEHOLDER_2.ps_suppkey AND FILENAME_PLACEHOLDER_0.p_size = Int32(15) AND FILENAME_PLACEHOLDER_0.p_type LIKE CAST(Utf8(\"%BRASS\") AS Utf8) AND FILENAME_PLACEHOLDER_1.s_nationkey = FILENAME_PLACEHOLDER_3.N_NATIONKEY AND FILENAME_PLACEHOLDER_3.N_REGIONKEY = FILENAME_PLACEHOLDER_4.R_REGIONKEY AND FILENAME_PLACEHOLDER_4.R_NAME = CAST(Utf8(\"EUROPE\") AS Utf8) AND FILENAME_PLACEHOLDER_2.ps_supplycost = (<subquery>)\
- \n Subquery:\
- \n Aggregate: groupBy=[[]], aggr=[[min(FILENAME_PLACEHOLDER_5.ps_supplycost)]]\
- \n Projection: FILENAME_PLACEHOLDER_5.ps_supplycost\
- \n Filter: FILENAME_PLACEHOLDER_5.ps_partkey = FILENAME_PLACEHOLDER_5.ps_partkey AND FILENAME_PLACEHOLDER_6.s_suppkey = FILENAME_PLACEHOLDER_5.ps_suppkey AND FILENAME_PLACEHOLDER_6.s_nationkey = FILENAME_PLACEHOLDER_7.N_NATIONKEY AND FILENAME_PLACEHOLDER_7.N_REGIONKEY = FILENAME_PLACEHOLDER_8.R_REGIONKEY AND FILENAME_PLACEHOLDER_8.R_NAME = CAST(Utf8(\"EUROPE\") AS Utf8)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_5 projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_6 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_7 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
- \n TableScan: FILENAME_PLACEHOLDER_8 projection=[R_REGIONKEY, R_NAME, R_COMMENT]\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[p_partkey, p_name, p_mfgr, p_brand, p_type, p_size, p_container, p_retailprice, p_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
- \n TableScan: FILENAME_PLACEHOLDER_4 projection=[R_REGIONKEY, R_NAME, R_COMMENT]"
+ "Limit: skip=0, fetch=100\
+ \n Sort: SUPPLIER.S_ACCTBAL DESC NULLS FIRST, NATION.N_NAME ASC NULLS LAST, SUPPLIER.S_NAME ASC NULLS LAST, PART.P_PARTKEY ASC NULLS LAST\
+ \n Projection: SUPPLIER.S_ACCTBAL, SUPPLIER.S_NAME, NATION.N_NAME, PART.P_PARTKEY, PART.P_MFGR, SUPPLIER.S_ADDRESS, SUPPLIER.S_PHONE, SUPPLIER.S_COMMENT\
+ \n Filter: PART.P_PARTKEY = PARTSUPP.PS_PARTKEY AND SUPPLIER.S_SUPPKEY = PARTSUPP.PS_SUPPKEY AND PART.P_SIZE = Int32(15) AND PART.P_TYPE LIKE CAST(Utf8(\"%BRASS\") AS Utf8) AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_REGIONKEY = REGION.R_REGIONKEY AND REGION.R_NAME = Utf8(\"EUROPE\") AND PARTSUPP.PS_SUPPLYCOST = (<subquery>)\
+ \n Subquery:\
+ \n Aggregate: groupBy=[[]], aggr=[[min(PARTSUPP.PS_SUPPLYCOST)]]\
+ \n Projection: PARTSUPP.PS_SUPPLYCOST\
+ \n Filter: PARTSUPP.PS_PARTKEY = PARTSUPP.PS_PARTKEY AND SUPPLIER.S_SUPPKEY = PARTSUPP.PS_SUPPKEY AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_REGIONKEY = REGION.R_REGIONKEY AND REGION.R_NAME = Utf8(\"EUROPE\")\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: PARTSUPP projection=[PS_PARTKEY, PS_SUPPKEY, PS_AVAILQTY, PS_SUPPLYCOST, PS_COMMENT]\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
+ \n TableScan: REGION projection=[R_REGIONKEY, R_NAME, R_COMMENT]\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: PART projection=[P_PARTKEY, P_NAME, P_MFGR, P_BRAND, P_TYPE, P_SIZE, P_CONTAINER, P_RETAILPRICE, P_COMMENT]\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: PARTSUPP projection=[PS_PARTKEY, PS_SUPPKEY, PS_AVAILQTY, PS_SUPPLYCOST, PS_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
+ \n TableScan: REGION projection=[R_REGIONKEY, R_NAME, R_COMMENT]"
);
Ok(())
}
#[tokio::test]
- async fn tpch_test_3() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/orders.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/lineitem.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_3.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
+ async fn tpch_test_03() -> Result<()> {
+ let plan_str = tpch_plan_to_string(3).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: LINEITEM.L_ORDERKEY, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) AS REVENUE, ORDERS.O_ORDERDATE, ORDERS.O_SHIPPRIORITY\
+ \n Limit: skip=0, fetch=10\
+ \n Sort: sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) DESC NULLS FIRST, ORDERS.O_ORDERDATE ASC NULLS LAST\
+ \n Projection: LINEITEM.L_ORDERKEY, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT), ORDERS.O_ORDERDATE, ORDERS.O_SHIPPRIORITY\
+ \n Aggregate: groupBy=[[LINEITEM.L_ORDERKEY, ORDERS.O_ORDERDATE, ORDERS.O_SHIPPRIORITY]], aggr=[[sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT)]]\
+ \n Projection: LINEITEM.L_ORDERKEY, ORDERS.O_ORDERDATE, ORDERS.O_SHIPPRIORITY, LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT)\
+ \n Filter: CUSTOMER.C_MKTSEGMENT = Utf8(\"BUILDING\") AND CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY AND LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY AND ORDERS.O_ORDERDATE < CAST(Utf8(\"1995-03-15\") AS Date32) AND LINEITEM.L_SHIPDATE > CAST(Utf8(\"1995-03-15\") AS Date32)\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]"
+ );
+ Ok(())
+ }
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_2.l_orderkey AS L_ORDERKEY, sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount) AS REVENUE, FILENAME_PLACEHOLDER_1.o_orderdate AS O_ORDERDATE, FILENAME_PLACEHOLDER_1.o_shippriority AS O_SHIPPRIORITY\
- \n Limit: skip=0, fetch=10\
- \n Sort: sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount) DESC NULLS FIRST, FILENAME_PLACEHOLDER_1.o_orderdate ASC NULLS LAST\
- \n Projection: FILENAME_PLACEHOLDER_2.l_orderkey, sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount), FILENAME_PLACEHOLDER_1.o_orderdate, FILENAME_PLACEHOLDER_1.o_shippriority\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_2.l_orderkey, FILENAME_PLACEHOLDER_1.o_orderdate, FILENAME_PLACEHOLDER_1.o_shippriority]], aggr=[[sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount)]]\
- \n Projection: FILENAME_PLACEHOLDER_2.l_orderkey, FILENAME_PLACEHOLDER_1.o_orderdate, FILENAME_PLACEHOLDER_1.o_shippriority, FILENAME_PLACEHOLDER_2.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_2.l_discount)\
- \n Filter: FILENAME_PLACEHOLDER_0.c_mktsegment = CAST(Utf8(\"HOUSEHOLD\") AS Utf8) AND FILENAME_PLACEHOLDER_0.c_custkey = FILENAME_PLACEHOLDER_1.o_custkey AND FILENAME_PLACEHOLDER_2.l_orderkey = FILENAME_PLACEHOLDER_1.o_orderkey AND FILENAME_PLACEHOLDER_1.o_orderdate < Date32(\"1995-03-25\") AND FILENAME_PLACEHOLDER_2.l_shipdate > Date32(\"1995-03-25\")\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]\n TableScan: FILENAME_PLACEHOLDER_2 projection=[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]");
+ #[tokio::test]
+ async fn tpch_test_04() -> Result<()> {
+ let plan_str = tpch_plan_to_string(4).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: ORDERS.O_ORDERPRIORITY, count(Int64(1)) AS ORDER_COUNT\
+ \n Sort: ORDERS.O_ORDERPRIORITY ASC NULLS LAST\
+ \n Aggregate: groupBy=[[ORDERS.O_ORDERPRIORITY]], aggr=[[count(Int64(1))]]\
+ \n Projection: ORDERS.O_ORDERPRIORITY\
+ \n Filter: ORDERS.O_ORDERDATE >= CAST(Utf8(\"1993-07-01\") AS Date32) AND ORDERS.O_ORDERDATE < CAST(Utf8(\"1993-10-01\") AS Date32) AND EXISTS (<subquery>)\
+ \n Subquery:\
+ \n Filter: LINEITEM.L_ORDERKEY = LINEITEM.L_ORDERKEY AND LINEITEM.L_COMMITDATE < LINEITEM.L_RECEIPTDATE\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
- async fn tpch_test_4() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/orders.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/lineitem.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_4.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_0.o_orderpriority AS O_ORDERPRIORITY, count(Int64(1)) AS ORDER_COUNT\
- \n Sort: FILENAME_PLACEHOLDER_0.o_orderpriority ASC NULLS LAST\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.o_orderpriority]], aggr=[[count(Int64(1))]]\
- \n Projection: FILENAME_PLACEHOLDER_0.o_orderpriority\
- \n Filter: FILENAME_PLACEHOLDER_0.o_orderdate >= CAST(Utf8(\"1993-07-01\") AS Date32) AND FILENAME_PLACEHOLDER_0.o_orderdate < CAST(Utf8(\"1993-10-01\") AS Date32) AND EXISTS (<subquery>)\
- \n Subquery:\
- \n Filter: FILENAME_PLACEHOLDER_1.l_orderkey = FILENAME_PLACEHOLDER_1.l_orderkey AND FILENAME_PLACEHOLDER_1.l_commitdate < FILENAME_PLACEHOLDER_1.l_receiptdate\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[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]\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]");
+ async fn tpch_test_05() -> Result<()> {
+ let plan_str = tpch_plan_to_string(5).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: NATION.N_NAME, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) AS REVENUE\
+ \n Sort: sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) DESC NULLS FIRST\
+ \n Aggregate: groupBy=[[NATION.N_NAME]], aggr=[[sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT)]]\
+ \n Projection: NATION.N_NAME, LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT)\
+ \n Filter: CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY AND LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY AND LINEITEM.L_SUPPKEY = SUPPLIER.S_SUPPKEY AND CUSTOMER.C_NATIONKEY = SUPPLIER.S_NATIONKEY AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_REGIONKEY = REGION.R_REGIONKEY AND REGION.R_NAME = Utf8(\"ASIA\") AND ORDERS.O_ORDERDATE >= CAST(Utf8(\"1994-01-01\") AS Date32) AND ORDERS.O_ORDERDATE < CAST(Utf8(\"1995-01-01\") AS Date32)\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
+ \n TableScan: REGION projection=[R_REGIONKEY, R_NAME, R_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
- async fn tpch_test_5() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/orders.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/supplier.csv"),
- ("NATION", "tests/testdata/tpch/nation.csv"),
- ("REGION", "tests/testdata/tpch/region.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_5.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
+ async fn tpch_test_06() -> Result<()> {
+ let plan_str = tpch_plan_to_string(6).await?;
+ assert_eq!(
+ plan_str,
+ "Aggregate: groupBy=[[]], aggr=[[sum(LINEITEM.L_EXTENDEDPRICE * LINEITEM.L_DISCOUNT) AS REVENUE]]\
+ \n Projection: LINEITEM.L_EXTENDEDPRICE * LINEITEM.L_DISCOUNT\
+ \n Filter: LINEITEM.L_SHIPDATE >= CAST(Utf8(\"1994-01-01\") AS Date32) AND LINEITEM.L_SHIPDATE < CAST(Utf8(\"1995-01-01\") AS Date32) AND LINEITEM.L_DISCOUNT >= Decimal128(Some(5),3,2) AND LINEITEM.L_DISCOUNT <= Decimal128(Some(7),3,2) AND LINEITEM.L_QUANTITY < CAST(Int32(24) AS Decimal128(15, 2))\
+ \n TableScan: LINEITEM projection=[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]"
+ );
+ Ok(())
+ }
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: NATION.N_NAME, sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount) AS REVENUE\
- \n Sort: sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount) DESC NULLS FIRST\
- \n Aggregate: groupBy=[[NATION.N_NAME]], aggr=[[sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount)]]\
- \n Projection: NATION.N_NAME, FILENAME_PLACEHOLDER_2.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_2.l_discount)\
- \n Filter: FILENAME_PLACEHOLDER_0.c_custkey = FILENAME_PLACEHOLDER_1.o_custkey AND FILENAME_PLACEHOLDER_2.l_orderkey = FILENAME_PLACEHOLDER_1.o_orderkey AND FILENAME_PLACEHOLDER_2.l_suppkey = FILENAME_PLACEHOLDER_3.s_suppkey AND FILENAME_PLACEHOLDER_0.c_nationkey = FILENAME_PLACEHOLDER_3.s_nationkey AND FILENAME_PLACEHOLDER_3.s_nationkey = NATION.N_NATIONKEY AND NATION.N_REGIONKEY = REGION.R_REGIONKEY AND REGION.R_NAME = CAST(Utf8(\"ASIA\") AS Utf8) AND FILENAME_PLACEHOLDER_1.o_orderdate >= CAST(Utf8(\"1994-01-01\") AS Date32) AND FILENAME_PLACEHOLDER_1.o_orderdate < CAST(Utf8(\"1995-01-01\") AS Date32)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[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]\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
- \n TableScan: REGION projection=[R_REGIONKEY, R_NAME, R_COMMENT]");
+ #[ignore]
+ #[tokio::test]
+ async fn tpch_test_07() -> Result<()> {
+ let plan_str = tpch_plan_to_string(7).await?;
+ assert_eq!(plan_str, "Missing support for enum function arguments");
Ok(())
}
+ #[ignore]
#[tokio::test]
- async fn tpch_test_6() -> Result<()> {
- let ctx = create_context(vec![(
- "FILENAME_PLACEHOLDER_0",
- "tests/testdata/tpch/lineitem.csv",
- )])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_6.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
+ async fn tpch_test_08() -> Result<()> {
+ let plan_str = tpch_plan_to_string(8).await?;
+ assert_eq!(plan_str, "Missing support for enum function arguments");
+ Ok(())
+ }
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Aggregate: groupBy=[[]], aggr=[[sum(FILENAME_PLACEHOLDER_0.l_extendedprice * FILENAME_PLACEHOLDER_0.l_discount) AS REVENUE]]\
- \n Projection: FILENAME_PLACEHOLDER_0.l_extendedprice * FILENAME_PLACEHOLDER_0.l_discount\
- \n Filter: FILENAME_PLACEHOLDER_0.l_shipdate >= CAST(Utf8(\"1994-01-01\") AS Date32) AND FILENAME_PLACEHOLDER_0.l_shipdate < CAST(Utf8(\"1995-01-01\") AS Date32) AND FILENAME_PLACEHOLDER_0.l_discount >= Decimal128(Some(5),3,2) AND FILENAME_PLACEHOLDER_0.l_discount <= Decimal128(Some(7),3,2) AND FILENAME_PLACEHOLDER_0.l_quantity < CAST(Int32(24) AS Decimal128(19, 0))\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[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]");
+ #[ignore]
+ #[tokio::test]
+ async fn tpch_test_09() -> Result<()> {
+ let plan_str = tpch_plan_to_string(9).await?;
+ assert_eq!(plan_str, "Missing support for enum function arguments");
Ok(())
}
- // TODO: missing plan 7, 8, 9
#[tokio::test]
async fn tpch_test_10() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/orders.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/nation.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_10.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_0.c_custkey AS C_CUSTKEY, FILENAME_PLACEHOLDER_0.c_name AS C_NAME, sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount) AS REVENUE, FILENAME_PLACEHOLDER_0.c_acctbal AS C_ACCTBAL, FILENAME_PLACEHOLDER_3.N_NAME, FILENAME_PLACEHOLDER_0.c_address AS C_ADDRESS, FILENAME_PLACEHOLDER_0.c_phone AS C_PHONE, FILENAME_PLACEHOLDER_0.c_comment AS C_COMMENT\
- \n Limit: skip=0, fetch=20\
- \n Sort: sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount) DESC NULLS FIRST\
- \n Projection: FILENAME_PLACEHOLDER_0.c_custkey, FILENAME_PLACEHOLDER_0.c_name, sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount), FILENAME_PLACEHOLDER_0.c_acctbal, FILENAME_PLACEHOLDER_3.N_NAME, FILENAME_PLACEHOLDER_0.c_address, FILENAME_PLACEHOLDER_0.c_phone, FILENAME_PLACEHOLDER_0.c_comment\n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.c_custkey, FILENAME_PLACEHOLDER_0.c_name, FILENAME_PLACEHOLDER_0.c_acctbal, FILENAME_PLACEHOLDER_0.c_phone, FILENAME_PLACEHOLDER_3.N_NAME, FILENAME_PLACEHOLDER_0.c_address, FILENAME_PLACEHOLDER_0.c_comment]], aggr=[[sum(FILENAME_PLACEHOLDER_2.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_2.l_discount)]]\
- \n Projection: FILENAME_PLACEHOLDER_0.c_custkey, FILENAME_PLACEHOLDER_0.c_name, FILENAME_PLACEHOLDER_0.c_acctbal, FILENAME_PLACEHOLDER_0.c_phone, FILENAME_PLACEHOLDER_3.N_NAME, FILENAME_PLACEHOLDER_0.c_address, FILENAME_PLACEHOLDER_0.c_comment, FILENAME_PLACEHOLDER_2.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_2.l_discount)\
- \n Filter: FILENAME_PLACEHOLDER_0.c_custkey = FILENAME_PLACEHOLDER_1.o_custkey AND FILENAME_PLACEHOLDER_2.l_orderkey = FILENAME_PLACEHOLDER_1.o_orderkey AND FILENAME_PLACEHOLDER_1.o_orderdate >= CAST(Utf8(\"1993-10-01\") AS Date32) AND FILENAME_PLACEHOLDER_1.o_orderdate < CAST(Utf8(\"1994-01-01\") AS Date32) AND FILENAME_PLACEHOLDER_2.l_returnflag = Utf8(\"R\") AND FILENAME_PLACEHOLDER_0.c_nationkey = FILENAME_PLACEHOLDER_3.N_NATIONKEY\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[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]\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]");
+ let plan_str = tpch_plan_to_string(10).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: CUSTOMER.C_CUSTKEY, CUSTOMER.C_NAME, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) AS REVENUE, CUSTOMER.C_ACCTBAL, NATION.N_NAME, CUSTOMER.C_ADDRESS, CUSTOMER.C_PHONE, CUSTOMER.C_COMMENT\
+ \n Limit: skip=0, fetch=20\
+ \n Sort: sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) DESC NULLS FIRST\
+ \n Projection: CUSTOMER.C_CUSTKEY, CUSTOMER.C_NAME, sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT), CUSTOMER.C_ACCTBAL, NATION.N_NAME, CUSTOMER.C_ADDRESS, CUSTOMER.C_PHONE, CUSTOMER.C_COMMENT\
+ \n Aggregate: groupBy=[[CUSTOMER.C_CUSTKEY, CUSTOMER.C_NAME, CUSTOMER.C_ACCTBAL, CUSTOMER.C_PHONE, NATION.N_NAME, CUSTOMER.C_ADDRESS, CUSTOMER.C_COMMENT]], aggr=[[sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT)]]\
+ \n Projection: CUSTOMER.C_CUSTKEY, CUSTOMER.C_NAME, CUSTOMER.C_ACCTBAL, CUSTOMER.C_PHONE, NATION.N_NAME, CUSTOMER.C_ADDRESS, CUSTOMER.C_COMMENT, LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT)\
+ \n Filter: CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY AND LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY AND ORDERS.O_ORDERDATE >= CAST(Utf8(\"1993-10-01\") AS Date32) AND ORDERS.O_ORDERDATE < CAST(Utf8(\"1994-01-01\") AS Date32) AND LINEITEM.L_RETURNFLAG = Utf8(\"R\") AND CUSTOMER.C_NATIONKEY = NATION.N_NATIONKEY\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
async fn tpch_test_11() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/partsupp.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/supplier.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/nation.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/partsupp.csv"),
- ("FILENAME_PLACEHOLDER_4", "tests/testdata/tpch/supplier.csv"),
- ("FILENAME_PLACEHOLDER_5", "tests/testdata/tpch/nation.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_11.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
+ let plan_str = tpch_plan_to_string(11).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: PARTSUPP.PS_PARTKEY, sum(PARTSUPP.PS_SUPPLYCOST * PARTSUPP.PS_AVAILQTY) AS value\
+ \n Sort: sum(PARTSUPP.PS_SUPPLYCOST * PARTSUPP.PS_AVAILQTY) DESC NULLS FIRST\
+ \n Filter: sum(PARTSUPP.PS_SUPPLYCOST * PARTSUPP.PS_AVAILQTY) > (<subquery>)\
+ \n Subquery:\
+ \n Projection: sum(PARTSUPP.PS_SUPPLYCOST * PARTSUPP.PS_AVAILQTY) * Decimal128(Some(1000000),11,10)\
+ \n Aggregate: groupBy=[[]], aggr=[[sum(PARTSUPP.PS_SUPPLYCOST * PARTSUPP.PS_AVAILQTY)]]\
+ \n Projection: PARTSUPP.PS_SUPPLYCOST * CAST(PARTSUPP.PS_AVAILQTY AS Decimal128(19, 0))\
+ \n Filter: PARTSUPP.PS_SUPPKEY = SUPPLIER.S_SUPPKEY AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_NAME = Utf8(\"JAPAN\")\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: PARTSUPP projection=[PS_PARTKEY, PS_SUPPKEY, PS_AVAILQTY, PS_SUPPLYCOST, PS_COMMENT]\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
+ \n Aggregate: groupBy=[[PARTSUPP.PS_PARTKEY]], aggr=[[sum(PARTSUPP.PS_SUPPLYCOST * PARTSUPP.PS_AVAILQTY)]]\
+ \n Projection: PARTSUPP.PS_PARTKEY, PARTSUPP.PS_SUPPLYCOST * CAST(PARTSUPP.PS_AVAILQTY AS Decimal128(19, 0))\
+ \n Filter: PARTSUPP.PS_SUPPKEY = SUPPLIER.S_SUPPKEY AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_NAME = Utf8(\"JAPAN\")\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: PARTSUPP projection=[PS_PARTKEY, PS_SUPPKEY, PS_AVAILQTY, PS_SUPPLYCOST, PS_COMMENT]\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]"
+ );
+ Ok(())
+ }
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_0.ps_partkey AS PS_PARTKEY, sum(FILENAME_PLACEHOLDER_0.ps_supplycost * FILENAME_PLACEHOLDER_0.ps_availqty) AS value\
- \n Sort: sum(FILENAME_PLACEHOLDER_0.ps_supplycost * FILENAME_PLACEHOLDER_0.ps_availqty) DESC NULLS FIRST\
- \n Filter: sum(FILENAME_PLACEHOLDER_0.ps_supplycost * FILENAME_PLACEHOLDER_0.ps_availqty) > (<subquery>)\
- \n Subquery:\
- \n Projection: sum(FILENAME_PLACEHOLDER_3.ps_supplycost * FILENAME_PLACEHOLDER_3.ps_availqty) * Decimal128(Some(1000000),11,10)\
- \n Aggregate: groupBy=[[]], aggr=[[sum(FILENAME_PLACEHOLDER_3.ps_supplycost * FILENAME_PLACEHOLDER_3.ps_availqty)]]\
- \n Projection: FILENAME_PLACEHOLDER_3.ps_supplycost * CAST(FILENAME_PLACEHOLDER_3.ps_availqty AS Decimal128(19, 0))\
- \n Filter: FILENAME_PLACEHOLDER_3.ps_suppkey = FILENAME_PLACEHOLDER_4.s_suppkey AND FILENAME_PLACEHOLDER_4.s_nationkey = FILENAME_PLACEHOLDER_5.N_NATIONKEY AND FILENAME_PLACEHOLDER_5.N_NAME = CAST(Utf8(\"JAPAN\") AS Utf8)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_4 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_5 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.ps_partkey]], aggr=[[sum(FILENAME_PLACEHOLDER_0.ps_supplycost * FILENAME_PLACEHOLDER_0.ps_availqty)]]\
- \n Projection: FILENAME_PLACEHOLDER_0.ps_partkey, FILENAME_PLACEHOLDER_0.ps_supplycost * CAST(FILENAME_PLACEHOLDER_0.ps_availqty AS Decimal128(19, 0))\
- \n Filter: FILENAME_PLACEHOLDER_0.ps_suppkey = FILENAME_PLACEHOLDER_1.s_suppkey AND FILENAME_PLACEHOLDER_1.s_nationkey = FILENAME_PLACEHOLDER_2.N_NATIONKEY AND FILENAME_PLACEHOLDER_2.N_NAME = CAST(Utf8(\"JAPAN\") AS Utf8)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]");
+ #[tokio::test]
+ async fn tpch_test_12() -> Result<()> {
+ let plan_str = tpch_plan_to_string(12).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: LINEITEM.L_SHIPMODE, sum(CASE WHEN ORDERS.O_ORDERPRIORITY = Utf8(\"1-URGENT\") OR ORDERS.O_ORDERPRIORITY = Utf8(\"2-HIGH\") THEN Int32(1) ELSE Int32(0) END) AS HIGH_LINE_COUNT, sum(CASE WHEN ORDERS.O_ORDERPRIORITY != Utf8(\"1-URGENT\") AND ORDERS.O_ORDERPRIORITY != Utf8(\"2-HIGH\") THEN Int32(1) ELSE Int32(0) END) AS LOW_LINE_COUNT\
+ \n Sort: LINEITEM.L_SHIPMODE ASC NULLS LAST\
+ \n Aggregate: groupBy=[[LINEITEM.L_SHIPMODE]], aggr=[[sum(CASE WHEN ORDERS.O_ORDERPRIORITY = Utf8(\"1-URGENT\") OR ORDERS.O_ORDERPRIORITY = Utf8(\"2-HIGH\") THEN Int32(1) ELSE Int32(0) END), sum(CASE WHEN ORDERS.O_ORDERPRIORITY != Utf8(\"1-URGENT\") AND ORDERS.O_ORDERPRIORITY != Utf8(\"2-HIGH\") THEN Int32(1) ELSE Int32(0) END)]]\
+ \n Projection: LINEITEM.L_SHIPMODE, CASE WHEN ORDERS.O_ORDERPRIORITY = Utf8(\"1-URGENT\") OR ORDERS.O_ORDERPRIORITY = Utf8(\"2-HIGH\") THEN Int32(1) ELSE Int32(0) END, CASE WHEN ORDERS.O_ORDERPRIORITY != Utf8(\"1-URGENT\") AND ORDERS.O_ORDERPRIORITY != Utf8(\"2-HIGH\") THEN Int32(1) ELSE Int32(0) END\
+ \n Filter: ORDERS.O_ORDERKEY = LINEITEM.L_ORDERKEY AND (LINEITEM.L_SHIPMODE = CAST(Utf8(\"MAIL\") AS Utf8) OR LINEITEM.L_SHIPMODE = CAST(Utf8(\"SHIP\") AS Utf8)) AND LINEITEM.L_COMMITDATE < LINEITEM.L_RECEIPTDATE AND LINEITEM.L_SHIPDATE < LINEITEM.L_COMMITDATE AND LINEITEM.L_RECEIPTDATE >= CAST(Utf8(\"1994-01-01\") AS Date32) AND LINEITEM.L_RECEIPTDATE < CAST(Utf8(\"1995-01-01\") AS Date32)\
+ \n CrossJoin:\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]\
+ \n TableScan: LINEITEM projection=[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]"
+ );
Ok(())
}
- // missing query 12
#[tokio::test]
async fn tpch_test_13() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/orders.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_13.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: count(FILENAME_PLACEHOLDER_1.o_orderkey) AS C_COUNT, count(Int64(1)) AS CUSTDIST\
- \n Sort: count(Int64(1)) DESC NULLS FIRST, count(FILENAME_PLACEHOLDER_1.o_orderkey) DESC NULLS FIRST\
- \n Projection: count(FILENAME_PLACEHOLDER_1.o_orderkey), count(Int64(1))\
- \n Aggregate: groupBy=[[count(FILENAME_PLACEHOLDER_1.o_orderkey)]], aggr=[[count(Int64(1))]]\
- \n Projection: count(FILENAME_PLACEHOLDER_1.o_orderkey)\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.c_custkey]], aggr=[[count(FILENAME_PLACEHOLDER_1.o_orderkey)]]\
- \n Projection: FILENAME_PLACEHOLDER_0.c_custkey, FILENAME_PLACEHOLDER_1.o_orderkey\
- \n Left Join: FILENAME_PLACEHOLDER_0.c_custkey = FILENAME_PLACEHOLDER_1.o_custkey Filter: NOT FILENAME_PLACEHOLDER_1.o_comment LIKE CAST(Utf8(\"%special%requests%\") AS Utf8)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]");
+ let plan_str = tpch_plan_to_string(13).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: count(ORDERS.O_ORDERKEY) AS C_COUNT, count(Int64(1)) AS CUSTDIST\
+ \n Sort: count(Int64(1)) DESC NULLS FIRST, count(ORDERS.O_ORDERKEY) DESC NULLS FIRST\
+ \n Projection: count(ORDERS.O_ORDERKEY), count(Int64(1))\
+ \n Aggregate: groupBy=[[count(ORDERS.O_ORDERKEY)]], aggr=[[count(Int64(1))]]\
+ \n Projection: count(ORDERS.O_ORDERKEY)\
+ \n Aggregate: groupBy=[[CUSTOMER.C_CUSTKEY]], aggr=[[count(ORDERS.O_ORDERKEY)]]\
+ \n Projection: CUSTOMER.C_CUSTKEY, ORDERS.O_ORDERKEY\
+ \n Left Join: CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY Filter: NOT ORDERS.O_COMMENT LIKE CAST(Utf8(\"%special%requests%\") AS Utf8)\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
async fn tpch_test_14() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/part.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_14.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
+ let plan_str = tpch_plan_to_string(14).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: Decimal128(Some(10000),5,2) * sum(CASE WHEN PART.P_TYPE LIKE Utf8(\"PROMO%\") THEN LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT ELSE Decimal128(Some(0),19,4) END) / sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) AS PROMO_REVENUE\
+ \n Aggregate: groupBy=[[]], aggr=[[sum(CASE WHEN PART.P_TYPE LIKE Utf8(\"PROMO%\") THEN LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT ELSE Decimal128(Some(0),19,4) END), sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT)]]\
+ \n Projection: CASE WHEN PART.P_TYPE LIKE CAST(Utf8(\"PROMO%\") AS Utf8) THEN LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT) ELSE Decimal128(Some(0),19,4) END, LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT)\
+ \n Filter: LINEITEM.L_PARTKEY = PART.P_PARTKEY AND LINEITEM.L_SHIPDATE >= Date32(\"1995-09-01\") AND LINEITEM.L_SHIPDATE < CAST(Utf8(\"1995-10-01\") AS Date32)\
+ \n CrossJoin:\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: PART projection=[P_PARTKEY, P_NAME, P_MFGR, P_BRAND, P_TYPE, P_SIZE, P_CONTAINER, P_RETAILPRICE, P_COMMENT]"
+ );
+ Ok(())
+ }
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: Decimal128(Some(10000),5,2) * sum(CASE WHEN FILENAME_PLACEHOLDER_1.p_type LIKE Utf8(\"PROMO%\") THEN FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount ELSE Decimal128(Some(0),19,0) END) / sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount) AS PROMO_REVENUE\
- \n Aggregate: groupBy=[[]], aggr=[[sum(CASE WHEN FILENAME_PLACEHOLDER_1.p_type LIKE Utf8(\"PROMO%\") THEN FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount ELSE Decimal128(Some(0),19,0) END), sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount)]]\
- \n Projection: CASE WHEN FILENAME_PLACEHOLDER_1.p_type LIKE CAST(Utf8(\"PROMO%\") AS Utf8) THEN FILENAME_PLACEHOLDER_0.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_0.l_discount) ELSE Decimal128(Some(0),19,0) END, FILENAME_PLACEHOLDER_0.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_0.l_discount)\
- \n Filter: FILENAME_PLACEHOLDER_0.l_partkey = FILENAME_PLACEHOLDER_1.p_partkey AND FILENAME_PLACEHOLDER_0.l_shipdate >= Date32(\"1995-09-01\") AND FILENAME_PLACEHOLDER_0.l_shipdate < CAST(Utf8(\"1995-10-01\") AS Date32)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[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]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[p_partkey, p_name, p_mfgr, p_brand, p_type, p_size, p_container, p_retailprice, p_comment]");
+ #[ignore]
+ #[tokio::test]
+ async fn tpch_test_15() -> Result<()> {
+ let plan_str = tpch_plan_to_string(15).await?;
+ assert_eq!(plan_str, "Test file is empty");
Ok(())
}
- // query 15 is missing
+
#[tokio::test]
async fn tpch_test_16() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/partsupp.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/part.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/supplier.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_16.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_1.p_brand AS P_BRAND, FILENAME_PLACEHOLDER_1.p_type AS P_TYPE, FILENAME_PLACEHOLDER_1.p_size AS P_SIZE, count(DISTINCT FILENAME_PLACEHOLDER_0.ps_suppkey) AS SUPPLIER_CNT\
- \n Sort: count(DISTINCT FILENAME_PLACEHOLDER_0.ps_suppkey) DESC NULLS FIRST, FILENAME_PLACEHOLDER_1.p_brand ASC NULLS LAST, FILENAME_PLACEHOLDER_1.p_type ASC NULLS LAST, FILENAME_PLACEHOLDER_1.p_size ASC NULLS LAST\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_1.p_brand, FILENAME_PLACEHOLDER_1.p_type, FILENAME_PLACEHOLDER_1.p_size]], aggr=[[count(DISTINCT FILENAME_PLACEHOLDER_0.ps_suppkey)]]\
- \n Projection: FILENAME_PLACEHOLDER_1.p_brand, FILENAME_PLACEHOLDER_1.p_type, FILENAME_PLACEHOLDER_1.p_size, FILENAME_PLACEHOLDER_0.ps_suppkey\
- \n Filter: FILENAME_PLACEHOLDER_1.p_partkey = FILENAME_PLACEHOLDER_0.ps_partkey AND FILENAME_PLACEHOLDER_1.p_brand != CAST(Utf8(\"Brand#45\") AS Utf8) AND NOT FILENAME_PLACEHOLDER_1.p_type LIKE CAST(Utf8(\"MEDIUM POLISHED%\") AS Utf8) AND (FILENAME_PLACEHOLDER_1.p_size = Int32(49) OR FILENAME_PLACEHOLDER_1.p_size = Int32(14) OR FILENAME_PLACEHOLDER_1.p_size = Int32(23) OR FILENAME_PLACEHOLDER_1.p_size = Int32(45) OR FILENAME_PLACEHOLDER_1.p_size = Int32(19) OR FILENAME_PLACEHOLDER_1.p_size = Int32(3) OR FILENAME_PLACEHOLDER_1.p_size = Int32(36) OR FILENAME_PLACEHOLDER_1.p_size = Int32(9)) AND NOT CAST(FILENAME_PLACEHOLDER_0.ps_suppkey IN (<subquery>) AS Boolean)\
- \n Subquery:\
- \n Projection: FILENAME_PLACEHOLDER_2.s_suppkey\
- \n Filter: FILENAME_PLACEHOLDER_2.s_comment LIKE CAST(Utf8(\"%Customer%Complaints%\") AS Utf8)\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[p_partkey, p_name, p_mfgr, p_brand, p_type, p_size, p_container, p_retailprice, p_comment]");
+ let plan_str = tpch_plan_to_string(16).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: PART.P_BRAND, PART.P_TYPE, PART.P_SIZE, count(DISTINCT PARTSUPP.PS_SUPPKEY) AS SUPPLIER_CNT\
+ \n Sort: count(DISTINCT PARTSUPP.PS_SUPPKEY) DESC NULLS FIRST, PART.P_BRAND ASC NULLS LAST, PART.P_TYPE ASC NULLS LAST, PART.P_SIZE ASC NULLS LAST\
+ \n Aggregate: groupBy=[[PART.P_BRAND, PART.P_TYPE, PART.P_SIZE]], aggr=[[count(DISTINCT PARTSUPP.PS_SUPPKEY)]]\
+ \n Projection: PART.P_BRAND, PART.P_TYPE, PART.P_SIZE, PARTSUPP.PS_SUPPKEY\
+ \n Filter: PART.P_PARTKEY = PARTSUPP.PS_PARTKEY AND PART.P_BRAND != Utf8(\"Brand#45\") AND NOT PART.P_TYPE LIKE CAST(Utf8(\"MEDIUM POLISHED%\") AS Utf8) AND (PART.P_SIZE = Int32(49) OR PART.P_SIZE = Int32(14) OR PART.P_SIZE = Int32(23) OR PART.P_SIZE = Int32(45) OR PART.P_SIZE = Int32(19) OR PART.P_SIZE = Int32(3) OR PART.P_SIZE = Int32(36) OR PART.P_SIZE = Int32(9)) AND NOT PARTSUPP.PS_SUPPKEY IN (<subquery>)\
+ \n Subquery:\
+ \n Projection: SUPPLIER.S_SUPPKEY\
+ \n Filter: SUPPLIER.S_COMMENT LIKE CAST(Utf8(\"%Customer%Complaints%\") AS Utf8)\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n CrossJoin:\
+ \n TableScan: PARTSUPP projection=[PS_PARTKEY, PS_SUPPKEY, PS_AVAILQTY, PS_SUPPLYCOST, PS_COMMENT]\
+ \n TableScan: PART projection=[P_PARTKEY, P_NAME, P_MFGR, P_BRAND, P_TYPE, P_SIZE, P_CONTAINER, P_RETAILPRICE, P_COMMENT]"
+ );
Ok(())
}
- /// this test has some problem in json file internally, gonna fix it
+
#[ignore]
#[tokio::test]
async fn tpch_test_17() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/part.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/lineitem.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_17.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let _plan = from_substrait_plan(&ctx, &proto).await?;
+ let plan_str = tpch_plan_to_string(17).await?;
+ assert_eq!(plan_str, "panics due to out of bounds field access");
Ok(())
}
#[tokio::test]
async fn tpch_test_18() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/orders.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/lineitem.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_18.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_0.c_name AS C_NAME, FILENAME_PLACEHOLDER_0.c_custkey AS C_CUSTKEY, FILENAME_PLACEHOLDER_1.o_orderkey AS O_ORDERKEY, FILENAME_PLACEHOLDER_1.o_orderdate AS O_ORDERDATE, FILENAME_PLACEHOLDER_1.o_totalprice AS O_TOTALPRICE, sum(FILENAME_PLACEHOLDER_2.l_quantity) AS EXPR$5\
- \n Limit: skip=0, fetch=100\
- \n Sort: FILENAME_PLACEHOLDER_1.o_totalprice DESC NULLS FIRST, FILENAME_PLACEHOLDER_1.o_orderdate ASC NULLS LAST\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.c_name, FILENAME_PLACEHOLDER_0.c_custkey, FILENAME_PLACEHOLDER_1.o_orderkey, FILENAME_PLACEHOLDER_1.o_orderdate, FILENAME_PLACEHOLDER_1.o_totalprice]], aggr=[[sum(FILENAME_PLACEHOLDER_2.l_quantity)]]\
- \n Projection: FILENAME_PLACEHOLDER_0.c_name, FILENAME_PLACEHOLDER_0.c_custkey, FILENAME_PLACEHOLDER_1.o_orderkey, FILENAME_PLACEHOLDER_1.o_orderdate, FILENAME_PLACEHOLDER_1.o_totalprice, FILENAME_PLACEHOLDER_2.l_quantity\
- \n Filter: CAST(FILENAME_PLACEHOLDER_1.o_orderkey IN (<subquery>) AS Boolean) AND FILENAME_PLACEHOLDER_0.c_custkey = FILENAME_PLACEHOLDER_1.o_custkey AND FILENAME_PLACEHOLDER_1.o_orderkey = FILENAME_PLACEHOLDER_2.l_orderkey\
- \n Subquery:\
- \n Projection: FILENAME_PLACEHOLDER_3.l_orderkey\
- \n Filter: sum(FILENAME_PLACEHOLDER_3.l_quantity) > CAST(Int32(300) AS Decimal128(19, 0))\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_3.l_orderkey]], aggr=[[sum(FILENAME_PLACEHOLDER_3.l_quantity)]]\
- \n Projection: FILENAME_PLACEHOLDER_3.l_orderkey, FILENAME_PLACEHOLDER_3.l_quantity\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[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]\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[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]");
+ let plan_str = tpch_plan_to_string(18).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: CUSTOMER.C_NAME, CUSTOMER.C_CUSTKEY, ORDERS.O_ORDERKEY, ORDERS.O_ORDERDATE, ORDERS.O_TOTALPRICE, sum(LINEITEM.L_QUANTITY) AS EXPR$5\
+ \n Limit: skip=0, fetch=100\
+ \n Sort: ORDERS.O_TOTALPRICE DESC NULLS FIRST, ORDERS.O_ORDERDATE ASC NULLS LAST\
+ \n Aggregate: groupBy=[[CUSTOMER.C_NAME, CUSTOMER.C_CUSTKEY, ORDERS.O_ORDERKEY, ORDERS.O_ORDERDATE, ORDERS.O_TOTALPRICE]], aggr=[[sum(LINEITEM.L_QUANTITY)]]\
+ \n Projection: CUSTOMER.C_NAME, CUSTOMER.C_CUSTKEY, ORDERS.O_ORDERKEY, ORDERS.O_ORDERDATE, ORDERS.O_TOTALPRICE, LINEITEM.L_QUANTITY\
+ \n Filter: ORDERS.O_ORDERKEY IN (<subquery>) AND CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY AND ORDERS.O_ORDERKEY = LINEITEM.L_ORDERKEY\
+ \n Subquery:\
+ \n Projection: LINEITEM.L_ORDERKEY\
+ \n Filter: sum(LINEITEM.L_QUANTITY) > CAST(Int32(300) AS Decimal128(15, 2))\
+ \n Aggregate: groupBy=[[LINEITEM.L_ORDERKEY]], aggr=[[sum(LINEITEM.L_QUANTITY)]]\
+ \n Projection: LINEITEM.L_ORDERKEY, LINEITEM.L_QUANTITY\
+ \n TableScan: LINEITEM projection=[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]\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]\
+ \n TableScan: LINEITEM projection=[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]"
+ );
Ok(())
}
#[tokio::test]
async fn tpch_test_19() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/part.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_19.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Aggregate: groupBy=[[]], aggr=[[sum(FILENAME_PLACEHOLDER_0.l_extendedprice * Int32(1) - FILENAME_PLACEHOLDER_0.l_discount) AS REVENUE]]\n Projection: FILENAME_PLACEHOLDER_0.l_extendedprice * (CAST(Int32(1) AS Decimal128(19, 0)) - FILENAME_PLACEHOLDER_0.l_discount)\
- \n Filter: FILENAME_PLACEHOLDER_1.p_partkey = FILENAME_PLACEHOLDER_0.l_partkey AND FILENAME_PLACEHOLDER_1.p_brand = CAST(Utf8(\"Brand#12\") AS Utf8) AND (FILENAME_PLACEHOLDER_1.p_container = Utf8(\"SM CASE\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"SM BOX\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"SM PACK\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"SM PKG\")) AND FILENAME_PLACEHOLDER_0.l_quantity >= CAST(Int32(1) AS Decimal128(19, 0)) AND FILENAME_PLACEHOLDER_0.l_quantity <= CAST(Int32(1) + Int32(10) AS Decimal128(19, 0)) AND FILENAME_PLACEHOLDER_1.p_size >= Int32(1) AND FILENAME_PLACEHOLDER_1.p_size <= Int32(5) AND (FILENAME_PLACEHOLDER_0.l_shipmode = Utf8(\"AIR\") OR FILENAME_PLACEHOLDER_0.l_shipmode = Utf8(\"AIR REG\")) AND FILENAME_PLACEHOLDER_0.l_shipinstruct = CAST(Utf8(\"DELIVER IN PERSON\") AS Utf8) OR FILENAME_PLACEHOLDER_1.p_partkey = FILENAME_PLACEHOLDER_0.l_partkey AND FILENAME_PLACEHOLDER_1.p_brand = CAST(Utf8(\"Brand#23\") AS Utf8) AND (FILENAME_PLACEHOLDER_1.p_container = Utf8(\"MED BAG\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"MED BOX\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"MED PKG\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"MED PACK\")) AND FILENAME_PLACEHOLDER_0.l_quantity >= CAST(Int32(10) AS Decimal128(19, 0)) AND FILENAME_PLACEHOLDER_0.l_quantity <= CAST(Int32(10) + Int32(10) AS Decimal128(19, 0)) AND FILENAME_PLACEHOLDER_1.p_size >= Int32(1) AND FILENAME_PLACEHOLDER_1.p_size <= Int32(10) AND (FILENAME_PLACEHOLDER_0.l_shipmode = Utf8(\"AIR\") OR FILENAME_PLACEHOLDER_0.l_shipmode = Utf8(\"AIR REG\")) AND FILENAME_PLACEHOLDER_0.l_shipinstruct = CAST(Utf8(\"DELIVER IN PERSON\") AS Utf8) OR FILENAME_PLACEHOLDER_1.p_partkey = FILENAME_PLACEHOLDER_0.l_partkey AND FILENAME_PLACEHOLDER_1.p_brand = CAST(Utf8(\"Brand#34\") AS Utf8) AND (FILENAME_PLACEHOLDER_1.p_container = Utf8(\"LG CASE\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"LG BOX\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"LG PACK\") OR FILENAME_PLACEHOLDER_1.p_container = Utf8(\"LG PKG\")) AND FILENAME_PLACEHOLDER_0.l_quantity >= CAST(Int32(20) AS Decimal128(19, 0)) AND FILENAME_PLACEHOLDER_0.l_quantity <= CAST(Int32(20) + Int32(10) AS Decimal128(19, 0)) AND FILENAME_PLACEHOLDER_1.p_size >= Int32(1) AND FILENAME_PLACEHOLDER_1.p_size <= Int32(15) AND (FILENAME_PLACEHOLDER_0.l_shipmode = Utf8(\"AIR\") OR FILENAME_PLACEHOLDER_0.l_shipmode = Utf8(\"AIR REG\")) AND FILENAME_PLACEHOLDER_0.l_shipinstruct = CAST(Utf8(\"DELIVER IN PERSON\") AS Utf8)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[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]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[p_partkey, p_name, p_mfgr, p_brand, p_type, p_size, p_container, p_retailprice, p_comment]");
+ let plan_str = tpch_plan_to_string(19).await?;
+ assert_eq!(
+ plan_str,
+ "Aggregate: groupBy=[[]], aggr=[[sum(LINEITEM.L_EXTENDEDPRICE * Int32(1) - LINEITEM.L_DISCOUNT) AS REVENUE]]\
+ \n Projection: LINEITEM.L_EXTENDEDPRICE * (CAST(Int32(1) AS Decimal128(15, 2)) - LINEITEM.L_DISCOUNT)\
+ \n Filter: PART.P_PARTKEY = LINEITEM.L_PARTKEY AND PART.P_BRAND = Utf8(\"Brand#12\") AND (PART.P_CONTAINER = CAST(Utf8(\"SM CASE\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"SM BOX\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"SM PACK\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"SM PKG\") AS Utf8)) AND LINEITEM.L_QUANTITY >= CAST(Int32(1) AS Decimal128(15, 2)) AND LINEITEM.L_QUANTITY <= CAST(Int32(1) + Int32(10) AS Decimal128(15, 2)) AND PART.P_SIZE >= Int32(1) AND PART.P_SIZE <= Int32(5) AND (LINEITEM.L_SHIPMODE = CAST(Utf8(\"AIR\") AS Utf8) OR LINEITEM.L_SHIPMODE = CAST(Utf8(\"AIR REG\") AS Utf8)) AND LINEITEM.L_SHIPINSTRUCT = Utf8(\"DELIVER IN PERSON\") OR PART.P_PARTKEY = LINEITEM.L_PARTKEY AND PART.P_BRAND = Utf8(\"Brand#23\") AND (PART.P_CONTAINER = CAST(Utf8(\"MED BAG\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"MED BOX\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"MED PKG\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"MED PACK\") AS Utf8)) AND LINEITEM.L_QUANTITY >= CAST(Int32(10) AS Decimal128(15, 2)) AND LINEITEM.L_QUANTITY <= CAST(Int32(10) + Int32(10) AS Decimal128(15, 2)) AND PART.P_SIZE >= Int32(1) AND PART.P_SIZE <= Int32(10) AND (LINEITEM.L_SHIPMODE = CAST(Utf8(\"AIR\") AS Utf8) OR LINEITEM.L_SHIPMODE = CAST(Utf8(\"AIR REG\") AS Utf8)) AND LINEITEM.L_SHIPINSTRUCT = Utf8(\"DELIVER IN PERSON\") OR PART.P_PARTKEY = LINEITEM.L_PARTKEY AND PART.P_BRAND = Utf8(\"Brand#34\") AND (PART.P_CONTAINER = CAST(Utf8(\"LG CASE\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"LG BOX\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"LG PACK\") AS Utf8) OR PART.P_CONTAINER = CAST(Utf8(\"LG PKG\") AS Utf8)) AND LINEITEM.L_QUANTITY >= CAST(Int32(20) AS Decimal128(15, 2)) AND LINEITEM.L_QUANTITY <= CAST(Int32(20) + Int32(10) AS Decimal128(15, 2)) AND PART.P_SIZE >= Int32(1) AND PART.P_SIZE <= Int32(15) AND (LINEITEM.L_SHIPMODE = CAST(Utf8(\"AIR\") AS Utf8) OR LINEITEM.L_SHIPMODE = CAST(Utf8(\"AIR REG\") AS Utf8)) AND LINEITEM.L_SHIPINSTRUCT = Utf8(\"DELIVER IN PERSON\")\
+ \n CrossJoin:\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: PART projection=[P_PARTKEY, P_NAME, P_MFGR, P_BRAND, P_TYPE, P_SIZE, P_CONTAINER, P_RETAILPRICE, P_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
async fn tpch_test_20() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/supplier.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/nation.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/partsupp.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/part.csv"),
- ("FILENAME_PLACEHOLDER_4", "tests/testdata/tpch/lineitem.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_20.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_0.s_name AS S_NAME, FILENAME_PLACEHOLDER_0.s_address AS S_ADDRESS\
- \n Sort: FILENAME_PLACEHOLDER_0.s_name ASC NULLS LAST\
- \n Projection: FILENAME_PLACEHOLDER_0.s_name, FILENAME_PLACEHOLDER_0.s_address\
- \n Filter: CAST(FILENAME_PLACEHOLDER_0.s_suppkey IN (<subquery>) AS Boolean) AND FILENAME_PLACEHOLDER_0.s_nationkey = FILENAME_PLACEHOLDER_1.N_NATIONKEY AND FILENAME_PLACEHOLDER_1.N_NAME = CAST(Utf8(\"CANADA\") AS Utf8)\
- \n Subquery:\
- \n Projection: FILENAME_PLACEHOLDER_2.ps_suppkey\
- \n Filter: CAST(FILENAME_PLACEHOLDER_2.ps_partkey IN (<subquery>) AS Boolean) AND CAST(FILENAME_PLACEHOLDER_2.ps_availqty AS Decimal128(19, 1)) > (<subquery>)\
- \n Subquery:\
- \n Projection: FILENAME_PLACEHOLDER_3.p_partkey\
- \n Filter: FILENAME_PLACEHOLDER_3.p_name LIKE CAST(Utf8(\"forest%\") AS Utf8)\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[p_partkey, p_name, p_mfgr, p_brand, p_type, p_size, p_container, p_retailprice, p_comment]\
- \n Subquery:\
- \n Projection: Decimal128(Some(5),2,1) * sum(FILENAME_PLACEHOLDER_4.l_quantity)\
- \n Aggregate: groupBy=[[]], aggr=[[sum(FILENAME_PLACEHOLDER_4.l_quantity)]]\
- \n Projection: FILENAME_PLACEHOLDER_4.l_quantity\
- \n Filter: FILENAME_PLACEHOLDER_4.l_partkey = FILENAME_PLACEHOLDER_4.l_orderkey AND FILENAME_PLACEHOLDER_4.l_suppkey = FILENAME_PLACEHOLDER_4.l_partkey AND FILENAME_PLACEHOLDER_4.l_shipdate >= CAST(Utf8(\"1994-01-01\") AS Date32) AND FILENAME_PLACEHOLDER_4.l_shipdate < CAST(Utf8(\"1995-01-01\") AS Date32)\
- \n TableScan: FILENAME_PLACEHOLDER_4 projection=[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]\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[ps_partkey, ps_suppkey, ps_availqty, ps_supplycost, ps_comment]\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]");
+ let plan_str = tpch_plan_to_string(20).await?;
+ assert_eq!(
+ plan_str,
+ "Sort: SUPPLIER.S_NAME ASC NULLS LAST\
+ \n Projection: SUPPLIER.S_NAME, SUPPLIER.S_ADDRESS\
+ \n Filter: SUPPLIER.S_SUPPKEY IN (<subquery>) AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_NAME = Utf8(\"CANADA\")\
+ \n Subquery:\
+ \n Projection: PARTSUPP.PS_SUPPKEY\
+ \n Filter: PARTSUPP.PS_PARTKEY IN (<subquery>) AND CAST(PARTSUPP.PS_AVAILQTY AS Decimal128(19, 0)) > (<subquery>)\
+ \n Subquery:\
+ \n Projection: PART.P_PARTKEY\
+ \n Filter: PART.P_NAME LIKE CAST(Utf8(\"forest%\") AS Utf8)\
+ \n TableScan: PART projection=[P_PARTKEY, P_NAME, P_MFGR, P_BRAND, P_TYPE, P_SIZE, P_CONTAINER, P_RETAILPRICE, P_COMMENT]\
+ \n Subquery:\
+ \n Projection: Decimal128(Some(5),2,1) * sum(LINEITEM.L_QUANTITY)\
+ \n Aggregate: groupBy=[[]], aggr=[[sum(LINEITEM.L_QUANTITY)]]\
+ \n Projection: LINEITEM.L_QUANTITY\
+ \n Filter: LINEITEM.L_PARTKEY = LINEITEM.L_ORDERKEY AND LINEITEM.L_SUPPKEY = LINEITEM.L_PARTKEY AND LINEITEM.L_SHIPDATE >= CAST(Utf8(\"1994-01-01\") AS Date32) AND LINEITEM.L_SHIPDATE < CAST(Utf8(\"1995-01-01\") AS Date32)\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: PARTSUPP projection=[PS_PARTKEY, PS_SUPPKEY, PS_AVAILQTY, PS_SUPPLYCOST, PS_COMMENT]\
+ \n CrossJoin:\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
async fn tpch_test_21() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/supplier.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/orders.csv"),
- ("FILENAME_PLACEHOLDER_3", "tests/testdata/tpch/nation.csv"),
- ("FILENAME_PLACEHOLDER_4", "tests/testdata/tpch/lineitem.csv"),
- ("FILENAME_PLACEHOLDER_5", "tests/testdata/tpch/lineitem.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_21.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: FILENAME_PLACEHOLDER_0.s_name AS S_NAME, count(Int64(1)) AS NUMWAIT\
- \n Limit: skip=0, fetch=100\
- \n Sort: count(Int64(1)) DESC NULLS FIRST, FILENAME_PLACEHOLDER_0.s_name ASC NULLS LAST\
- \n Aggregate: groupBy=[[FILENAME_PLACEHOLDER_0.s_name]], aggr=[[count(Int64(1))]]\
- \n Projection: FILENAME_PLACEHOLDER_0.s_name\
- \n Filter: FILENAME_PLACEHOLDER_0.s_suppkey = FILENAME_PLACEHOLDER_1.l_suppkey AND FILENAME_PLACEHOLDER_2.o_orderkey = FILENAME_PLACEHOLDER_1.l_orderkey AND FILENAME_PLACEHOLDER_2.o_orderstatus = Utf8(\"F\") AND FILENAME_PLACEHOLDER_1.l_receiptdate > FILENAME_PLACEHOLDER_1.l_commitdate AND EXISTS (<subquery>) AND NOT EXISTS (<subquery>) AND FILENAME_PLACEHOLDER_0.s_nationkey = FILENAME_PLACEHOLDER_3.N_NATIONKEY AND FILENAME_PLACEHOLDER_3.N_NAME = CAST(Utf8(\"SAUDI ARABIA\") AS Utf8)\
- \n Subquery:\
- \n Filter: FILENAME_PLACEHOLDER_4.l_orderkey = FILENAME_PLACEHOLDER_4.l_tax AND FILENAME_PLACEHOLDER_4.l_suppkey != FILENAME_PLACEHOLDER_4.l_linestatus\
- \n TableScan: FILENAME_PLACEHOLDER_4 projection=[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]\
- \n Subquery:\
- \n Filter: FILENAME_PLACEHOLDER_5.l_orderkey = FILENAME_PLACEHOLDER_5.l_tax AND FILENAME_PLACEHOLDER_5.l_suppkey != FILENAME_PLACEHOLDER_5.l_linestatus AND FILENAME_PLACEHOLDER_5.l_receiptdate > FILENAME_PLACEHOLDER_5.l_commitdate\
- \n TableScan: FILENAME_PLACEHOLDER_5 projection=[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]\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n Inner Join: Filter: Boolean(true)\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[s_suppkey, s_name, s_address, s_nationkey, s_phone, s_acctbal, s_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[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]\n TableScan: FILENAME_PLACEHOLDER_2 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_3 projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]");
+ let plan_str = tpch_plan_to_string(21).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: SUPPLIER.S_NAME, count(Int64(1)) AS NUMWAIT\
+ \n Limit: skip=0, fetch=100\
+ \n Sort: count(Int64(1)) DESC NULLS FIRST, SUPPLIER.S_NAME ASC NULLS LAST\
+ \n Aggregate: groupBy=[[SUPPLIER.S_NAME]], aggr=[[count(Int64(1))]]\
+ \n Projection: SUPPLIER.S_NAME\
+ \n Filter: SUPPLIER.S_SUPPKEY = LINEITEM.L_SUPPKEY AND ORDERS.O_ORDERKEY = LINEITEM.L_ORDERKEY AND ORDERS.O_ORDERSTATUS = Utf8(\"F\") AND LINEITEM.L_RECEIPTDATE > LINEITEM.L_COMMITDATE AND EXISTS (<subquery>) AND NOT EXISTS (<subquery>) AND SUPPLIER.S_NATIONKEY = NATION.N_NATIONKEY AND NATION.N_NAME = Utf8(\"SAUDI ARABIA\")\
+ \n Subquery:\
+ \n Filter: LINEITEM.L_ORDERKEY = LINEITEM.L_TAX AND LINEITEM.L_SUPPKEY != LINEITEM.L_LINESTATUS\
+ \n TableScan: LINEITEM projection=[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]\
+ \n Subquery:\
+ \n Filter: LINEITEM.L_ORDERKEY = LINEITEM.L_TAX AND LINEITEM.L_SUPPKEY != LINEITEM.L_LINESTATUS AND LINEITEM.L_RECEIPTDATE > LINEITEM.L_COMMITDATE\
+ \n TableScan: LINEITEM projection=[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]\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n CrossJoin:\
+ \n TableScan: SUPPLIER projection=[S_SUPPKEY, S_NAME, S_ADDRESS, S_NATIONKEY, S_PHONE, S_ACCTBAL, S_COMMENT]\
+ \n TableScan: LINEITEM projection=[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]\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]\
+ \n TableScan: NATION projection=[N_NATIONKEY, N_NAME, N_REGIONKEY, N_COMMENT]"
+ );
Ok(())
}
#[tokio::test]
async fn tpch_test_22() -> Result<()> {
- let ctx = create_context(vec![
- ("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_1", "tests/testdata/tpch/customer.csv"),
- ("FILENAME_PLACEHOLDER_2", "tests/testdata/tpch/orders.csv"),
- ])
- .await?;
- let path = "tests/testdata/tpch_substrait_plans/query_22.json";
- let proto = serde_json::from_reader::<_, Plan>(BufReader::new(
- File::open(path).expect("file not found"),
- ))
- .expect("failed to parse json");
-
- let plan = from_substrait_plan(&ctx, &proto).await?;
- let plan_str = format!("{}", plan);
- assert_eq!(plan_str, "Projection: substr(FILENAME_PLACEHOLDER_0.c_phone,Int32(1),Int32(2)) AS CNTRYCODE, count(Int64(1)) AS NUMCUST, sum(FILENAME_PLACEHOLDER_0.c_acctbal) AS TOTACCTBAL\n Sort: substr(FILENAME_PLACEHOLDER_0.c_phone,Int32(1),Int32(2)) ASC NULLS LAST\
- \n Aggregate: groupBy=[[substr(FILENAME_PLACEHOLDER_0.c_phone,Int32(1),Int32(2))]], aggr=[[count(Int64(1)), sum(FILENAME_PLACEHOLDER_0.c_acctbal)]]\
- \n Projection: substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)), FILENAME_PLACEHOLDER_0.c_acctbal\
- \n Filter: (substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"13\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"31\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"23\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"29\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"30\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"18\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_0.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"17\") AS Utf8)) AND FILENAME_PLACEHOLDER_0.c_acctbal > (<subquery>) AND NOT EXISTS (<subquery>)\
- \n Subquery:\
- \n Aggregate: groupBy=[[]], aggr=[[avg(FILENAME_PLACEHOLDER_1.c_acctbal)]]\
- \n Projection: FILENAME_PLACEHOLDER_1.c_acctbal\
- \n Filter: FILENAME_PLACEHOLDER_1.c_acctbal > Decimal128(Some(0),3,2) AND (substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"13\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"31\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"23\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"29\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"30\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"18\") AS Utf8) OR substr(FILENAME_PLACEHOLDER_1.c_phone, Int32(1), Int32(2)) = CAST(Utf8(\"17\") AS Utf8))\
- \n TableScan: FILENAME_PLACEHOLDER_1 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]\n Subquery:\
- \n Filter: FILENAME_PLACEHOLDER_2.o_custkey = FILENAME_PLACEHOLDER_2.o_orderkey\
- \n TableScan: FILENAME_PLACEHOLDER_2 projection=[o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment]\
- \n TableScan: FILENAME_PLACEHOLDER_0 projection=[c_custkey, c_name, c_address, c_nationkey, c_phone, c_acctbal, c_mktsegment, c_comment]");
+ let plan_str = tpch_plan_to_string(22).await?;
+ assert_eq!(
+ plan_str,
+ "Projection: substr(CUSTOMER.C_PHONE,Int32(1),Int32(2)) AS CNTRYCODE, count(Int64(1)) AS NUMCUST, sum(CUSTOMER.C_ACCTBAL) AS TOTACCTBAL\
+ \n Sort: substr(CUSTOMER.C_PHONE,Int32(1),Int32(2)) ASC NULLS LAST\
+ \n Aggregate: groupBy=[[substr(CUSTOMER.C_PHONE,Int32(1),Int32(2))]], aggr=[[count(Int64(1)), sum(CUSTOMER.C_ACCTBAL)]]\
+ \n Projection: substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)), CUSTOMER.C_ACCTBAL\
+ \n Filter: (substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"13\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"31\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"23\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"29\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"30\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"18\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"17\") AS Utf8)) AND CUSTOMER.C_ACCTBAL > (<subquery>) AND NOT EXISTS (<subquery>)\
+ \n Subquery:\
+ \n Aggregate: groupBy=[[]], aggr=[[avg(CUSTOMER.C_ACCTBAL)]]\
+ \n Projection: CUSTOMER.C_ACCTBAL\
+ \n Filter: CUSTOMER.C_ACCTBAL > Decimal128(Some(0),3,2) AND (substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"13\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"31\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"23\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"29\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"30\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"18\") AS Utf8) OR substr(CUSTOMER.C_PHONE, Int32(1), Int32(2)) = CAST(Utf8(\"17\") AS Utf8))\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]\
+ \n Subquery:\
+ \n Filter: ORDERS.O_CUSTKEY = ORDERS.O_ORDERKEY\
+ \n TableScan: ORDERS projection=[O_ORDERKEY, O_CUSTKEY, O_ORDERSTATUS, O_TOTALPRICE, O_ORDERDATE, O_ORDERPRIORITY, O_CLERK, O_SHIPPRIORITY, O_COMMENT]\
+ \n TableScan: CUSTOMER projection=[C_CUSTKEY, C_NAME, C_ADDRESS, C_NATIONKEY, C_PHONE, C_ACCTBAL, C_MKTSEGMENT, C_COMMENT]"
+ );
Ok(())
}
}
diff --git a/datafusion/substrait/tests/cases/function_test.rs b/datafusion/substrait/tests/cases/function_test.rs
index 85809da6f3..5806b55d84 100644
--- a/datafusion/substrait/tests/cases/function_test.rs
+++ b/datafusion/substrait/tests/cases/function_test.rs
@@ -28,7 +28,7 @@ mod tests {
#[tokio::test]
async fn contains_function_test() -> Result<()> {
let proto_plan = read_json("tests/testdata/contains_plan.substrait.json");
- let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
+ let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;
let plan_str = format!("{}", plan);
diff --git a/datafusion/substrait/tests/cases/logical_plans.rs b/datafusion/substrait/tests/cases/logical_plans.rs
index 8db2aa283d..6794b32838 100644
--- a/datafusion/substrait/tests/cases/logical_plans.rs
+++ b/datafusion/substrait/tests/cases/logical_plans.rs
@@ -37,7 +37,7 @@ mod tests {
// ./isthmus-cli/build/graal/isthmus --create "create table data (d boolean)" "select not d from data"
let proto_plan =
read_json("tests/testdata/test_plans/select_not_bool.substrait.json");
- let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
+ let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;
assert_eq!(
@@ -62,7 +62,7 @@ mod tests {
// ./isthmus-cli/build/graal/isthmus --create "create table data (d int, part int, ord int)" "select sum(d) OVER (PARTITION BY part ORDER BY ord ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) AS lead_expr from data"
let proto_plan =
read_json("tests/testdata/test_plans/select_window.substrait.json");
- let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
+ let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;
assert_eq!(
@@ -81,7 +81,7 @@ mod tests {
// This test confirms that reading a plan with non-nullable lists works as expected.
let proto_plan =
read_json("tests/testdata/test_plans/non_nullable_lists.substrait.json");
- let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
+ let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;
assert_eq!(format!("{}", &plan), "Values: (List([1, 2]))");
diff --git a/datafusion/substrait/tests/testdata/tpch/customer.csv b/datafusion/substrait/tests/testdata/tpch/customer.csv
deleted file mode 100644
index ed15da17d4..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/customer.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-c_custkey,c_name,c_address,c_nationkey,c_phone,c_acctbal,c_mktsegment,c_comment
-1,Customer#000000001,Address1,1,123-456-7890,5000.00,BUILDING,No comment
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/lineitem.csv b/datafusion/substrait/tests/testdata/tpch/lineitem.csv
deleted file mode 100644
index 192ba86d7a..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/lineitem.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-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
-1,1,1,1,17,21168.23,0.04,0.02,'N','O','1996-03-13','1996-02-12','1996-03-22','DELIVER IN PERSON','TRUCK','egular courts above the'
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/nation.csv b/datafusion/substrait/tests/testdata/tpch/nation.csv
deleted file mode 100644
index a88d1c0d31..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/nation.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-N_NATIONKEY,N_NAME,N_REGIONKEY,N_COMMENT
-0,ALGERIA,0, haggle. carefully final deposits detect slyly agai
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/orders.csv b/datafusion/substrait/tests/testdata/tpch/orders.csv
deleted file mode 100644
index b9abea3cbb..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/orders.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-o_orderkey,o_custkey,o_orderstatus,o_totalprice,o_orderdate,o_orderpriority,o_clerk,o_shippriority,o_comment
-1,1,O,1000.00,2023-01-01,5-LOW,Clerk#000000001,0,No comment
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/part.csv b/datafusion/substrait/tests/testdata/tpch/part.csv
deleted file mode 100644
index ef6d042711..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/part.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-p_partkey,p_name,p_mfgr,p_brand,p_type,p_size,p_container,p_retailprice,p_comment
-1,pink powder puff,Manufacturer#1,Brand#13,SMALL PLATED COPPER,7,JUMBO PKG,901.00,ly final dependencies: slyly bold
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/partsupp.csv b/datafusion/substrait/tests/testdata/tpch/partsupp.csv
deleted file mode 100644
index 5c585abc77..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/partsupp.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-ps_partkey,ps_suppkey,ps_availqty,ps_supplycost,ps_comment
-1,1,1000,50.00,slyly final packages boost against the slyly regular
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/region.csv b/datafusion/substrait/tests/testdata/tpch/region.csv
deleted file mode 100644
index d29c39ab85..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/region.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-R_REGIONKEY,R_NAME,R_COMMENT
-0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch/supplier.csv b/datafusion/substrait/tests/testdata/tpch/supplier.csv
deleted file mode 100644
index f73d2cbeaf..0000000000
--- a/datafusion/substrait/tests/testdata/tpch/supplier.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-s_suppkey,s_name,s_address,s_nationkey,s_phone,s_acctbal,s_comment
-1,Supplier#1,123 Main St,0,555-1234,1000.00,No comments
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_01_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_01_plan.json
new file mode 100644
index 0000000000..3738a50a62
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_01_plan.json
@@ -0,0 +1,723 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 3,
+ "uri": "/functions_aggregate_generic.yaml"
+ }, {
+ "extensionUriAnchor": 2,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_datetime.yaml"
+ }],
+ "extensions": [{
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "name": "lte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 1,
+ "name": "subtract:date_iday"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 2,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 3,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 4,
+ "name": "add:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 5,
+ "name": "sum:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 6,
+ "name": "avg:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 7,
+ "name": "count:"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [16, 17, 18, 19, 20, 21, 22]
+ }
+ },
+ "input": {
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "date": 10561
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "intervalDayToSecond": {
+ "seconds": 10368
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "decimal": {
+ "scale": 6,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 6,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL"
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["L_RETURNFLAG", "L_LINESTATUS", "SUM_QTY", "SUM_BASE_PRICE", "SUM_DISC_PRICE", "SUM_CHARGE", "AVG_QTY", "AVG_PRICE", "AVG_DISC", "COUNT_ORDER"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_02_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_02_plan.json
new file mode 100644
index 0000000000..f6c5e802a5
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_02_plan.json
@@ -0,0 +1,1157 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_string.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.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": 3,
+ "functionAnchor": 2,
+ "name": "like:str_str"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 3,
+ "name": "min:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "fetch": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [28, 29, 30, 31, 32, 33, 34, 35]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["PS_PARTKEY", "PS_SUPPKEY", "PS_AVAILQTY", "PS_SUPPLYCOST", "PS_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PARTSUPP"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["R_REGIONKEY", "R_NAME", "R_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["REGION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 15
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "%BRASS"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 25
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 26
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "EUROPE"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "subquery": {
+ "scalar": {
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [19]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["PS_PARTKEY", "PS_SUPPKEY", "PS_AVAILQTY", "PS_SUPPLYCOST", "PS_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PARTSUPP"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["R_REGIONKEY", "R_NAME", "R_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["REGION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "EUROPE"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 3,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 11
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 15
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "count": "100"
+ }
+ },
+ "names": ["S_ACCTBAL", "S_NAME", "N_NAME", "P_PARTKEY", "P_MFGR", "S_ADDRESS", "S_PHONE", "S_COMMENT"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_3.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_03_plan.json
similarity index 67%
rename from datafusion/substrait/tests/testdata/tpch_substrait_plans/query_3.json
rename to datafusion/substrait/tests/testdata/tpch_substrait_plans/query_03_plan.json
index 4ca074d2e8..d4dea1d03c 100644
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_3.json
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_03_plan.json
@@ -15,14 +15,13 @@
"extensions": [{
"extensionFunction": {
"extensionUriReference": 1,
- "functionAnchor": 0,
"name": "and:bool"
}
}, {
"extensionFunction": {
"extensionUriReference": 2,
"functionAnchor": 1,
- "name": "equal:any1_any1"
+ "name": "equal:any_any"
}
}, {
"extensionFunction": {
@@ -40,19 +39,19 @@
"extensionFunction": {
"extensionUriReference": 4,
"functionAnchor": 4,
- "name": "multiply:opt_decimal_decimal"
+ "name": "multiply:dec_dec"
}
}, {
"extensionFunction": {
"extensionUriReference": 4,
"functionAnchor": 5,
- "name": "subtract:opt_decimal_decimal"
+ "name": "subtract:dec_dec"
}
}, {
"extensionFunction": {
"extensionUriReference": 4,
"functionAnchor": 6,
- "name": "sum:opt_decimal"
+ "name": "sum:dec"
}
}],
"relations": [{
@@ -96,13 +95,13 @@
}
},
"input": {
- "join": {
+ "cross": {
"common": {
"direct": {
}
},
"left": {
- "join": {
+ "cross": {
"common": {
"direct": {
}
@@ -114,67 +113,86 @@
}
},
"baseSchema": {
- "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"],
+ "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": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "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"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["LINEITEM"]
}
}
},
@@ -185,82 +203,51 @@
}
},
"baseSchema": {
- "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"],
+ "names": ["C_CUSTKEY", "C_NAME", "C_ADDRESS", "C_NATIONKEY", "C_PHONE", "C_ACCTBAL", "C_MKTSEGMENT", "C_COMMENT"],
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i64": {
- "typeVariationReference": 0,
+ "string": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["CUSTOMER"]
}
}
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
+ }
}
},
"right": {
@@ -270,145 +257,71 @@
}
},
"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"],
+ "names": ["O_ORDERKEY", "O_CUSTKEY", "O_ORDERSTATUS", "O_TOTALPRICE", "O_ORDERDATE", "O_ORDERPRIORITY", "O_CLERK", "O_SHIPPRIORITY", "O_COMMENT"],
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i64": {
- "typeVariationReference": 0,
+ "string": {
"nullability": "NULLABILITY_REQUIRED"
}
- }, {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["ORDERS"]
}
}
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
+ }
}
},
"condition": {
"scalarFunction": {
- "functionReference": 0,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -416,7 +329,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 6
+ "field": 22
}
},
"rootReference": {
@@ -425,22 +338,8 @@
}
}, {
"value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "HOUSEHOLD",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "literal": {
+ "string": "BUILDING"
}
}
}]
@@ -450,10 +349,8 @@
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -462,7 +359,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
+ "field": 16
}
},
"rootReference": {
@@ -474,7 +371,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 9
+ "field": 25
}
},
"rootReference": {
@@ -488,10 +385,8 @@
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -500,7 +395,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 17
}
},
"rootReference": {
@@ -512,7 +406,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 8
+ "field": 24
}
},
"rootReference": {
@@ -526,11 +420,9 @@
"value": {
"scalarFunction": {
"functionReference": 2,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -538,7 +430,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 12
+ "field": 28
}
},
"rootReference": {
@@ -547,10 +439,18 @@
}
}, {
"value": {
- "literal": {
- "date": 9214,
- "nullable": false,
- "typeVariationReference": 0
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-03-15"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}]
@@ -560,11 +460,9 @@
"value": {
"scalarFunction": {
"functionReference": 3,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -572,7 +470,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 27
+ "field": 10
}
},
"rootReference": {
@@ -581,10 +479,18 @@
}
}, {
"value": {
- "literal": {
- "date": 9214,
- "nullable": false,
- "typeVariationReference": 0
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-03-15"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}]
@@ -599,7 +505,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 17
}
},
"rootReference": {
@@ -609,7 +514,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 12
+ "field": 28
}
},
"rootReference": {
@@ -619,7 +524,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 15
+ "field": 31
}
},
"rootReference": {
@@ -628,13 +533,11 @@
}, {
"scalarFunction": {
"functionReference": 4,
- "args": [],
"outputType": {
"decimal": {
- "scale": 0,
+ "scale": 4,
"precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -642,7 +545,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 22
+ "field": 5
}
},
"rootReference": {
@@ -653,13 +556,11 @@
"value": {
"scalarFunction": {
"functionReference": 5,
- "args": [],
"outputType": {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -667,20 +568,17 @@
"cast": {
"type": {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"input": {
"literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
+ "i32": 1
}
},
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}, {
@@ -688,7 +586,7 @@
"selection": {
"directReference": {
"structField": {
- "field": 23
+ "field": 6
}
},
"rootReference": {
@@ -708,7 +606,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -739,14 +636,11 @@
"measures": [{
"measure": {
"functionReference": 6,
- "args": [],
- "sorts": [],
"phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
"outputType": {
"decimal": {
- "scale": 0,
+ "scale": 4,
"precision": 19,
- "typeVariationReference": 0,
"nullability": "NULLABILITY_NULLABLE"
}
},
@@ -772,7 +666,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -840,12 +733,10 @@
}]
}
},
- "offset": "0",
"count": "10"
}
},
"names": ["L_ORDERKEY", "REVENUE", "O_ORDERDATE", "O_SHIPPRIORITY"]
}
- }],
- "expectedTypeUrls": []
-}
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_4.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_04_plan.json
similarity index 73%
rename from datafusion/substrait/tests/testdata/tpch_substrait_plans/query_4.json
rename to datafusion/substrait/tests/testdata/tpch_substrait_plans/query_04_plan.json
index 6e946cefdd..3e665f50f3 100644
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_4.json
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_04_plan.json
@@ -15,7 +15,6 @@
"extensions": [{
"extensionFunction": {
"extensionUriReference": 1,
- "functionAnchor": 0,
"name": "and:bool"
}
}, {
@@ -34,13 +33,13 @@
"extensionFunction": {
"extensionUriReference": 3,
"functionAnchor": 3,
- "name": "equal:any1_any1"
+ "name": "equal:any_any"
}
}, {
"extensionFunction": {
"extensionUriReference": 4,
"functionAnchor": 4,
- "name": "count:opt"
+ "name": "count:"
}
}],
"relations": [{
@@ -81,89 +80,65 @@
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["ORDERS"]
}
}
},
"condition": {
"scalarFunction": {
- "functionReference": 0,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -183,18 +158,15 @@
"cast": {
"type": {
"date": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
"input": {
"literal": {
- "fixedChar": "1993-07-01",
- "nullable": false,
- "typeVariationReference": 0
+ "fixedChar": "1993-07-01"
}
},
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}]
@@ -204,11 +176,9 @@
"value": {
"scalarFunction": {
"functionReference": 2,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -228,18 +198,15 @@
"cast": {
"type": {
"date": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
"input": {
"literal": {
- "fixedChar": "1993-10-01",
- "nullable": false,
- "typeVariationReference": 0
+ "fixedChar": "1993-10-01"
}
},
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}]
@@ -267,130 +234,98 @@
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["LINEITEM"]
}
}
},
"condition": {
"scalarFunction": {
- "functionReference": 0,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
"value": {
"scalarFunction": {
"functionReference": 3,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -399,7 +334,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -411,7 +345,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"outerReference": {
@@ -426,11 +359,9 @@
"value": {
"scalarFunction": {
"functionReference": 2,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -491,7 +422,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -502,17 +432,13 @@
"measures": [{
"measure": {
"functionReference": 4,
- "args": [],
- "sorts": [],
"phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
"outputType": {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": []
+ "invocation": "AGGREGATION_INVOCATION_ALL"
}
}]
}
@@ -522,7 +448,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -535,6 +460,5 @@
},
"names": ["O_ORDERPRIORITY", "ORDER_COUNT"]
}
- }],
- "expectedTypeUrls": []
-}
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_05_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_05_plan.json
new file mode 100644
index 0000000000..d42975d332
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_05_plan.json
@@ -0,0 +1,912 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 3,
+ "functionAnchor": 2,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "lt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 4,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [47, 48]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["R_REGIONKEY", "R_NAME", "R_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["REGION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 33
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 36
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 36
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 40
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 42
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 44
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 45
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "ASIA"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1994-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 41
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }]
+ }
+ },
+ "names": ["N_NAME", "REVENUE"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_06_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_06_plan.json
new file mode 100644
index 0000000000..c26f2861e0
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_06_plan.json
@@ -0,0 +1,448 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 2,
+ "uri": "/functions_datetime.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_comparison.yaml"
+ }],
+ "extensions": [{
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "name": "and:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 1,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 2,
+ "name": "lt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "gte:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 4,
+ "name": "lte:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 5,
+ "name": "lt:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 7,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [16]
+ }
+ },
+ "input": {
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1994-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "BQAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 3,
+ "scale": 2
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "BwAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 3,
+ "scale": 2
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 24
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "names": ["REVENUE"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_07_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_07_plan.json
new file mode 100644
index 0000000000..82740fb3d8
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_07_plan.json
@@ -0,0 +1,1095 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 1,
+ "functionAnchor": 2,
+ "name": "or:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 4,
+ "name": "lte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 5,
+ "name": "extract:req_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 7,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 8,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [48, 49, 50, 51]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 32
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 24
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 40
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 35
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 44
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 41
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "FRANCE"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 45
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "GERMANY"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 41
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "GERMANY"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 45
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "FRANCE"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1996-12-31"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 41
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 45
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "enum": "YEAR"
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 7,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 8,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["SUPP_NATION", "CUST_NATION", "L_YEAR", "REVENUE"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_08_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_08_plan.json
new file mode 100644
index 0000000000..8c886f84ed
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_08_plan.json
@@ -0,0 +1,1301 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 3,
+ "functionAnchor": 2,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "lte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 4,
+ "name": "extract:req_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 7,
+ "name": "sum:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 8,
+ "name": "divide:dec_dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [3, 4]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [60, 61, 62]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["R_REGIONKEY", "R_NAME", "R_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["REGION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 18
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 32
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 33
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 41
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 44
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 49
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 51
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 57
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 58
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "AMERICA"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 53
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 36
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 36
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1996-12-31"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "ECONOMY ANODIZED STEEL"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "enum": "YEAR"
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 36
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "ifThen": {
+ "ifs": [{
+ "if": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 54
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "BRAZIL"
+ }
+ }
+ }]
+ }
+ },
+ "then": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }],
+ "else": {
+ "literal": {
+ "decimal": {
+ "value": "AAAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 19,
+ "scale": 4
+ }
+ }
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 8,
+ "outputType": {
+ "decimal": {
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["O_YEAR", "MKT_SHARE"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_09_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_09_plan.json
new file mode 100644
index 0000000000..04b367a0b5
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_09_plan.json
@@ -0,0 +1,957 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_string.yaml"
+ }, {
+ "extensionUriAnchor": 5,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_datetime.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": 3,
+ "functionAnchor": 2,
+ "name": "like:str_str"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 3,
+ "name": "extract:req_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 4,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 5,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 6,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [50, 51, 52]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["PS_PARTKEY", "PS_SUPPKEY", "PS_AVAILQTY", "PS_SUPPLYCOST", "PS_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PARTSUPP"]
+ }
+ }
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 18
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 33
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 18
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 32
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 37
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 46
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "%green%"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 47
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "enum": "YEAR"
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 41
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 35
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 20
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }]
+ }
+ },
+ "names": ["NATION", "O_YEAR", "SUM_PROFIT"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_1.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_1.json
deleted file mode 100644
index 7dbce9959e..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_1.json
+++ /dev/null
@@ -1,810 +0,0 @@
-{
- "extensionUris": [{
- "extensionUriAnchor": 3,
- "uri": "/functions_aggregate_generic.yaml"
- }, {
- "extensionUriAnchor": 2,
- "uri": "/functions_arithmetic_decimal.yaml"
- }, {
- "extensionUriAnchor": 1,
- "uri": "/functions_datetime.yaml"
- }],
- "extensions": [{
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "lte:date_date"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 1,
- "name": "subtract:date_day"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 2,
- "name": "multiply:opt_decimal_decimal"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 3,
- "name": "subtract:opt_decimal_decimal"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 4,
- "name": "add:opt_decimal_decimal"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 5,
- "name": "sum:opt_decimal"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 6,
- "name": "avg:opt_decimal"
- }
- }, {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 7,
- "name": "count:opt"
- }
- }],
- "relations": [{
- "root": {
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
-
- },
- "input": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }, {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- }, {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [{
- "value": {
- "literal": {
- "date": 10561,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }, {
- "value": {
- "literal": {
- "intervalDayToSecond": {
- "days": 120,
- "seconds": 0,
- "microseconds": 0
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }]
- }
- }
- }]
- }
- }
- }
- },
- "expressions": [{
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- }, {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- }, {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }, {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }, {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- }, {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }, {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }
- }]
- }
- }, {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- }, {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }, {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }
- }]
- }
- }
- }, {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [{
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }, {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }
- }]
- }
- }, {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }]
- }
- },
- "groupings": [{
- "groupingExpressions": [{
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }, {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }]
- }],
- "measures": [{
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [{
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- }]
- }
- }, {
- "measure": {
- "functionReference": 7,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": []
- }
- }]
- }
- },
- "sorts": [{
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }, {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }]
- }
- },
- "names": ["L_RETURNFLAG", "L_LINESTATUS", "SUM_QTY", "SUM_BASE_PRICE", "SUM_DISC_PRICE", "SUM_CHARGE", "AVG_QTY", "AVG_PRICE", "AVG_DISC", "COUNT_ORDER"]
- }
- }],
- "expectedTypeUrls": []
- }
-
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10.json
deleted file mode 100644
index 04e13b1edc..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10.json
+++ /dev/null
@@ -1,1257 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_datetime.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "gte:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "lt:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 4,
- "name": "multiply:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 5,
- "name": "subtract:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 6,
- "name": "sum:opt_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "fetch": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15
- ]
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 37,
- 38,
- 39,
- 40,
- 41,
- 42,
- 43,
- 44
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "N_NATIONKEY",
- "N_NAME",
- "N_REGIONKEY",
- "N_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 17
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1993-10-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1994-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 25
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "R",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 33
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 34
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 23
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- }
- ]
- }
- },
- "offset": "0",
- "count": "20"
- }
- },
- "names": [
- "C_CUSTKEY",
- "C_NAME",
- "REVENUE",
- "C_ACCTBAL",
- "N_NAME",
- "C_ADDRESS",
- "C_PHONE",
- "C_COMMENT"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10_plan.json
new file mode 100644
index 0000000000..2daa1dabb4
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10_plan.json
@@ -0,0 +1,927 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 3,
+ "functionAnchor": 2,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "lt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 4,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "fetch": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [8, 9, 10, 11, 12, 13, 14, 15]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [37, 38, 39, 40, 41, 42, 43, 44]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1993-10-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1994-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 25
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "R"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 33
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 34
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }]
+ }
+ },
+ "count": "20"
+ }
+ },
+ "names": ["C_CUSTKEY", "C_NAME", "REVENUE", "C_ACCTBAL", "N_NAME", "C_ADDRESS", "C_PHONE", "C_COMMENT"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11_plan.json
similarity index 71%
rename from datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11.json
rename to datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11_plan.json
index 916bc6f71c..d79b065403 100644
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11.json
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11_plan.json
@@ -12,32 +12,31 @@
"extensions": [{
"extensionFunction": {
"extensionUriReference": 1,
- "functionAnchor": 0,
"name": "and:bool"
}
}, {
"extensionFunction": {
"extensionUriReference": 2,
"functionAnchor": 1,
- "name": "equal:any1_any1"
+ "name": "equal:any_any"
}
}, {
"extensionFunction": {
"extensionUriReference": 3,
"functionAnchor": 2,
- "name": "multiply:opt_decimal_decimal"
+ "name": "multiply:dec_dec"
}
}, {
"extensionFunction": {
"extensionUriReference": 3,
"functionAnchor": 3,
- "name": "sum:opt_decimal"
+ "name": "sum:dec"
}
}, {
"extensionFunction": {
"extensionUriReference": 2,
"functionAnchor": 4,
- "name": "gt:any1_any1"
+ "name": "gt:any_any"
}
}],
"relations": [{
@@ -74,13 +73,13 @@
}
},
"input": {
- "join": {
+ "cross": {
"common": {
"direct": {
}
},
"left": {
- "join": {
+ "cross": {
"common": {
"direct": {
}
@@ -96,44 +95,32 @@
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 199,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["PARTSUPP"]
}
}
},
@@ -148,68 +135,43 @@
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i64": {
- "typeVariationReference": 0,
+ "i32": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["SUPPLIER"]
}
}
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
+ }
}
},
"right": {
@@ -222,70 +184,45 @@
"names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
"struct": {
"types": [{
- "i64": {
- "typeVariationReference": 0,
+ "i32": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i64": {
- "typeVariationReference": 0,
+ "i32": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["NATION"]
}
}
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
+ }
}
},
"condition": {
"scalarFunction": {
- "functionReference": 0,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -320,10 +257,8 @@
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -358,11 +293,9 @@
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -379,22 +312,8 @@
}
}, {
"value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "JAPAN",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "literal": {
+ "string": "JAPAN"
}
}
}]
@@ -409,7 +328,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -418,13 +336,11 @@
}, {
"scalarFunction": {
"functionReference": 2,
- "args": [],
"outputType": {
"decimal": {
- "scale": 0,
+ "scale": 2,
"precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -444,10 +360,8 @@
"cast": {
"type": {
"decimal": {
- "scale": 0,
"precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"input": {
@@ -461,7 +375,7 @@
}
}
},
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}]
@@ -474,7 +388,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -485,14 +398,11 @@
"measures": [{
"measure": {
"functionReference": 3,
- "args": [],
- "sorts": [],
"phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
"outputType": {
"decimal": {
- "scale": 0,
+ "scale": 2,
"precision": 19,
- "typeVariationReference": 0,
"nullability": "NULLABILITY_NULLABLE"
}
},
@@ -517,10 +427,8 @@
"condition": {
"scalarFunction": {
"functionReference": 4,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_NULLABLE"
}
},
@@ -567,13 +475,13 @@
}
},
"input": {
- "join": {
+ "cross": {
"common": {
"direct": {
}
},
"left": {
- "join": {
+ "cross": {
"common": {
"direct": {
}
@@ -589,44 +497,32 @@
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 199,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["PARTSUPP"]
}
}
},
@@ -641,68 +537,43 @@
"struct": {
"types": [{
"i64": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i64": {
- "typeVariationReference": 0,
+ "i32": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
"decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_4",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["SUPPLIER"]
}
}
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
+ }
}
},
"right": {
@@ -715,70 +586,45 @@
"names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
"struct": {
"types": [{
- "i64": {
- "typeVariationReference": 0,
+ "i32": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}, {
- "i64": {
- "typeVariationReference": 0,
+ "i32": {
"nullability": "NULLABILITY_REQUIRED"
}
}, {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
}
}],
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_5",
- "parquet": {}
- }
- ]
+ "namedTable": {
+ "names": ["NATION"]
}
}
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
+ }
}
},
"condition": {
"scalarFunction": {
- "functionReference": 0,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -813,10 +659,8 @@
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
"nullability": "NULLABILITY_REQUIRED"
}
},
@@ -851,11 +695,9 @@
"value": {
"scalarFunction": {
"functionReference": 1,
- "args": [],
"outputType": {
"bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -872,22 +714,8 @@
}
}, {
"value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "JAPAN",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "literal": {
+ "string": "JAPAN"
}
}
}]
@@ -901,13 +729,11 @@
"expressions": [{
"scalarFunction": {
"functionReference": 2,
- "args": [],
"outputType": {
"decimal": {
- "scale": 0,
+ "scale": 2,
"precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"arguments": [{
@@ -927,10 +753,8 @@
"cast": {
"type": {
"decimal": {
- "scale": 0,
"precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
+ "nullability": "NULLABILITY_REQUIRED"
}
},
"input": {
@@ -944,7 +768,7 @@
}
}
},
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
}
}
}]
@@ -953,19 +777,15 @@
}
},
"groupings": [{
- "groupingExpressions": []
}],
"measures": [{
"measure": {
"functionReference": 3,
- "args": [],
- "sorts": [],
"phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
"outputType": {
"decimal": {
- "scale": 0,
+ "scale": 2,
"precision": 19,
- "typeVariationReference": 0,
"nullability": "NULLABILITY_NULLABLE"
}
},
@@ -975,7 +795,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -990,12 +809,10 @@
"expressions": [{
"scalarFunction": {
"functionReference": 2,
- "args": [],
"outputType": {
"decimal": {
- "scale": 10,
+ "scale": 12,
"precision": 19,
- "typeVariationReference": 0,
"nullability": "NULLABILITY_NULLABLE"
}
},
@@ -1004,7 +821,6 @@
"selection": {
"directReference": {
"structField": {
- "field": 0
}
},
"rootReference": {
@@ -1018,9 +834,7 @@
"value": "QEIPAAAAAAAAAAAAAAAAAA==",
"precision": 11,
"scale": 10
- },
- "nullable": false,
- "typeVariationReference": 0
+ }
}
}
}]
@@ -1054,6 +868,5 @@
},
"names": ["PS_PARTKEY", "value"]
}
- }],
- "expectedTypeUrls": []
-}
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_12_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_12_plan.json
new file mode 100644
index 0000000000..db31000527
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_12_plan.json
@@ -0,0 +1,794 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 1,
+ "functionAnchor": 2,
+ "name": "or:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "lt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 4,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 5,
+ "name": "not_equal:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "sum:i32"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [25, 26, 27]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "MAIL"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "SHIP"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 20
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 20
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1994-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "ifThen": {
+ "ifs": [{
+ "if": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "1-URGENT"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "2-HIGH"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ },
+ "then": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }],
+ "else": {
+ "literal": {
+ "i32": 0
+ }
+ }
+ }
+ }, {
+ "ifThen": {
+ "ifs": [{
+ "if": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "1-URGENT"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "2-HIGH"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ },
+ "then": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }],
+ "else": {
+ "literal": {
+ "i32": 0
+ }
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i32": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i32": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["L_SHIPMODE", "HIGH_LINE_COUNT", "LOW_LINE_COUNT"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13.json
deleted file mode 100644
index c88e61e783..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13.json
+++ /dev/null
@@ -1,624 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_aggregate_generic.yaml"
- },
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_string.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 2,
- "name": "not:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "like:vchar_vchar"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 4,
- "name": "count:opt_any"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 5,
- "name": "count:opt"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 2,
- 3
- ]
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 2
- ]
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 17,
- 18
- ]
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "%special%requests%",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- },
- "type": "JOIN_TYPE_LEFT"
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 4,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": []
- }
- }
- ]
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- }
- ]
- }
- },
- "names": [
- "C_COUNT",
- "CUSTDIST"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13_plan.json
new file mode 100644
index 0000000000..19b80b0aac
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13_plan.json
@@ -0,0 +1,459 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 4,
+ "uri": "/functions_aggregate_generic.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_string.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": 1,
+ "functionAnchor": 2,
+ "name": "not:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "like:str_str"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 4,
+ "name": "count:any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "count:"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [2, 3]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [2]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [17, 18]
+ }
+ },
+ "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"]
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ },
+ "expression": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "%special%requests%"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ },
+ "type": "JOIN_TYPE_LEFT"
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 4,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL"
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }]
+ }
+ },
+ "names": ["C_COUNT", "CUSTDIST"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14.json
deleted file mode 100644
index 380b71df8a..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14.json
+++ /dev/null
@@ -1,924 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_string.yaml"
- },
- {
- "extensionUriAnchor": 5,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_datetime.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "gte:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "lt:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 4,
- "name": "like:vchar_vchar"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 5,
- "name": "multiply:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 6,
- "name": "subtract:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 7,
- "name": "sum:opt_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 8,
- "name": "divide:opt_decimal_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 2
- ]
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 25,
- 26
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "P_PARTKEY",
- "P_NAME",
- "P_MFGR",
- "P_BRAND",
- "P_TYPE",
- "P_SIZE",
- "P_CONTAINER",
- "P_RETAILPRICE",
- "P_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 55,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 23,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "date": 9374,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1995-10-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "ifThen": {
- "ifs": [
- {
- "if": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 20
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "PROMO%",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- },
- "then": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 6,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- ],
- "else": {
- "literal": {
- "decimal": {
- "value": "AAAAAAAAAAAAAAAAAAAAAA==",
- "precision": 19,
- "scale": 0
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- },
- {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 6,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": []
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 7,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- },
- {
- "measure": {
- "functionReference": 7,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "expressions": [
- {
- "scalarFunction": {
- "functionReference": 8,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 2,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 2,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "literal": {
- "decimal": {
- "value": "ECcAAAAAAAAAAAAAAAAAAA==",
- "precision": 5,
- "scale": 2
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "names": [
- "PROMO_REVENUE"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14_plan.json
new file mode 100644
index 0000000000..81daf41caa
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14_plan.json
@@ -0,0 +1,686 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_string.yaml"
+ }, {
+ "extensionUriAnchor": 5,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 3,
+ "functionAnchor": 2,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "lt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 4,
+ "name": "like:str_str"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 5,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 6,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 7,
+ "name": "sum:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 8,
+ "name": "divide:dec_dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [2]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [25, 26]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "date": 9374
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-10-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "ifThen": {
+ "ifs": [{
+ "if": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 20
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "PROMO%"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ },
+ "then": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }],
+ "else": {
+ "literal": {
+ "decimal": {
+ "value": "AAAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 19,
+ "scale": 4
+ }
+ }
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }, {
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 8,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "decimal": {
+ "scale": 6,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "ECcAAAAAAAAAAAAAAAAAAA==",
+ "precision": 5,
+ "scale": 2
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "names": ["PROMO_REVENUE"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_15_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_15_plan.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_15_plan.json
@@ -0,0 +1 @@
+{}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16.json
deleted file mode 100644
index f988aa7a76..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16.json
+++ /dev/null
@@ -1,1175 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_aggregate_generic.yaml"
- },
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_string.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 2,
- "name": "not_equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 3,
- "name": "not:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 4,
- "name": "like:vchar_vchar"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 5,
- "name": "or:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 6,
- "name": "count:opt_any"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 14,
- 15,
- 16,
- 17
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "PS_PARTKEY",
- "PS_SUPPKEY",
- "PS_AVAILQTY",
- "PS_SUPPLYCOST",
- "PS_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 199,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "P_PARTKEY",
- "P_NAME",
- "P_MFGR",
- "P_BRAND",
- "P_TYPE",
- "P_SIZE",
- "P_CONTAINER",
- "P_RETAILPRICE",
- "P_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 55,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 23,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "Brand#45",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "MEDIUM POLISHED%",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 49,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 14,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 23,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 45,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 19,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 3,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 36,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 9,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "subquery": {
- "inPredicate": {
- "needles": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- ],
- "haystack": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 7
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "S_SUPPKEY",
- "S_NAME",
- "S_ADDRESS",
- "S_NATIONKEY",
- "S_PHONE",
- "S_ACCTBAL",
- "S_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "%Customer%Complaints%",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- }
- }
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_DISTINCT",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }
- ]
- }
- },
- "names": [
- "P_BRAND",
- "P_TYPE",
- "P_SIZE",
- "SUPPLIER_CNT"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16_plan.json
new file mode 100644
index 0000000000..bf97fb9185
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16_plan.json
@@ -0,0 +1,872 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 4,
+ "uri": "/functions_aggregate_generic.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_string.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"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 3,
+ "name": "not:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 4,
+ "name": "like:str_str"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 5,
+ "name": "or:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "count:any"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [14, 15, 16, 17]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["PS_PARTKEY", "PS_SUPPKEY", "PS_AVAILQTY", "PS_SUPPLYCOST", "PS_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PARTSUPP"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "Brand#45"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "MEDIUM POLISHED%"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 49
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 14
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 23
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 45
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 19
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 3
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 36
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 9
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "subquery": {
+ "inPredicate": {
+ "needles": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }],
+ "haystack": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [7]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "%Customer%Complaints%"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_DISTINCT",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["P_BRAND", "P_TYPE", "P_SIZE", "SUPPLIER_CNT"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_17_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_17_plan.json
new file mode 100644
index 0000000000..3135e68fd5
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_17_plan.json
@@ -0,0 +1,690 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_arithmetic_decimal.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": "lt:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "avg:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 4,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 5,
+ "name": "sum:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 6,
+ "name": "divide:dec_dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [1]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [25]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "Brand#23"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "MED BOX"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "subquery": {
+ "scalar": {
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [1]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [16]
+ }
+ },
+ "input": {
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 3,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "decimal": {
+ "scale": 3,
+ "precision": 17,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "AgAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 2,
+ "scale": 1
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 5,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "RgAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 2,
+ "scale": 1
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "names": ["AVG_YEARLY"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_18.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_18.json
deleted file mode 100644
index a4f0b25db9..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_18.json
+++ /dev/null
@@ -1,1128 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "sum:opt_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "gt:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "equal:any1_any1"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "fetch": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 33,
- 34,
- 35,
- 36,
- 37,
- 38
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "subquery": {
- "inPredicate": {
- "needles": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- }
- ],
- "haystack": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 2
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 16,
- 17
- ]
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 1,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 300,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- }
- }
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 17
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 11
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 1,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }
- ]
- }
- },
- "offset": "0",
- "count": "100"
- }
- },
- "names": [
- "C_NAME",
- "C_CUSTKEY",
- "O_ORDERKEY",
- "O_ORDERDATE",
- "O_TOTALPRICE",
- "EXPR$5"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_18_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_18_plan.json
new file mode 100644
index 0000000000..7f0ff438db
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_18_plan.json
@@ -0,0 +1,796 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 2,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_comparison.yaml"
+ }],
+ "extensions": [{
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "name": "and:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 1,
+ "name": "sum:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 2,
+ "name": "gt:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "equal:any_any"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "fetch": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [33, 34, 35, 36, 37, 38]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "subquery": {
+ "inPredicate": {
+ "needles": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }],
+ "haystack": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [2]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [16, 17]
+ }
+ },
+ "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"]
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 1,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 300
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 17
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 11
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 1,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "count": "100"
+ }
+ },
+ "names": ["C_NAME", "C_CUSTKEY", "O_ORDERKEY", "O_ORDERDATE", "O_TOTALPRICE", "EXPR$5"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_19.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_19.json
deleted file mode 100644
index 356111a480..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_19.json
+++ /dev/null
@@ -1,2386 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_arithmetic.yaml"
- },
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "or:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 1,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 2,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 3,
- "name": "gte:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 4,
- "name": "lte:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 5,
- "name": "add:opt_i32_i32"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 6,
- "name": "multiply:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 7,
- "name": "subtract:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 8,
- "name": "sum:opt_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 25
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "P_PARTKEY",
- "P_NAME",
- "P_MFGR",
- "P_BRAND",
- "P_TYPE",
- "P_SIZE",
- "P_CONTAINER",
- "P_RETAILPRICE",
- "P_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 55,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 23,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 19
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "Brand#12",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "SM CASE",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "SM BOX",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "SM PACK",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "SM PKG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 10,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 5,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "AIR",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "AIR REG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 13
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "DELIVER IN PERSON",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 19
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "Brand#23",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "MED BAG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "MED BOX",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "MED PKG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "MED PACK",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 10,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "literal": {
- "i32": 10,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 10,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 10,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "AIR",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "AIR REG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 13
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "DELIVER IN PERSON",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 19
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "Brand#34",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "LG CASE",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "LG BOX",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "LG PACK",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "LG PKG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 20,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "literal": {
- "i32": 20,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 10,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 15,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "AIR",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "AIR REG",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 13
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "DELIVER IN PERSON",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "scalarFunction": {
- "functionReference": 6,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 7,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": []
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 8,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "names": [
- "REVENUE"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_19_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_19_plan.json
new file mode 100644
index 0000000000..8ea0bc881c
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_19_plan.json
@@ -0,0 +1,1956 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 3,
+ "uri": "/functions_arithmetic.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 2,
+ "uri": "/functions_comparison.yaml"
+ }],
+ "extensions": [{
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "name": "or:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 1,
+ "name": "and:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 2,
+ "name": "equal:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 3,
+ "name": "gte:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 4,
+ "name": "lte:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 5,
+ "name": "add:i32_i32"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 6,
+ "name": "multiply:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 7,
+ "name": "subtract:dec_dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 8,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [25]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "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"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "Brand#12"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "SM CASE"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "SM BOX"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "SM PACK"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "SM PKG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 10
+ }
+ }
+ }]
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 5
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "AIR"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "AIR REG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "DELIVER IN PERSON"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "Brand#23"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "MED BAG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "MED BOX"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "MED PKG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "MED PACK"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 10
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "i32": 10
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 10
+ }
+ }
+ }]
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 10
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "AIR"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "AIR REG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "DELIVER IN PERSON"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 16
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "Brand#34"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "LG CASE"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "LG BOX"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "LG PACK"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 22
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "LG PKG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 20
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "i32": 20
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 10
+ }
+ }
+ }]
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 21
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 15
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "AIR"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 14
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "AIR REG"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "DELIVER IN PERSON"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 6,
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 7,
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 16,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "i32": 1
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 6
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 8,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 4,
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "names": ["REVENUE"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_2.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_2.json
deleted file mode 100644
index dd570ca06d..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_2.json
+++ /dev/null
@@ -1,1582 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_string.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "like:vchar_vchar"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 3,
- "name": "min:decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "fetch": {
- "common": {
- "direct": {}
- },
- "input": {
- "sort": {
- "common": {
- "direct": {}
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 28,
- 29,
- 30,
- 31,
- 32,
- 33,
- 34,
- 35
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {}
- },
- "input": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "P_PARTKEY",
- "P_NAME",
- "P_MFGR",
- "P_BRAND",
- "P_TYPE",
- "P_SIZE",
- "P_CONTAINER",
- "P_RETAILPRICE",
- "P_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 55,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 23,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "S_SUPPKEY",
- "S_NAME",
- "S_ADDRESS",
- "S_NATIONKEY",
- "S_PHONE",
- "S_ACCTBAL",
- "S_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "PS_PARTKEY",
- "PS_SUPPKEY",
- "PS_AVAILQTY",
- "PS_SUPPLYCOST",
- "PS_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 199,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "N_NATIONKEY",
- "N_NAME",
- "N_REGIONKEY",
- "N_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "R_REGIONKEY",
- "R_NAME",
- "R_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_4",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 17
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 15,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "%BRASS",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 21
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 23
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 25
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 26
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "EUROPE",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 19
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "subquery": {
- "scalar": {
- "input": {
- "aggregate": {
- "common": {
- "direct": {}
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 19
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {}
- },
- "input": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "PS_PARTKEY",
- "PS_SUPPKEY",
- "PS_AVAILQTY",
- "PS_SUPPLYCOST",
- "PS_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 199,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_5",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "S_SUPPKEY",
- "S_NAME",
- "S_ADDRESS",
- "S_NATIONKEY",
- "S_PHONE",
- "S_ACCTBAL",
- "S_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_6",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "N_NATIONKEY",
- "N_NAME",
- "N_REGIONKEY",
- "N_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_7",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "R_REGIONKEY",
- "R_NAME",
- "R_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_8",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 16
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 17
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "EUROPE",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": []
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 3,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- ]
- }
- }
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 14
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 11
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 13
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 15
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {}
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {}
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }
- ]
- }
- },
- "offset": "0",
- "count": "100"
- }
- },
- "names": [
- "S_ACCTBAL",
- "S_NAME",
- "N_NAME",
- "P_PARTKEY",
- "P_MFGR",
- "S_ADDRESS",
- "S_PHONE",
- "S_COMMENT"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_20.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_20.json
deleted file mode 100644
index 54a71fa553..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_20.json
+++ /dev/null
@@ -1,1273 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_string.yaml"
- },
- {
- "extensionUriAnchor": 5,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_datetime.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "like:vchar_vchar"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "gt:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 4,
- "name": "gte:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 5,
- "name": "lt:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 6,
- "name": "sum:opt_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 7,
- "name": "multiply:opt_decimal_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "sort": {
- "common": {
- "direct": {}
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 11,
- 12
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {}
- },
- "input": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "S_SUPPKEY",
- "S_NAME",
- "S_ADDRESS",
- "S_NATIONKEY",
- "S_PHONE",
- "S_ACCTBAL",
- "S_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "N_NATIONKEY",
- "N_NAME",
- "N_REGIONKEY",
- "N_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "subquery": {
- "inPredicate": {
- "needles": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- ],
- "haystack": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 5
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {}
- },
- "input": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "PS_PARTKEY",
- "PS_SUPPKEY",
- "PS_AVAILQTY",
- "PS_SUPPLYCOST",
- "PS_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 199,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "subquery": {
- "inPredicate": {
- "needles": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- ],
- "haystack": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 9
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {}
- },
- "input": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "P_PARTKEY",
- "P_NAME",
- "P_MFGR",
- "P_BRAND",
- "P_TYPE",
- "P_SIZE",
- "P_CONTAINER",
- "P_RETAILPRICE",
- "P_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 55,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 23,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 55,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "forest%",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- }
- }
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 1,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {}
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "subquery": {
- "scalar": {
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 1
- ]
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {}
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 16
- ]
- }
- },
- "input": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_4",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1994-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1995-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": []
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "expressions": [
- {
- "scalarFunction": {
- "functionReference": 7,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 1,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "literal": {
- "decimal": {
- "value": "BQAAAAAAAAAAAAAAAAAAAA==",
- "precision": 2,
- "scale": 1
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- ]
- }
- }
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- }
- }
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "CANADA",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }
- ]
- }
- },
- "names": [
- "S_NAME",
- "S_ADDRESS"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_20_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_20_plan.json
new file mode 100644
index 0000000000..a616e3fc06
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_20_plan.json
@@ -0,0 +1,932 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 2,
+ "uri": "/functions_string.yaml"
+ }, {
+ "extensionUriAnchor": 5,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_datetime.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_comparison.yaml"
+ }],
+ "extensions": [{
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "name": "and:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 1,
+ "name": "like:str_str"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 2,
+ "name": "gt:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "equal:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 4,
+ "name": "gte:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "lt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 6,
+ "name": "sum:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 7,
+ "name": "multiply:dec_dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [11, 12]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "subquery": {
+ "inPredicate": {
+ "needles": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }],
+ "haystack": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [5]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["PS_PARTKEY", "PS_SUPPKEY", "PS_AVAILQTY", "PS_SUPPLYCOST", "PS_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PARTSUPP"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "subquery": {
+ "inPredicate": {
+ "needles": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }],
+ "haystack": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [9]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["P_PARTKEY", "P_NAME", "P_MFGR", "P_BRAND", "P_TYPE", "P_SIZE", "P_CONTAINER", "P_RETAILPRICE", "P_COMMENT"],
+ "struct": {
+ "types": [{
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["PART"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "forest%"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "precision": 19,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "input": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }, {
+ "value": {
+ "subquery": {
+ "scalar": {
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [1]
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [16]
+ }
+ },
+ "input": {
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1994-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 5,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 10
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "date": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "1995-01-01"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 6,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 7,
+ "outputType": {
+ "decimal": {
+ "scale": 3,
+ "precision": 17,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "BQAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 2,
+ "scale": 1
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 8
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "CANADA"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["S_NAME", "S_ADDRESS"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_21.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_21.json
deleted file mode 100644
index d35c151722..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_21.json
+++ /dev/null
@@ -1,1493 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_aggregate_generic.yaml"
- },
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_datetime.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "gt:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 3,
- "name": "not_equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 4,
- "name": "not:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 5,
- "name": "count:opt"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "fetch": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 36
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "join": {
- "common": {
- "direct": {
- }
- },
- "left": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "S_SUPPKEY",
- "S_NAME",
- "S_ADDRESS",
- "S_NATIONKEY",
- "S_PHONE",
- "S_ACCTBAL",
- "S_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "right": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {
- }
- },
- "baseSchema": {
- "names": [
- "N_NATIONKEY",
- "N_NAME",
- "N_REGIONKEY",
- "N_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 23
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 25
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "fixedChar": "F",
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 19
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 18
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_4",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- }
- }
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_5",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 7
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 2
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 11
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- }
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 32
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 33
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "SAUDI ARABIA",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": []
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- },
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }
- ]
- }
- },
- "offset": "0",
- "count": "100"
- }
- },
- "names": [
- "S_NAME",
- "NUMWAIT"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_21_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_21_plan.json
new file mode 100644
index 0000000000..c3d4fc3bcb
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_21_plan.json
@@ -0,0 +1,1050 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 4,
+ "uri": "/functions_aggregate_generic.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_datetime.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": 3,
+ "functionAnchor": 2,
+ "name": "gt:date_date"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 3,
+ "name": "not_equal:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 4,
+ "name": "not:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "count:"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "fetch": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [36]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "cross": {
+ "common": {
+ "direct": {
+ }
+ },
+ "left": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["S_SUPPKEY", "S_NAME", "S_ADDRESS", "S_NATIONKEY", "S_PHONE", "S_ACCTBAL", "S_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"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["SUPPLIER"]
+ }
+ }
+ },
+ "right": {
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "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"]
+ }
+ }
+ }
+ }
+ },
+ "right": {
+ "read": {
+ "common": {
+ "direct": {
+ }
+ },
+ "baseSchema": {
+ "names": ["N_NATIONKEY", "N_NAME", "N_REGIONKEY", "N_COMMENT"],
+ "struct": {
+ "types": [{
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "i32": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }, {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ }],
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "namedTable": {
+ "names": ["NATION"]
+ }
+ }
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 23
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 25
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "F"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 19
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 18
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 7
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 9
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 12
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 11
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 32
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 33
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "string": "SAUDI ARABIA"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL"
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }, {
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "count": "100"
+ }
+ },
+ "names": ["S_NAME", "NUMWAIT"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_22.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_22.json
deleted file mode 100644
index 9eb37da8e1..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_22.json
+++ /dev/null
@@ -1,2034 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 5,
- "uri": "/functions_aggregate_generic.yaml"
- },
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_string.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 1,
- "name": "or:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 2,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "substring:fchar_i32_i32"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 4,
- "name": "gt:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 5,
- "name": "avg:opt_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 6,
- "name": "not:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 5,
- "functionAnchor": 7,
- "name": "count:opt"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 8,
- "name": "sum:opt_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "sort": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "13",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "31",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "23",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "29",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "30",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "18",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "17",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "subquery": {
- "scalar": {
- "input": {
- "aggregate": {
- "common": {
- "direct": {
- }
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 8
- ]
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "decimal": {
- "value": "AAAAAAAAAAAAAAAAAAAAAA==",
- "precision": 3,
- "scale": 2
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "13",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "31",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "23",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "29",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "30",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "18",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "17",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": []
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 5,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- }
- }
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 6,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "outerReference": {
- "stepsOut": 1
- }
- }
- }
- }
- ]
- }
- }
- }
- }
- }
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "varchar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {
- }
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- },
- {
- "value": {
- "literal": {
- "i32": 2,
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- },
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 7,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": []
- }
- },
- {
- "measure": {
- "functionReference": 8,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {
- }
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {
- }
- }
- },
- "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
- }
- ]
- }
- },
- "names": [
- "CNTRYCODE",
- "NUMCUST",
- "TOTACCTBAL"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_22_plan.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_22_plan.json
new file mode 100644
index 0000000000..fcd61b23ae
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_22_plan.json
@@ -0,0 +1,1510 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 5,
+ "uri": "/functions_aggregate_generic.yaml"
+ }, {
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "uri": "/functions_string.yaml"
+ }, {
+ "extensionUriAnchor": 4,
+ "uri": "/functions_arithmetic_decimal.yaml"
+ }, {
+ "extensionUriAnchor": 2,
+ "uri": "/functions_comparison.yaml"
+ }],
+ "extensions": [{
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "name": "and:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 1,
+ "name": "or:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 2,
+ "name": "equal:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "substring:str_i32_i32"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 4,
+ "name": "gt:any_any"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 5,
+ "name": "avg:dec"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 1,
+ "functionAnchor": 6,
+ "name": "not:bool"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 5,
+ "functionAnchor": 7,
+ "name": "count:"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 4,
+ "functionAnchor": 8,
+ "name": "sum:dec"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "13"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "31"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "23"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "29"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "30"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "18"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "17"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "subquery": {
+ "scalar": {
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [8]
+ }
+ },
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "AAAAAAAAAAAAAAAAAAAAAA==",
+ "precision": 3,
+ "scale": 2
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 1,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "13"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "31"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "23"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "29"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "30"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "18"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "17"
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_THROW_EXCEPTION"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 5,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }, {
+ "value": {
+ "scalarFunction": {
+ "functionReference": 6,
+ "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"]
+ }
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "functionReference": 2,
+ "outputType": {
+ "bool": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "outerReference": {
+ "stepsOut": 1
+ }
+ }
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 3,
+ "outputType": {
+ "string": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 4
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 1
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "i32": 2
+ }
+ }
+ }]
+ }
+ }, {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 5
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "measures": [{
+ "measure": {
+ "functionReference": 7,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "i64": {
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL"
+ }
+ }, {
+ "measure": {
+ "functionReference": 8,
+ "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
+ "outputType": {
+ "decimal": {
+ "scale": 2,
+ "precision": 15,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "invocation": "AGGREGATION_INVOCATION_ALL",
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_ASC_NULLS_LAST"
+ }]
+ }
+ },
+ "names": ["CNTRYCODE", "NUMCUST", "TOTACCTBAL"]
+ }
+ }]
+}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_5.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_5.json
deleted file mode 100644
index 75b82a305e..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_5.json
+++ /dev/null
@@ -1,1254 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_datetime.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "equal:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 2,
- "name": "gte:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "lt:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 4,
- "name": "multiply:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 5,
- "name": "subtract:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 6,
- "name": "sum:opt_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "sort": {
- "common": {
- "direct": {}
- },
- "input": {
- "aggregate": {
- "common": {
- "direct": {}
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 47,
- 48
- ]
- }
- },
- "input": {
- "filter": {
- "common": {
- "direct": {}
- },
- "input": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "join": {
- "common": {
- "direct": {}
- },
- "left": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 117,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 79,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_1",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_2",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "S_SUPPKEY",
- "S_NAME",
- "S_ADDRESS",
- "S_NATIONKEY",
- "S_PHONE",
- "S_ACCTBAL",
- "S_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 40,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 15,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 101,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_3",
- "parquet": {}
- }
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "N_NATIONKEY",
- "N_NAME",
- "N_REGIONKEY",
- "N_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "namedTable": {
- "names": [
- "NATION"
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "right": {
- "read": {
- "common": {
- "direct": {}
- },
- "baseSchema": {
- "names": [
- "R_REGIONKEY",
- "R_NAME",
- "R_COMMENT"
- ],
- "struct": {
- "types": [
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 152,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "namedTable": {
- "names": [
- "REGION"
- ]
- }
- }
- },
- "expression": {
- "literal": {
- "boolean": true,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "type": "JOIN_TYPE_INNER"
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 9
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 17
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 8
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 19
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 33
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 3
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 36
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 36
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 40
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 42
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 44
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 45
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "ASIA",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1994-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 12
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1995-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 41
- }
- },
- "rootReference": {}
- }
- },
- {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 22
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 1,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 23
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": [
- {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- ]
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 6,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "sorts": [
- {
- "expr": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 1
- }
- },
- "rootReference": {}
- }
- },
- "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
- }
- ]
- }
- },
- "names": [
- "N_NAME",
- "REVENUE"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_6.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_6.json
deleted file mode 100644
index 18fb9781da..0000000000
--- a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_6.json
+++ /dev/null
@@ -1,585 +0,0 @@
-{
- "extensionUris": [
- {
- "extensionUriAnchor": 1,
- "uri": "/functions_boolean.yaml"
- },
- {
- "extensionUriAnchor": 4,
- "uri": "/functions_arithmetic_decimal.yaml"
- },
- {
- "extensionUriAnchor": 2,
- "uri": "/functions_datetime.yaml"
- },
- {
- "extensionUriAnchor": 3,
- "uri": "/functions_comparison.yaml"
- }
- ],
- "extensions": [
- {
- "extensionFunction": {
- "extensionUriReference": 1,
- "functionAnchor": 0,
- "name": "and:bool"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 1,
- "name": "gte:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 2,
- "functionAnchor": 2,
- "name": "lt:date_date"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 3,
- "name": "gte:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 4,
- "name": "lte:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 3,
- "functionAnchor": 5,
- "name": "lt:any1_any1"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 6,
- "name": "multiply:opt_decimal_decimal"
- }
- },
- {
- "extensionFunction": {
- "extensionUriReference": 4,
- "functionAnchor": 7,
- "name": "sum:opt_decimal"
- }
- }
- ],
- "relations": [
- {
- "root": {
- "input": {
- "aggregate": {
- "common": {
- "direct": {}
- },
- "input": {
- "project": {
- "common": {
- "emit": {
- "outputMapping": [
- 16
- ]
- }
- },
- "input": {
- "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": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i64": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- {
- "i32": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 1,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 25,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "fixedChar": {
- "length": 10,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- {
- "varchar": {
- "length": 44,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- }
- ],
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "local_files": {
- "items": [
- {
- "uri_file": "file://FILENAME_PLACEHOLDER_0",
- "parquet": {}
- }
- ]
- }
- }
- },
- "condition": {
- "scalarFunction": {
- "functionReference": 0,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "scalarFunction": {
- "functionReference": 1,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1994-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 2,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 10
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "date": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_REQUIRED"
- }
- },
- "input": {
- "literal": {
- "fixedChar": "1995-01-01",
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 3,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "literal": {
- "decimal": {
- "value": "BQAAAAAAAAAAAAAAAAAAAA==",
- "precision": 3,
- "scale": 2
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 4,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "literal": {
- "decimal": {
- "value": "BwAAAAAAAAAAAAAAAAAAAA==",
- "precision": 3,
- "scale": 2
- },
- "nullable": false,
- "typeVariationReference": 0
- }
- }
- }
- ]
- }
- }
- },
- {
- "value": {
- "scalarFunction": {
- "functionReference": 5,
- "args": [],
- "outputType": {
- "bool": {
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 4
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "cast": {
- "type": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "input": {
- "literal": {
- "i32": 24,
- "nullable": false,
- "typeVariationReference": 0
- }
- },
- "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
- }
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- }
- },
- "expressions": [
- {
- "scalarFunction": {
- "functionReference": 6,
- "args": [],
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 5
- }
- },
- "rootReference": {}
- }
- }
- },
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 6
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "groupings": [
- {
- "groupingExpressions": []
- }
- ],
- "measures": [
- {
- "measure": {
- "functionReference": 7,
- "args": [],
- "sorts": [],
- "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
- "outputType": {
- "decimal": {
- "scale": 0,
- "precision": 19,
- "typeVariationReference": 0,
- "nullability": "NULLABILITY_NULLABLE"
- }
- },
- "invocation": "AGGREGATION_INVOCATION_ALL",
- "arguments": [
- {
- "value": {
- "selection": {
- "directReference": {
- "structField": {
- "field": 0
- }
- },
- "rootReference": {}
- }
- }
- }
- ]
- }
- }
- ]
- }
- },
- "names": [
- "REVENUE"
- ]
- }
- }
- ],
- "expectedTypeUrls": []
-}
\ No newline at end of file
diff --git a/datafusion/substrait/tests/utils.rs b/datafusion/substrait/tests/utils.rs
index 685e3deec5..9f63b74ef0 100644
--- a/datafusion/substrait/tests/utils.rs
+++ b/datafusion/substrait/tests/utils.rs
@@ -18,17 +18,26 @@
#[cfg(test)]
pub mod test {
use datafusion::catalog_common::TableReference;
+ use datafusion::common::{substrait_datafusion_err, substrait_err};
use datafusion::datasource::empty::EmptyTable;
use datafusion::datasource::TableProvider;
+ use datafusion::error::Result;
use datafusion::prelude::SessionContext;
use datafusion_substrait::extensions::Extensions;
use datafusion_substrait::logical_plan::consumer::from_substrait_named_struct;
+ use std::collections::HashMap;
use std::fs::File;
use std::io::BufReader;
use std::sync::Arc;
+ use substrait::proto::exchange_rel::ExchangeKind;
+ use substrait::proto::expand_rel::expand_field::FieldType;
+ use substrait::proto::expression::nested::NestedType;
+ use substrait::proto::expression::subquery::SubqueryType;
+ use substrait::proto::expression::RexType;
+ use substrait::proto::function_argument::ArgType;
use substrait::proto::read_rel::{NamedTable, ReadType};
use substrait::proto::rel::RelType;
- use substrait::proto::{Plan, ReadRel, Rel};
+ use substrait::proto::{Expression, FunctionArgument, Plan, ReadRel, Rel};
pub fn read_json(path: &str) -> Plan {
serde_json::from_reader::<_, Plan>(BufReader::new(
@@ -37,13 +46,29 @@ pub mod test {
.expect("failed to parse json")
}
- pub fn add_plan_schemas_to_ctx(ctx: SessionContext, plan: &Plan) -> SessionContext {
- let schemas = TestSchemaCollector::collect_schemas(plan);
- for (table_reference, table) in schemas {
- ctx.register_table(table_reference, table)
- .expect("Failed to register table");
+ pub fn add_plan_schemas_to_ctx(
+ ctx: SessionContext,
+ plan: &Plan,
+ ) -> Result<SessionContext> {
+ let schemas = TestSchemaCollector::collect_schemas(plan)?;
+ let mut schema_map: HashMap<TableReference, Arc<dyn TableProvider>> =
+ HashMap::new();
+ for (table_reference, table) in schemas.into_iter() {
+ let schema = table.schema();
+ if let Some(existing_table) =
+ schema_map.insert(table_reference.clone(), table)
+ {
+ if existing_table.schema() != schema {
+ return substrait_err!(
+ "Substrait plan contained the same table {} with different schemas.\nSchema 1: {}\nSchema 2: {}",
+ table_reference, existing_table.schema(), schema);
+ }
+ }
}
- ctx
+ for (table_reference, table) in schema_map.into_iter() {
+ ctx.register_table(table_reference, table)?;
+ }
+ Ok(ctx)
}
pub struct TestSchemaCollector {
@@ -57,28 +82,33 @@ pub mod test {
}
}
- fn collect_schemas(plan: &Plan) -> Vec<(TableReference, Arc<dyn TableProvider>)> {
+ fn collect_schemas(
+ plan: &Plan,
+ ) -> Result<Vec<(TableReference, Arc<dyn TableProvider>)>> {
let mut schema_collector = Self::new();
for plan_rel in plan.relations.iter() {
- match plan_rel
+ let rel_type = plan_rel
.rel_type
.as_ref()
- .expect("PlanRel must set rel_type")
- {
+ .ok_or(substrait_datafusion_err!("PlanRel must set rel_type"))?;
+ match rel_type {
substrait::proto::plan_rel::RelType::Rel(r) => {
- schema_collector.collect_schemas_from_rel(r)
+ schema_collector.collect_schemas_from_rel(r)?
+ }
+ substrait::proto::plan_rel::RelType::Root(r) => {
+ let input = r
+ .input
+ .as_ref()
+ .ok_or(substrait_datafusion_err!("RelRoot must set input"))?;
+ schema_collector.collect_schemas_from_rel(input)?
}
- substrait::proto::plan_rel::RelType::Root(r) => schema_collector
- .collect_schemas_from_rel(
- r.input.as_ref().expect("RelRoot must set input"),
- ),
}
}
- schema_collector.schemas
+ Ok(schema_collector.schemas)
}
- fn collect_named_table(&mut self, read: &ReadRel, nt: &NamedTable) {
+ fn collect_named_table(&mut self, read: &ReadRel, nt: &NamedTable) -> Result<()> {
let table_reference = match nt.names.len() {
0 => {
panic!("No table name found in NamedTable");
@@ -97,10 +127,11 @@ pub mod test {
},
};
- let substrait_schema = read
- .base_schema
- .as_ref()
- .expect("No base schema found for NamedTable");
+ let substrait_schema =
+ read.base_schema.as_ref().ok_or(substrait_datafusion_err!(
+ "No base schema found for NamedTable: {}",
+ table_reference
+ ))?;
let empty_extensions = Extensions {
functions: Default::default(),
types: Default::default(),
@@ -108,79 +139,353 @@ pub mod test {
};
let df_schema =
- from_substrait_named_struct(substrait_schema, &empty_extensions)
- .expect(
- "Unable to generate DataFusion schema from Substrait NamedStruct",
- )
+ from_substrait_named_struct(substrait_schema, &empty_extensions)?
.replace_qualifier(table_reference.clone());
let table = EmptyTable::new(df_schema.inner().clone());
self.schemas.push((table_reference, Arc::new(table)));
+ Ok(())
}
- fn collect_schemas_from_rel(&mut self, rel: &Rel) {
- match rel.rel_type.as_ref().unwrap() {
- RelType::Read(r) => match r.read_type.as_ref().unwrap() {
- // Virtual Tables do not contribute to the schema
- ReadType::VirtualTable(_) => (),
- ReadType::LocalFiles(_) => todo!(),
- ReadType::NamedTable(nt) => self.collect_named_table(r, nt),
- ReadType::ExtensionTable(_) => todo!(),
- },
- RelType::Filter(f) => self.apply(f.input.as_ref().map(|b| b.as_ref())),
- RelType::Fetch(f) => self.apply(f.input.as_ref().map(|b| b.as_ref())),
- RelType::Aggregate(a) => self.apply(a.input.as_ref().map(|b| b.as_ref())),
- RelType::Sort(s) => self.apply(s.input.as_ref().map(|b| b.as_ref())),
+ fn collect_schemas_from_rel(&mut self, rel: &Rel) -> Result<()> {
+ let rel_type = rel
+ .rel_type
+ .as_ref()
+ .ok_or(substrait_datafusion_err!("Rel must set rel_type"))?;
+ match rel_type {
+ RelType::Read(r) => {
+ let read_type = r
+ .read_type
+ .as_ref()
+ .ok_or(substrait_datafusion_err!("Read must set read_type"))?;
+ match read_type {
+ // Virtual Tables do not contribute to the schema
+ ReadType::VirtualTable(_) => (),
+ ReadType::LocalFiles(_) => todo!(),
+ ReadType::NamedTable(nt) => self.collect_named_table(r, nt)?,
+ ReadType::ExtensionTable(_) => todo!(),
+ }
+ if let Some(expr) = r.filter.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ };
+ if let Some(expr) = r.best_effort_filter.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ };
+ }
+ RelType::Filter(f) => {
+ self.apply(f.input.as_ref().map(|b| b.as_ref()))?;
+ for expr in f.condition.iter() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ RelType::Fetch(f) => {
+ self.apply(f.input.as_ref().map(|b| b.as_ref()))?;
+ }
+ RelType::Aggregate(a) => {
+ self.apply(a.input.as_ref().map(|b| b.as_ref()))?;
+ for grouping in a.groupings.iter() {
+ for expr in grouping.grouping_expressions.iter() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ for measure in a.measures.iter() {
+ if let Some(agg_fn) = measure.measure.as_ref() {
+ for arg in agg_fn.arguments.iter() {
+ self.collect_schemas_from_arg(arg)?
+ }
+ for sort in agg_fn.sorts.iter() {
+ if let Some(expr) = sort.expr.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ }
+ if let Some(expr) = measure.filter.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ }
+ RelType::Sort(s) => {
+ self.apply(s.input.as_ref().map(|b| b.as_ref()))?;
+ for sort_field in s.sorts.iter() {
+ if let Some(expr) = sort_field.expr.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ }
RelType::Join(j) => {
- self.apply(j.left.as_ref().map(|b| b.as_ref()));
- self.apply(j.right.as_ref().map(|b| b.as_ref()));
+ self.apply(j.left.as_ref().map(|b| b.as_ref()))?;
+ self.apply(j.right.as_ref().map(|b| b.as_ref()))?;
+ if let Some(expr) = j.expression.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ if let Some(expr) = j.post_join_filter.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ RelType::Project(p) => {
+ self.apply(p.input.as_ref().map(|b| b.as_ref()))?
}
- RelType::Project(p) => self.apply(p.input.as_ref().map(|b| b.as_ref())),
RelType::Set(s) => {
for input in s.inputs.iter() {
- self.collect_schemas_from_rel(input);
+ self.collect_schemas_from_rel(input)?;
}
}
RelType::ExtensionSingle(s) => {
- self.apply(s.input.as_ref().map(|b| b.as_ref()))
+ self.apply(s.input.as_ref().map(|b| b.as_ref()))?
}
+
RelType::ExtensionMulti(m) => {
for input in m.inputs.iter() {
- self.collect_schemas_from_rel(input)
+ self.collect_schemas_from_rel(input)?
}
}
RelType::ExtensionLeaf(_) => {}
RelType::Cross(c) => {
- self.apply(c.left.as_ref().map(|b| b.as_ref()));
- self.apply(c.right.as_ref().map(|b| b.as_ref()));
+ self.apply(c.left.as_ref().map(|b| b.as_ref()))?;
+ self.apply(c.right.as_ref().map(|b| b.as_ref()))?;
}
// RelType::Reference(_) => {}
// RelType::Write(_) => {}
// RelType::Ddl(_) => {}
RelType::HashJoin(j) => {
- self.apply(j.left.as_ref().map(|b| b.as_ref()));
- self.apply(j.right.as_ref().map(|b| b.as_ref()));
+ self.apply(j.left.as_ref().map(|b| b.as_ref()))?;
+ self.apply(j.right.as_ref().map(|b| b.as_ref()))?;
+ if let Some(expr) = j.post_join_filter.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
}
RelType::MergeJoin(j) => {
- self.apply(j.left.as_ref().map(|b| b.as_ref()));
- self.apply(j.right.as_ref().map(|b| b.as_ref()));
+ self.apply(j.left.as_ref().map(|b| b.as_ref()))?;
+ self.apply(j.right.as_ref().map(|b| b.as_ref()))?;
+ if let Some(expr) = j.post_join_filter.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
}
RelType::NestedLoopJoin(j) => {
- self.apply(j.left.as_ref().map(|b| b.as_ref()));
- self.apply(j.right.as_ref().map(|b| b.as_ref()));
+ self.apply(j.left.as_ref().map(|b| b.as_ref()))?;
+ self.apply(j.right.as_ref().map(|b| b.as_ref()))?;
+ if let Some(expr) = j.expression.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ RelType::Window(w) => {
+ self.apply(w.input.as_ref().map(|b| b.as_ref()))?;
+ for wf in w.window_functions.iter() {
+ for arg in wf.arguments.iter() {
+ self.collect_schemas_from_arg(arg)?;
+ }
+ }
+ for expr in w.partition_expressions.iter() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ for sort_field in w.sorts.iter() {
+ if let Some(expr) = sort_field.expr.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ }
+ RelType::Exchange(e) => {
+ self.apply(e.input.as_ref().map(|b| b.as_ref()))?;
+ let exchange_kind = e.exchange_kind.as_ref().ok_or(
+ substrait_datafusion_err!("Exhange must set exchange_kind"),
+ )?;
+ match exchange_kind {
+ ExchangeKind::ScatterByFields(_) => {}
+ ExchangeKind::SingleTarget(st) => {
+ if let Some(expr) = st.expression.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ ExchangeKind::MultiTarget(mt) => {
+ if let Some(expr) = mt.expression.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ ExchangeKind::RoundRobin(_) => {}
+ ExchangeKind::Broadcast(_) => {}
+ }
+ }
+ RelType::Expand(e) => {
+ self.apply(e.input.as_ref().map(|b| b.as_ref()))?;
+ for expand_field in e.fields.iter() {
+ let expand_type = expand_field.field_type.as_ref().ok_or(
+ substrait_datafusion_err!("ExpandField must set field_type"),
+ )?;
+ match expand_type {
+ FieldType::SwitchingField(sf) => {
+ for expr in sf.duplicates.iter() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ FieldType::ConsistentField(expr) => {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ }
}
- RelType::Window(w) => self.apply(w.input.as_ref().map(|b| b.as_ref())),
- RelType::Exchange(e) => self.apply(e.input.as_ref().map(|b| b.as_ref())),
- RelType::Expand(e) => self.apply(e.input.as_ref().map(|b| b.as_ref())),
_ => todo!(),
}
+ Ok(())
}
- fn apply(&mut self, input: Option<&Rel>) {
+ fn apply(&mut self, input: Option<&Rel>) -> Result<()> {
match input {
- None => {}
+ None => Ok(()),
Some(rel) => self.collect_schemas_from_rel(rel),
}
}
+
+ fn collect_schemas_from_expr(&mut self, e: &Expression) -> Result<()> {
+ let rex_type = e.rex_type.as_ref().ok_or(substrait_datafusion_err!(
+ "rex_type must be set on Expression"
+ ))?;
+ match rex_type {
+ RexType::Literal(_) => {}
+ RexType::Selection(_) => {}
+ RexType::ScalarFunction(sf) => {
+ for arg in sf.arguments.iter() {
+ self.collect_schemas_from_arg(arg)?
+ }
+ }
+ RexType::WindowFunction(wf) => {
+ for arg in wf.arguments.iter() {
+ self.collect_schemas_from_arg(arg)?
+ }
+ for sort_field in wf.sorts.iter() {
+ if let Some(expr) = sort_field.expr.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ for expr in wf.partitions.iter() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ RexType::IfThen(it) => {
+ for if_clause in it.ifs.iter() {
+ if let Some(expr) = if_clause.r#if.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ };
+ if let Some(expr) = if_clause.then.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ };
+ }
+ if let Some(expr) = it.r#else.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ };
+ }
+ RexType::SwitchExpression(se) => {
+ if let Some(expr) = se.r#match.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ for if_value in se.ifs.iter() {
+ if let Some(expr) = if_value.then.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ if let Some(expr) = se.r#else.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ RexType::SingularOrList(sol) => {
+ if let Some(expr) = sol.value.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ for expr in sol.options.iter() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ RexType::MultiOrList(mol) => {
+ for expr in mol.value.iter() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ for record in mol.options.iter() {
+ for expr in record.fields.iter() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ }
+ RexType::Cast(c) => {
+ if let Some(expr) = c.input.as_ref() {
+ self.collect_schemas_from_expr(expr)?
+ }
+ }
+ RexType::Subquery(subquery) => {
+ let subquery_type = subquery
+ .subquery_type
+ .as_ref()
+ .ok_or(substrait_datafusion_err!("subquery_type must be set"))?;
+ match subquery_type {
+ SubqueryType::Scalar(s) => {
+ if let Some(rel) = s.input.as_ref() {
+ self.collect_schemas_from_rel(rel)?;
+ }
+ }
+ SubqueryType::InPredicate(ip) => {
+ for expr in ip.needles.iter() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ if let Some(rel) = ip.haystack.as_ref() {
+ self.collect_schemas_from_rel(rel)?;
+ }
+ }
+ SubqueryType::SetPredicate(sp) => {
+ if let Some(rel) = sp.tuples.as_ref() {
+ self.collect_schemas_from_rel(rel)?;
+ }
+ }
+ SubqueryType::SetComparison(sc) => {
+ if let Some(expr) = sc.left.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ if let Some(rel) = sc.right.as_ref() {
+ self.collect_schemas_from_rel(rel)?;
+ }
+ }
+ }
+ }
+ RexType::Nested(n) => {
+ let nested_type = n.nested_type.as_ref().ok_or(
+ substrait_datafusion_err!("Nested must set nested_type"),
+ )?;
+ match nested_type {
+ NestedType::Struct(s) => {
+ for expr in s.fields.iter() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ NestedType::List(l) => {
+ for expr in l.values.iter() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ NestedType::Map(m) => {
+ for key_value in m.key_values.iter() {
+ if let Some(expr) = key_value.key.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ if let Some(expr) = key_value.value.as_ref() {
+ self.collect_schemas_from_expr(expr)?;
+ }
+ }
+ }
+ }
+ }
+ // Enum is deprecated
+ RexType::Enum(_) => {}
+ }
+ Ok(())
+ }
+
+ fn collect_schemas_from_arg(&mut self, fa: &FunctionArgument) -> Result<()> {
+ let arg_type = fa.arg_type.as_ref().ok_or(substrait_datafusion_err!(
+ "FunctionArgument must set arg_type"
+ ))?;
+ match arg_type {
+ ArgType::Enum(_) => {}
+ ArgType::Type(_) => {}
+ ArgType::Value(expr) => self.collect_schemas_from_expr(expr)?,
+ }
+ Ok(())
+ }
}
}