Skip to content

Apache DataFusion SQL Query Engine

Implement TPCH substrait integration test, support tpch_6, tpch_10, tpch_11 (#11349)

Lordworms3d1792fb9f73
diff --git a/datafusion/substrait/tests/cases/consumer_integration.rs b/datafusion/substrait/tests/cases/consumer_integration.rs
index 5d565c0378..6133c23987 100644
--- a/datafusion/substrait/tests/cases/consumer_integration.rs
+++ b/datafusion/substrait/tests/cases/consumer_integration.rs
@@ -124,6 +124,56 @@ mod tests {
Ok(ctx)
}
+ async fn create_context_tpch6() -> Result<SessionContext> {
+ let ctx = SessionContext::new();
+
+ let registrations =
+ vec![("FILENAME_PLACEHOLDER_0", "tests/testdata/tpch/lineitem.csv")];
+
+ for (table_name, file_path) in registrations {
+ register_csv(&ctx, table_name, file_path).await?;
+ }
+
+ Ok(ctx)
+ }
+ // missing context for query 7,8,9
+
+ async fn create_context_tpch10() -> Result<SessionContext> {
+ let ctx = SessionContext::new();
+
+ let registrations = 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"),
+ ];
+
+ for (table_name, file_path) in registrations {
+ register_csv(&ctx, table_name, file_path).await?;
+ }
+
+ Ok(ctx)
+ }
+
+ async fn create_context_tpch11() -> Result<SessionContext> {
+ let ctx = SessionContext::new();
+
+ let registrations = 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"),
+ ];
+
+ for (table_name, file_path) in registrations {
+ register_csv(&ctx, table_name, file_path).await?;
+ }
+
+ Ok(ctx)
+ }
+
#[tokio::test]
async fn tpch_test_1() -> Result<()> {
let ctx = create_context_tpch1().await?;
@@ -266,4 +316,85 @@ mod tests {
\n TableScan: REGION projection=[r_regionkey, r_name, r_comment]");
Ok(())
}
+
+ #[tokio::test]
+ async fn tpch_test_6() -> Result<()> {
+ let ctx = create_context_tpch6().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");
+
+ 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]");
+ Ok(())
+ }
+
+ // TODO: missing plan 7, 8, 9
+ #[tokio::test]
+ async fn tpch_test_10() -> Result<()> {
+ let ctx = create_context_tpch10().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 AS 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]");
+ Ok(())
+ }
+
+ #[tokio::test]
+ async fn tpch_test_11() -> Result<()> {
+ let ctx = create_context_tpch11().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 = 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]");
+ Ok(())
+ }
}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10.json
new file mode 100644
index 0000000000..04e13b1edc
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_10.json
@@ -0,0 +1,1257 @@
+{
+ "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_11.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11.json
new file mode 100644
index 0000000000..916bc6f71c
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_11.json
@@ -0,0 +1,1059 @@
+{
+ "extensionUris": [{
+ "extensionUriAnchor": 1,
+ "uri": "/functions_boolean.yaml"
+ }, {
+ "extensionUriAnchor": 3,
+ "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": "multiply:opt_decimal_decimal"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 3,
+ "functionAnchor": 3,
+ "name": "sum:opt_decimal"
+ }
+ }, {
+ "extensionFunction": {
+ "extensionUriReference": 2,
+ "functionAnchor": 4,
+ "name": "gt:any1_any1"
+ }
+ }],
+ "relations": [{
+ "root": {
+ "input": {
+ "sort": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "aggregate": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "project": {
+ "common": {
+ "emit": {
+ "outputMapping": [16, 17]
+ }
+ },
+ "input": {
+ "filter": {
+ "common": {
+ "direct": {
+ }
+ },
+ "input": {
+ "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_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": ["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_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_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": 5
+ }
+ },
+ "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_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "fixedChar": {
+ "length": 25,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "JAPAN",
+ "nullable": false,
+ "typeVariationReference": 0
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 0
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }, {
+ "scalarFunction": {
+ "functionReference": 2,
+ "args": [],
+ "outputType": {
+ "decimal": {
+ "scale": 0,
+ "precision": 19,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 0,
+ "precision": 19,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "input": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "groupings": [{
+ "groupingExpressions": [{
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 0
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }]
+ }],
+ "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": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "condition": {
+ "scalarFunction": {
+ "functionReference": 4,
+ "args": [],
+ "outputType": {
+ "bool": {
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "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": {
+ "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_3",
+ "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_4",
+ "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_5",
+ "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": 5
+ }
+ },
+ "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_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 13
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "fixedChar": {
+ "length": 25,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_REQUIRED"
+ }
+ },
+ "input": {
+ "literal": {
+ "fixedChar": "JAPAN",
+ "nullable": false,
+ "typeVariationReference": 0
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ }
+ }
+ }]
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "expressions": [{
+ "scalarFunction": {
+ "functionReference": 2,
+ "args": [],
+ "outputType": {
+ "decimal": {
+ "scale": 0,
+ "precision": 19,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 3
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "cast": {
+ "type": {
+ "decimal": {
+ "scale": 0,
+ "precision": 19,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "input": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 2
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "failureBehavior": "FAILURE_BEHAVIOR_UNSPECIFIED"
+ }
+ }
+ }]
+ }
+ }]
+ }
+ },
+ "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": [{
+ "scalarFunction": {
+ "functionReference": 2,
+ "args": [],
+ "outputType": {
+ "decimal": {
+ "scale": 10,
+ "precision": 19,
+ "typeVariationReference": 0,
+ "nullability": "NULLABILITY_NULLABLE"
+ }
+ },
+ "arguments": [{
+ "value": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 0
+ }
+ },
+ "rootReference": {
+ }
+ }
+ }
+ }, {
+ "value": {
+ "literal": {
+ "decimal": {
+ "value": "QEIPAAAAAAAAAAAAAAAAAA==",
+ "precision": 11,
+ "scale": 10
+ },
+ "nullable": false,
+ "typeVariationReference": 0
+ }
+ }
+ }]
+ }
+ }]
+ }
+ }
+ }
+ }
+ }
+ }]
+ }
+ }
+ }
+ },
+ "sorts": [{
+ "expr": {
+ "selection": {
+ "directReference": {
+ "structField": {
+ "field": 1
+ }
+ },
+ "rootReference": {
+ }
+ }
+ },
+ "direction": "SORT_DIRECTION_DESC_NULLS_FIRST"
+ }]
+ }
+ },
+ "names": ["PS_PARTKEY", "value"]
+ }
+ }],
+ "expectedTypeUrls": []
+}
diff --git a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_6.json b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_6.json
new file mode 100644
index 0000000000..18fb9781da
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_6.json
@@ -0,0 +1,585 @@
+{
+ "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