This is an automated email from the ASF dual-hosted git repository. alamb pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new bd25e26747 Implement TPCH substrait integration test, support tpch_13,
tpch_14, tpch_16 (#11405)
bd25e26747 is described below
commit bd25e26747a271752b7f46aa0970022525eff05b
Author: Lordworms <[email protected]>
AuthorDate: Fri Jul 12 12:51:01 2024 -0700
Implement TPCH substrait integration test, support tpch_13, tpch_14,
tpch_16 (#11405)
optimize code
---
.../substrait/tests/cases/consumer_integration.rs | 86 +-
.../testdata/tpch_substrait_plans/query_13.json | 624 +++++++++++
.../testdata/tpch_substrait_plans/query_14.json | 924 +++++++++++++++
.../testdata/tpch_substrait_plans/query_16.json | 1175 ++++++++++++++++++++
4 files changed, 2808 insertions(+), 1 deletion(-)
diff --git a/datafusion/substrait/tests/cases/consumer_integration.rs
b/datafusion/substrait/tests/cases/consumer_integration.rs
index 10c1319b90..c8130220ef 100644
--- a/datafusion/substrait/tests/cases/consumer_integration.rs
+++ b/datafusion/substrait/tests/cases/consumer_integration.rs
@@ -40,7 +40,6 @@ mod tests {
}
Ok(ctx)
}
-
#[tokio::test]
async fn tpch_test_1() -> Result<()> {
let ctx = create_context(vec![(
@@ -314,4 +313,89 @@ mod tests {
\n TableScan: FILENAME_PLACEHOLDER_2
projection=[n_nationkey, n_name, n_regionkey, n_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]");
+ 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 = 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 CAST(Utf8(\"PROMO%\") AS Utf8)
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 CAST(Utf8(\"PROMO%\") AS Utf8) 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]");
+ 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_PLA [...]
+ \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]");
+ Ok(())
+ }
}
diff --git
a/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13.json
b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13.json
new file mode 100644
index 0000000000..c88e61e783
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_13.json
@@ -0,0 +1,624 @@
+{
+ "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_14.json
b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14.json
new file mode 100644
index 0000000000..380b71df8a
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_14.json
@@ -0,0 +1,924 @@
+{
+ "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_16.json
b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16.json
new file mode 100644
index 0000000000..f988aa7a76
--- /dev/null
+++ b/datafusion/substrait/tests/testdata/tpch_substrait_plans/query_16.json
@@ -0,0 +1,1175 @@
+{
+ "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": []
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
