Apache DataFusion SQL Query Engine
Update arrow 40 (#6412)
Raphael Taylor-Davies98397af6ecc8
diff --git a/Cargo.toml b/Cargo.tomlindex e73581b857..12993eda0f 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -45,12 +45,12 @@ repository = "https://github.com/apache/arrow-datafusion"rust-version = "1.64"[workspace.dependencies]-arrow = { version = "39.0.0", features = ["prettyprint"] }-arrow-flight = { version = "39.0.0", features = ["flight-sql-experimental"] }-arrow-buffer = { version = "39.0.0", default-features = false }-arrow-schema = { version = "39.0.0", default-features = false }-arrow-array = { version = "39.0.0", default-features = false, features = ["chrono-tz"] }-parquet = { version = "39.0.0", features = ["arrow", "async", "object_store"] }+arrow = { version = "40.0.0", features = ["prettyprint"] }+arrow-flight = { version = "40.0.0", features = ["flight-sql-experimental"] }+arrow-buffer = { version = "40.0.0", default-features = false }+arrow-schema = { version = "40.0.0", default-features = false }+arrow-array = { version = "40.0.0", default-features = false, features = ["chrono-tz"] }+parquet = { version = "40.0.0", features = ["arrow", "async", "object_store"] }[profile.release]codegen-units = 1diff --git a/benchmarks/expected-plans/q17.txt b/benchmarks/expected-plans/q17.txtindex 9924555f6d..61c1ecd402 100644--- a/benchmarks/expected-plans/q17.txt+++ b/benchmarks/expected-plans/q17.txt@@ -1,49 +1,49 @@-+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| plan_type | plan |-+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| logical_plan | Projection: CAST(SUM(lineitem.l_extendedprice) AS Float64) / Float64(7) AS avg_yearly |-| | Aggregate: groupBy=[[]], aggr=[[SUM(lineitem.l_extendedprice)]] |-| | Projection: lineitem.l_extendedprice |-| | Inner Join: part.p_partkey = __scalar_sq_1.l_partkey Filter: CAST(lineitem.l_quantity AS Decimal128(30, 15)) < __scalar_sq_1.__value |-| | Projection: lineitem.l_quantity, lineitem.l_extendedprice, part.p_partkey |-| | Inner Join: lineitem.l_partkey = part.p_partkey |-| | TableScan: lineitem projection=[l_partkey, l_quantity, l_extendedprice] |-| | Projection: part.p_partkey |-| | Filter: part.p_brand = Utf8("Brand#23") AND part.p_container = Utf8("MED BOX") |-| | TableScan: part projection=[p_partkey, p_brand, p_container] |-| | SubqueryAlias: __scalar_sq_1 |-| | Projection: lineitem.l_partkey, CAST(Float64(0.2) * CAST(AVG(lineitem.l_quantity) AS Float64) AS Decimal128(30, 15)) AS __value |-| | Aggregate: groupBy=[[lineitem.l_partkey]], aggr=[[AVG(lineitem.l_quantity)]] |-| | TableScan: lineitem projection=[l_partkey, l_quantity] |-| physical_plan | ProjectionExec: expr=[CAST(SUM(lineitem.l_extendedprice)@0 AS Float64) / 7 as avg_yearly] |-| | AggregateExec: mode=Final, gby=[], aggr=[SUM(lineitem.l_extendedprice)] |-| | CoalescePartitionsExec |-| | AggregateExec: mode=Partial, gby=[], aggr=[SUM(lineitem.l_extendedprice)] |-| | ProjectionExec: expr=[l_extendedprice@1 as l_extendedprice] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "p_partkey", index: 2 }, Column { name: "l_partkey", index: 0 })], filter=BinaryExpr { left: CastExpr { expr: Column { name: "l_quantity", index: 0 }, cast_type: Decimal128(30, 15), cast_options: CastOptions { safe: false } }, op: Lt, right: Column { name: "__value", index: 1 } } |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 2 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |-| | ProjectionExec: expr=[l_quantity@1 as l_quantity, l_extendedprice@2 as l_extendedprice, p_partkey@3 as p_partkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_partkey", index: 0 }, Column { name: "p_partkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[p_partkey@0 as p_partkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: p_brand@1 = Brand#23 AND p_container@2 = MED BOX |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | ProjectionExec: expr=[l_partkey@0 as l_partkey, CAST(0.2 * CAST(AVG(lineitem.l_quantity)@1 AS Float64) AS Decimal128(30, 15)) as __value] |-| | AggregateExec: mode=FinalPartitioned, gby=[l_partkey@0 as l_partkey], aggr=[AVG(lineitem.l_quantity)] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | AggregateExec: mode=Partial, gby=[l_partkey@0 as l_partkey], aggr=[AVG(lineitem.l_quantity)] |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | |-+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of file++---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| plan_type | plan |++---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| logical_plan | Projection: CAST(SUM(lineitem.l_extendedprice) AS Float64) / Float64(7) AS avg_yearly |+| | Aggregate: groupBy=[[]], aggr=[[SUM(lineitem.l_extendedprice)]] |+| | Projection: lineitem.l_extendedprice |+| | Inner Join: part.p_partkey = __scalar_sq_1.l_partkey Filter: CAST(lineitem.l_quantity AS Decimal128(30, 15)) < __scalar_sq_1.__value |+| | Projection: lineitem.l_quantity, lineitem.l_extendedprice, part.p_partkey |+| | Inner Join: lineitem.l_partkey = part.p_partkey |+| | TableScan: lineitem projection=[l_partkey, l_quantity, l_extendedprice] |+| | Projection: part.p_partkey |+| | Filter: part.p_brand = Utf8("Brand#23") AND part.p_container = Utf8("MED BOX") |+| | TableScan: part projection=[p_partkey, p_brand, p_container] |+| | SubqueryAlias: __scalar_sq_1 |+| | Projection: lineitem.l_partkey, CAST(Float64(0.2) * CAST(AVG(lineitem.l_quantity) AS Float64) AS Decimal128(30, 15)) AS __value |+| | Aggregate: groupBy=[[lineitem.l_partkey]], aggr=[[AVG(lineitem.l_quantity)]] |+| | TableScan: lineitem projection=[l_partkey, l_quantity] |+| physical_plan | ProjectionExec: expr=[CAST(SUM(lineitem.l_extendedprice)@0 AS Float64) / 7 as avg_yearly] |+| | AggregateExec: mode=Final, gby=[], aggr=[SUM(lineitem.l_extendedprice)] |+| | CoalescePartitionsExec |+| | AggregateExec: mode=Partial, gby=[], aggr=[SUM(lineitem.l_extendedprice)] |+| | ProjectionExec: expr=[l_extendedprice@1 as l_extendedprice] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "p_partkey", index: 2 }, Column { name: "l_partkey", index: 0 })], filter=CAST(l_quantity@0 AS Decimal128(30, 15)) < __value@1 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 2 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |+| | ProjectionExec: expr=[l_quantity@1 as l_quantity, l_extendedprice@2 as l_extendedprice, p_partkey@3 as p_partkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_partkey", index: 0 }, Column { name: "p_partkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[p_partkey@0 as p_partkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: p_brand@1 = Brand#23 AND p_container@2 = MED BOX |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | ProjectionExec: expr=[l_partkey@0 as l_partkey, CAST(0.2 * CAST(AVG(lineitem.l_quantity)@1 AS Float64) AS Decimal128(30, 15)) as __value] |+| | AggregateExec: mode=FinalPartitioned, gby=[l_partkey@0 as l_partkey], aggr=[AVG(lineitem.l_quantity)] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | AggregateExec: mode=Partial, gby=[l_partkey@0 as l_partkey], aggr=[AVG(lineitem.l_quantity)] |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | |++---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of filediff --git a/benchmarks/expected-plans/q19.txt b/benchmarks/expected-plans/q19.txtindex 77c889d38f..680675c819 100644--- a/benchmarks/expected-plans/q19.txt+++ b/benchmarks/expected-plans/q19.txt@@ -1,34 +1,34 @@-+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| plan_type | plan |-+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| logical_plan | Projection: SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount) AS revenue |-| | Aggregate: groupBy=[[]], aggr=[[SUM(lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - lineitem.l_discount)) AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)]] |-| | Projection: lineitem.l_extendedprice, lineitem.l_discount |-| | Inner Join: lineitem.l_partkey = part.p_partkey Filter: part.p_brand = Utf8("Brand#12") AND part.p_container IN ([Utf8("SM CASE"), Utf8("SM BOX"), Utf8("SM PACK"), Utf8("SM PKG")]) AND lineitem.l_quantity >= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= Decimal128(Some(1100),15,2) AND part.p_size <= Int32(5) OR part.p_brand = Utf8("Brand#23") AND part.p_container IN ([Utf8("MED BAG"), Utf8("MED BOX"), Utf8("MED PKG"), Utf8("MED PACK")]) AND lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND lineitem.l_quantity <= Decimal128(Some(2000),15,2) AND part.p_size <= Int32(10) OR part.p_brand = Utf8("Brand#34") AND part.p_container IN ([Utf8("LG CASE"), Utf8("LG BOX"), Utf8("LG PACK"), Utf8("LG PKG")]) AND lineitem.l_quantity >= Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= Decimal128(Some(3000),15,2) AND part.p_size <= Int32(15) |-| | Projection: lineitem.l_partkey, lineitem.l_quantity, lineitem.l_extendedprice, lineitem.l_discount |-| | Filter: (lineitem.l_quantity >= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND lineitem.l_quantity <= Decimal128(Some(2000),15,2) OR lineitem.l_quantity >= Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= Decimal128(Some(3000),15,2)) AND (lineitem.l_shipmode = Utf8("AIR REG") OR lineitem.l_shipmode = Utf8("AIR")) AND lineitem.l_shipinstruct = Utf8("DELIVER IN PERSON") |-| | TableScan: lineitem projection=[l_partkey, l_quantity, l_extendedprice, l_discount, l_shipinstruct, l_shipmode] |-| | Filter: (part.p_brand = Utf8("Brand#12") AND part.p_container IN ([Utf8("SM CASE"), Utf8("SM BOX"), Utf8("SM PACK"), Utf8("SM PKG")]) AND part.p_size <= Int32(5) OR part.p_brand = Utf8("Brand#23") AND part.p_container IN ([Utf8("MED BAG"), Utf8("MED BOX"), Utf8("MED PKG"), Utf8("MED PACK")]) AND part.p_size <= Int32(10) OR part.p_brand = Utf8("Brand#34") AND part.p_container IN ([Utf8("LG CASE"), Utf8("LG BOX"), Utf8("LG PACK"), Utf8("LG PKG")]) AND part.p_size <= Int32(15)) AND part.p_size >= Int32(1) |-| | TableScan: part projection=[p_partkey, p_brand, p_size, p_container] |-| physical_plan | ProjectionExec: expr=[SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)@0 as revenue] |-| | AggregateExec: mode=Final, gby=[], aggr=[SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)] |-| | CoalescePartitionsExec |-| | AggregateExec: mode=Partial, gby=[], aggr=[SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)] |-| | ProjectionExec: expr=[l_extendedprice@2 as l_extendedprice, l_discount@3 as l_discount] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_partkey", index: 0 }, Column { name: "p_partkey", index: 0 })], filter=BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: Column { name: "p_brand", index: 1 }, op: Eq, right: Literal { value: Utf8("Brand#12") } }, op: And, right: InListExpr { expr: Column { name: "p_container", index: 3 }, list: [Literal { value: Utf8("SM CASE") }, Literal { value: Utf8("SM BOX") }, Literal { value: Utf8("SM PACK") }, Literal { value: Utf8("SM PKG") }], negated: false } }, op: And, right: BinaryExpr { left: Column { name: "l_quantity", index: 0 }, op: GtEq, right: Literal { value: Decimal128(Some(100),15,2) } } }, op: And, right: BinaryExpr { left: Column { name: "l_quantity", index: 0 }, op: LtEq, right: Literal { value: Decimal128(Some(1100),15,2) } } }, op: And, right: BinaryExpr { left: Column { name: "p_size", index: 2 }, op: LtEq, right: Literal { value: Int32(5) } } }, op: Or, right: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: Column { name: "p_brand", index: 1 }, op: Eq, right: Literal { value: Utf8("Brand#23") } }, op: And, right: InListExpr { expr: Column { name: "p_container", index: 3 }, list: [Literal { value: Utf8("MED BAG") }, Literal { value: Utf8("MED BOX") }, Literal { value: Utf8("MED PKG") }, Literal { value: Utf8("MED PACK") }], negated: false } }, op: And, right: BinaryExpr { left: Column { name: "l_quantity", index: 0 }, op: GtEq, right: Literal { value: Decimal128(Some(1000),15,2) } } }, op: And, right: BinaryExpr { left: Column { name: "l_quantity", index: 0 }, op: LtEq, right: Literal { value: Decimal128(Some(2000),15,2) } } }, op: And, right: BinaryExpr { left: Column { name: "p_size", index: 2 }, op: LtEq, right: Literal { value: Int32(10) } } } }, op: Or, right: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: Column { name: "p_brand", index: 1 }, op: Eq, right: Literal { value: Utf8("Brand#34") } }, op: And, right: InListExpr { expr: Column { name: "p_container", index: 3 }, list: [Literal { value: Utf8("LG CASE") }, Literal { value: Utf8("LG BOX") }, Literal { value: Utf8("LG PACK") }, Literal { value: Utf8("LG PKG") }], negated: false } }, op: And, right: BinaryExpr { left: Column { name: "l_quantity", index: 0 }, op: GtEq, right: Literal { value: Decimal128(Some(2000),15,2) } } }, op: And, right: BinaryExpr { left: Column { name: "l_quantity", index: 0 }, op: LtEq, right: Literal { value: Decimal128(Some(3000),15,2) } } }, op: And, right: BinaryExpr { left: Column { name: "p_size", index: 2 }, op: LtEq, right: Literal { value: Int32(15) } } } } |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_quantity@1 as l_quantity, l_extendedprice@2 as l_extendedprice, l_discount@3 as l_discount] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: (l_quantity@1 >= Some(100),15,2 AND l_quantity@1 <= Some(1100),15,2 OR l_quantity@1 >= Some(1000),15,2 AND l_quantity@1 <= Some(2000),15,2 OR l_quantity@1 >= Some(2000),15,2 AND l_quantity@1 <= Some(3000),15,2) AND (l_shipmode@5 = AIR REG OR l_shipmode@5 = AIR) AND l_shipinstruct@4 = DELIVER IN PERSON |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: (p_brand@1 = Brand#12 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("SM CASE") }, Literal { value: Utf8("SM BOX") }, Literal { value: Utf8("SM PACK") }, Literal { value: Utf8("SM PKG") }]) AND p_size@2 <= 5 OR p_brand@1 = Brand#23 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("MED BAG") }, Literal { value: Utf8("MED BOX") }, Literal { value: Utf8("MED PKG") }, Literal { value: Utf8("MED PACK") }]) AND p_size@2 <= 10 OR p_brand@1 = Brand#34 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("LG CASE") }, Literal { value: Utf8("LG BOX") }, Literal { value: Utf8("LG PACK") }, Literal { value: Utf8("LG PKG") }]) AND p_size@2 <= 15) AND p_size@2 >= 1 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | |-+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of file++---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| plan_type | plan |++---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| logical_plan | Projection: SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount) AS revenue |+| | Aggregate: groupBy=[[]], aggr=[[SUM(lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - lineitem.l_discount)) AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)]] |+| | Projection: lineitem.l_extendedprice, lineitem.l_discount |+| | Inner Join: lineitem.l_partkey = part.p_partkey Filter: part.p_brand = Utf8("Brand#12") AND part.p_container IN ([Utf8("SM CASE"), Utf8("SM BOX"), Utf8("SM PACK"), Utf8("SM PKG")]) AND lineitem.l_quantity >= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= Decimal128(Some(1100),15,2) AND part.p_size <= Int32(5) OR part.p_brand = Utf8("Brand#23") AND part.p_container IN ([Utf8("MED BAG"), Utf8("MED BOX"), Utf8("MED PKG"), Utf8("MED PACK")]) AND lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND lineitem.l_quantity <= Decimal128(Some(2000),15,2) AND part.p_size <= Int32(10) OR part.p_brand = Utf8("Brand#34") AND part.p_container IN ([Utf8("LG CASE"), Utf8("LG BOX"), Utf8("LG PACK"), Utf8("LG PKG")]) AND lineitem.l_quantity >= Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= Decimal128(Some(3000),15,2) AND part.p_size <= Int32(15) |+| | Projection: lineitem.l_partkey, lineitem.l_quantity, lineitem.l_extendedprice, lineitem.l_discount |+| | Filter: (lineitem.l_quantity >= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND lineitem.l_quantity <= Decimal128(Some(2000),15,2) OR lineitem.l_quantity >= Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= Decimal128(Some(3000),15,2)) AND (lineitem.l_shipmode = Utf8("AIR REG") OR lineitem.l_shipmode = Utf8("AIR")) AND lineitem.l_shipinstruct = Utf8("DELIVER IN PERSON") |+| | TableScan: lineitem projection=[l_partkey, l_quantity, l_extendedprice, l_discount, l_shipinstruct, l_shipmode] |+| | Filter: (part.p_brand = Utf8("Brand#12") AND part.p_container IN ([Utf8("SM CASE"), Utf8("SM BOX"), Utf8("SM PACK"), Utf8("SM PKG")]) AND part.p_size <= Int32(5) OR part.p_brand = Utf8("Brand#23") AND part.p_container IN ([Utf8("MED BAG"), Utf8("MED BOX"), Utf8("MED PKG"), Utf8("MED PACK")]) AND part.p_size <= Int32(10) OR part.p_brand = Utf8("Brand#34") AND part.p_container IN ([Utf8("LG CASE"), Utf8("LG BOX"), Utf8("LG PACK"), Utf8("LG PKG")]) AND part.p_size <= Int32(15)) AND part.p_size >= Int32(1) |+| | TableScan: part projection=[p_partkey, p_brand, p_size, p_container] |+| physical_plan | ProjectionExec: expr=[SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)@0 as revenue] |+| | AggregateExec: mode=Final, gby=[], aggr=[SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)] |+| | CoalescePartitionsExec |+| | AggregateExec: mode=Partial, gby=[], aggr=[SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)] |+| | ProjectionExec: expr=[l_extendedprice@2 as l_extendedprice, l_discount@3 as l_discount] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_partkey", index: 0 }, Column { name: "p_partkey", index: 0 })], filter=p_brand@1 = Brand#12 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("SM CASE") }, Literal { value: Utf8("SM BOX") }, Literal { value: Utf8("SM PACK") }, Literal { value: Utf8("SM PKG") }]) AND l_quantity@0 >= Some(100),15,2 AND l_quantity@0 <= Some(1100),15,2 AND p_size@2 <= 5 OR p_brand@1 = Brand#23 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("MED BAG") }, Literal { value: Utf8("MED BOX") }, Literal { value: Utf8("MED PKG") }, Literal { value: Utf8("MED PACK") }]) AND l_quantity@0 >= Some(1000),15,2 AND l_quantity@0 <= Some(2000),15,2 AND p_size@2 <= 10 OR p_brand@1 = Brand#34 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("LG CASE") }, Literal { value: Utf8("LG BOX") }, Literal { value: Utf8("LG PACK") }, Literal { value: Utf8("LG PKG") }]) AND l_quantity@0 >= Some(2000),15,2 AND l_quantity@0 <= Some(3000),15,2 AND p_size@2 <= 15 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_quantity@1 as l_quantity, l_extendedprice@2 as l_extendedprice, l_discount@3 as l_discount] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: (l_quantity@1 >= Some(100),15,2 AND l_quantity@1 <= Some(1100),15,2 OR l_quantity@1 >= Some(1000),15,2 AND l_quantity@1 <= Some(2000),15,2 OR l_quantity@1 >= Some(2000),15,2 AND l_quantity@1 <= Some(3000),15,2) AND (l_shipmode@5 = AIR REG OR l_shipmode@5 = AIR) AND l_shipinstruct@4 = DELIVER IN PERSON |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: (p_brand@1 = Brand#12 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("SM CASE") }, Literal { value: Utf8("SM BOX") }, Literal { value: Utf8("SM PACK") }, Literal { value: Utf8("SM PKG") }]) AND p_size@2 <= 5 OR p_brand@1 = Brand#23 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("MED BAG") }, Literal { value: Utf8("MED BOX") }, Literal { value: Utf8("MED PKG") }, Literal { value: Utf8("MED PACK") }]) AND p_size@2 <= 10 OR p_brand@1 = Brand#34 AND Use p_container@3 IN (SET) ([Literal { value: Utf8("LG CASE") }, Literal { value: Utf8("LG BOX") }, Literal { value: Utf8("LG PACK") }, Literal { value: Utf8("LG PKG") }]) AND p_size@2 <= 15) AND p_size@2 >= 1 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | |++---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of filediff --git a/benchmarks/expected-plans/q20.txt b/benchmarks/expected-plans/q20.txtindex 41f2dac583..ffefcf745b 100644--- a/benchmarks/expected-plans/q20.txt+++ b/benchmarks/expected-plans/q20.txt@@ -1,80 +1,80 @@-+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| plan_type | plan |-+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| logical_plan | Sort: supplier.s_name ASC NULLS LAST |-| | Projection: supplier.s_name, supplier.s_address |-| | LeftSemi Join: supplier.s_suppkey = __correlated_sq_1.ps_suppkey |-| | Projection: supplier.s_suppkey, supplier.s_name, supplier.s_address |-| | Inner Join: supplier.s_nationkey = nation.n_nationkey |-| | TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey] |-| | Projection: nation.n_nationkey |-| | Filter: nation.n_name = Utf8("CANADA") |-| | TableScan: nation projection=[n_nationkey, n_name] |-| | SubqueryAlias: __correlated_sq_1 |-| | Projection: partsupp.ps_suppkey |-| | Inner Join: partsupp.ps_partkey = __scalar_sq_1.l_partkey, partsupp.ps_suppkey = __scalar_sq_1.l_suppkey Filter: CAST(partsupp.ps_availqty AS Float64) > __scalar_sq_1.__value |-| | LeftSemi Join: partsupp.ps_partkey = __correlated_sq_2.p_partkey |-| | TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_availqty] |-| | SubqueryAlias: __correlated_sq_2 |-| | Projection: part.p_partkey |-| | Filter: part.p_name LIKE Utf8("forest%") |-| | TableScan: part projection=[p_partkey, p_name] |-| | SubqueryAlias: __scalar_sq_1 |-| | Projection: lineitem.l_partkey, lineitem.l_suppkey, Float64(0.5) * CAST(SUM(lineitem.l_quantity) AS Float64) AS __value |-| | Aggregate: groupBy=[[lineitem.l_partkey, lineitem.l_suppkey]], aggr=[[SUM(lineitem.l_quantity)]] |-| | Projection: lineitem.l_partkey, lineitem.l_suppkey, lineitem.l_quantity |-| | Filter: lineitem.l_shipdate >= Date32("8766") AND lineitem.l_shipdate < Date32("9131") |-| | TableScan: lineitem projection=[l_partkey, l_suppkey, l_quantity, l_shipdate] |-| physical_plan | SortPreservingMergeExec: [s_name@0 ASC NULLS LAST] |-| | SortExec: expr=[s_name@0 ASC NULLS LAST] |-| | ProjectionExec: expr=[s_name@1 as s_name, s_address@2 as s_address] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(Column { name: "s_suppkey", index: 0 }, Column { name: "ps_suppkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_suppkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |-| | ProjectionExec: expr=[s_suppkey@0 as s_suppkey, s_name@1 as s_name, s_address@2 as s_address] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_nationkey", index: 3 }, Column { name: "n_nationkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_nationkey", index: 3 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[n_nationkey@0 as n_nationkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: n_name@1 = CANADA |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "ps_suppkey", index: 0 }], 2), input_partitions=2 |-| | ProjectionExec: expr=[ps_suppkey@1 as ps_suppkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "ps_partkey", index: 0 }, Column { name: "l_partkey", index: 0 }), (Column { name: "ps_suppkey", index: 1 }, Column { name: "l_suppkey", index: 1 })], filter=BinaryExpr { left: CastExpr { expr: Column { name: "ps_availqty", index: 0 }, cast_type: Float64, cast_options: CastOptions { safe: false } }, op: Gt, right: Column { name: "__value", index: 1 } } |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "ps_partkey", index: 0 }, Column { name: "ps_suppkey", index: 1 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(Column { name: "ps_partkey", index: 0 }, Column { name: "p_partkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "ps_partkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[p_partkey@0 as p_partkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: p_name@1 LIKE forest% |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey, 0.5 * CAST(SUM(lineitem.l_quantity)@2 AS Float64) as __value] |-| | AggregateExec: mode=FinalPartitioned, gby=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey], aggr=[SUM(lineitem.l_quantity)] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }, Column { name: "l_suppkey", index: 1 }], 2), input_partitions=2 |-| | AggregateExec: mode=Partial, gby=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey], aggr=[SUM(lineitem.l_quantity)] |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey, l_quantity@2 as l_quantity] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: l_shipdate@3 >= 8766 AND l_shipdate@3 < 9131 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | |-+---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of file++---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| plan_type | plan |++---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| logical_plan | Sort: supplier.s_name ASC NULLS LAST |+| | Projection: supplier.s_name, supplier.s_address |+| | LeftSemi Join: supplier.s_suppkey = __correlated_sq_1.ps_suppkey |+| | Projection: supplier.s_suppkey, supplier.s_name, supplier.s_address |+| | Inner Join: supplier.s_nationkey = nation.n_nationkey |+| | TableScan: supplier projection=[s_suppkey, s_name, s_address, s_nationkey] |+| | Projection: nation.n_nationkey |+| | Filter: nation.n_name = Utf8("CANADA") |+| | TableScan: nation projection=[n_nationkey, n_name] |+| | SubqueryAlias: __correlated_sq_1 |+| | Projection: partsupp.ps_suppkey |+| | Inner Join: partsupp.ps_partkey = __scalar_sq_1.l_partkey, partsupp.ps_suppkey = __scalar_sq_1.l_suppkey Filter: CAST(partsupp.ps_availqty AS Float64) > __scalar_sq_1.__value |+| | LeftSemi Join: partsupp.ps_partkey = __correlated_sq_2.p_partkey |+| | TableScan: partsupp projection=[ps_partkey, ps_suppkey, ps_availqty] |+| | SubqueryAlias: __correlated_sq_2 |+| | Projection: part.p_partkey |+| | Filter: part.p_name LIKE Utf8("forest%") |+| | TableScan: part projection=[p_partkey, p_name] |+| | SubqueryAlias: __scalar_sq_1 |+| | Projection: lineitem.l_partkey, lineitem.l_suppkey, Float64(0.5) * CAST(SUM(lineitem.l_quantity) AS Float64) AS __value |+| | Aggregate: groupBy=[[lineitem.l_partkey, lineitem.l_suppkey]], aggr=[[SUM(lineitem.l_quantity)]] |+| | Projection: lineitem.l_partkey, lineitem.l_suppkey, lineitem.l_quantity |+| | Filter: lineitem.l_shipdate >= Date32("8766") AND lineitem.l_shipdate < Date32("9131") |+| | TableScan: lineitem projection=[l_partkey, l_suppkey, l_quantity, l_shipdate] |+| physical_plan | SortPreservingMergeExec: [s_name@0 ASC NULLS LAST] |+| | SortExec: expr=[s_name@0 ASC NULLS LAST] |+| | ProjectionExec: expr=[s_name@1 as s_name, s_address@2 as s_address] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(Column { name: "s_suppkey", index: 0 }, Column { name: "ps_suppkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_suppkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |+| | ProjectionExec: expr=[s_suppkey@0 as s_suppkey, s_name@1 as s_name, s_address@2 as s_address] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_nationkey", index: 3 }, Column { name: "n_nationkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_nationkey", index: 3 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[n_nationkey@0 as n_nationkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: n_name@1 = CANADA |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "ps_suppkey", index: 0 }], 2), input_partitions=2 |+| | ProjectionExec: expr=[ps_suppkey@1 as ps_suppkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "ps_partkey", index: 0 }, Column { name: "l_partkey", index: 0 }), (Column { name: "ps_suppkey", index: 1 }, Column { name: "l_suppkey", index: 1 })], filter=CAST(ps_availqty@0 AS Float64) > __value@1 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "ps_partkey", index: 0 }, Column { name: "ps_suppkey", index: 1 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(Column { name: "ps_partkey", index: 0 }, Column { name: "p_partkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "ps_partkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "p_partkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[p_partkey@0 as p_partkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: p_name@1 LIKE forest% |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey, 0.5 * CAST(SUM(lineitem.l_quantity)@2 AS Float64) as __value] |+| | AggregateExec: mode=FinalPartitioned, gby=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey], aggr=[SUM(lineitem.l_quantity)] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_partkey", index: 0 }, Column { name: "l_suppkey", index: 1 }], 2), input_partitions=2 |+| | AggregateExec: mode=Partial, gby=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey], aggr=[SUM(lineitem.l_quantity)] |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey, l_quantity@2 as l_quantity] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: l_shipdate@3 >= 8766 AND l_shipdate@3 < 9131 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | |++---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of filediff --git a/benchmarks/expected-plans/q21.txt b/benchmarks/expected-plans/q21.txtindex 67605f5c44..7bed769096 100644--- a/benchmarks/expected-plans/q21.txt+++ b/benchmarks/expected-plans/q21.txt@@ -1,98 +1,98 @@-+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| plan_type | plan |-+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| logical_plan | Sort: numwait DESC NULLS FIRST, supplier.s_name ASC NULLS LAST |-| | Projection: supplier.s_name, COUNT(UInt8(1)) AS numwait |-| | Aggregate: groupBy=[[supplier.s_name]], aggr=[[COUNT(UInt8(1))]] |-| | Projection: supplier.s_name |-| | LeftAnti Join: l1.l_orderkey = __correlated_sq_2.l_orderkey Filter: __correlated_sq_2.l_suppkey != l1.l_suppkey |-| | LeftSemi Join: l1.l_orderkey = __correlated_sq_1.l_orderkey Filter: __correlated_sq_1.l_suppkey != l1.l_suppkey |-| | Projection: supplier.s_name, l1.l_orderkey, l1.l_suppkey |-| | Inner Join: supplier.s_nationkey = nation.n_nationkey |-| | Projection: supplier.s_name, supplier.s_nationkey, l1.l_orderkey, l1.l_suppkey |-| | Inner Join: l1.l_orderkey = orders.o_orderkey |-| | Projection: supplier.s_name, supplier.s_nationkey, l1.l_orderkey, l1.l_suppkey |-| | Inner Join: supplier.s_suppkey = l1.l_suppkey |-| | TableScan: supplier projection=[s_suppkey, s_name, s_nationkey] |-| | SubqueryAlias: l1 |-| | Projection: lineitem.l_orderkey, lineitem.l_suppkey |-| | Filter: lineitem.l_receiptdate > lineitem.l_commitdate |-| | TableScan: lineitem projection=[l_orderkey, l_suppkey, l_commitdate, l_receiptdate] |-| | Projection: orders.o_orderkey |-| | Filter: orders.o_orderstatus = Utf8("F") |-| | TableScan: orders projection=[o_orderkey, o_orderstatus] |-| | Projection: nation.n_nationkey |-| | Filter: nation.n_name = Utf8("SAUDI ARABIA") |-| | TableScan: nation projection=[n_nationkey, n_name] |-| | SubqueryAlias: __correlated_sq_1 |-| | SubqueryAlias: l2 |-| | TableScan: lineitem projection=[l_orderkey, l_suppkey] |-| | SubqueryAlias: __correlated_sq_2 |-| | SubqueryAlias: l3 |-| | Projection: lineitem.l_orderkey, lineitem.l_suppkey |-| | Filter: lineitem.l_receiptdate > lineitem.l_commitdate |-| | TableScan: lineitem projection=[l_orderkey, l_suppkey, l_commitdate, l_receiptdate] |-| physical_plan | SortPreservingMergeExec: [numwait@1 DESC,s_name@0 ASC NULLS LAST] |-| | SortExec: expr=[numwait@1 DESC,s_name@0 ASC NULLS LAST] |-| | ProjectionExec: expr=[s_name@0 as s_name, COUNT(UInt8(1))@1 as numwait] |-| | AggregateExec: mode=FinalPartitioned, gby=[s_name@0 as s_name], aggr=[COUNT(UInt8(1))] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_name", index: 0 }], 2), input_partitions=2 |-| | AggregateExec: mode=Partial, gby=[s_name@0 as s_name], aggr=[COUNT(UInt8(1))] |-| | ProjectionExec: expr=[s_name@0 as s_name] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=LeftAnti, on=[(Column { name: "l_orderkey", index: 1 }, Column { name: "l_orderkey", index: 0 })], filter=BinaryExpr { left: Column { name: "l_suppkey", index: 1 }, op: NotEq, right: Column { name: "l_suppkey", index: 0 } } |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(Column { name: "l_orderkey", index: 1 }, Column { name: "l_orderkey", index: 0 })], filter=BinaryExpr { left: Column { name: "l_suppkey", index: 1 }, op: NotEq, right: Column { name: "l_suppkey", index: 0 } } |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 1 }], 2), input_partitions=2 |-| | ProjectionExec: expr=[s_name@0 as s_name, l_orderkey@2 as l_orderkey, l_suppkey@3 as l_suppkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_nationkey", index: 1 }, Column { name: "n_nationkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_nationkey", index: 1 }], 2), input_partitions=2 |-| | ProjectionExec: expr=[s_name@0 as s_name, s_nationkey@1 as s_nationkey, l_orderkey@2 as l_orderkey, l_suppkey@3 as l_suppkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_orderkey", index: 2 }, Column { name: "o_orderkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 2 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |-| | ProjectionExec: expr=[s_name@1 as s_name, s_nationkey@2 as s_nationkey, l_orderkey@3 as l_orderkey, l_suppkey@4 as l_suppkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_suppkey", index: 0 }, Column { name: "l_suppkey", index: 1 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_suppkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_suppkey", index: 1 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[l_orderkey@0 as l_orderkey, l_suppkey@1 as l_suppkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: l_receiptdate@3 > l_commitdate@2 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "o_orderkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[o_orderkey@0 as o_orderkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: o_orderstatus@1 = F |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[n_nationkey@0 as n_nationkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: n_name@1 = SAUDI ARABIA |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | ProjectionExec: expr=[l_orderkey@0 as l_orderkey, l_suppkey@1 as l_suppkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: l_receiptdate@3 > l_commitdate@2 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | |-+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of file++---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| plan_type | plan |++---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| logical_plan | Sort: numwait DESC NULLS FIRST, supplier.s_name ASC NULLS LAST |+| | Projection: supplier.s_name, COUNT(UInt8(1)) AS numwait |+| | Aggregate: groupBy=[[supplier.s_name]], aggr=[[COUNT(UInt8(1))]] |+| | Projection: supplier.s_name |+| | LeftAnti Join: l1.l_orderkey = __correlated_sq_2.l_orderkey Filter: __correlated_sq_2.l_suppkey != l1.l_suppkey |+| | LeftSemi Join: l1.l_orderkey = __correlated_sq_1.l_orderkey Filter: __correlated_sq_1.l_suppkey != l1.l_suppkey |+| | Projection: supplier.s_name, l1.l_orderkey, l1.l_suppkey |+| | Inner Join: supplier.s_nationkey = nation.n_nationkey |+| | Projection: supplier.s_name, supplier.s_nationkey, l1.l_orderkey, l1.l_suppkey |+| | Inner Join: l1.l_orderkey = orders.o_orderkey |+| | Projection: supplier.s_name, supplier.s_nationkey, l1.l_orderkey, l1.l_suppkey |+| | Inner Join: supplier.s_suppkey = l1.l_suppkey |+| | TableScan: supplier projection=[s_suppkey, s_name, s_nationkey] |+| | SubqueryAlias: l1 |+| | Projection: lineitem.l_orderkey, lineitem.l_suppkey |+| | Filter: lineitem.l_receiptdate > lineitem.l_commitdate |+| | TableScan: lineitem projection=[l_orderkey, l_suppkey, l_commitdate, l_receiptdate] |+| | Projection: orders.o_orderkey |+| | Filter: orders.o_orderstatus = Utf8("F") |+| | TableScan: orders projection=[o_orderkey, o_orderstatus] |+| | Projection: nation.n_nationkey |+| | Filter: nation.n_name = Utf8("SAUDI ARABIA") |+| | TableScan: nation projection=[n_nationkey, n_name] |+| | SubqueryAlias: __correlated_sq_1 |+| | SubqueryAlias: l2 |+| | TableScan: lineitem projection=[l_orderkey, l_suppkey] |+| | SubqueryAlias: __correlated_sq_2 |+| | SubqueryAlias: l3 |+| | Projection: lineitem.l_orderkey, lineitem.l_suppkey |+| | Filter: lineitem.l_receiptdate > lineitem.l_commitdate |+| | TableScan: lineitem projection=[l_orderkey, l_suppkey, l_commitdate, l_receiptdate] |+| physical_plan | SortPreservingMergeExec: [numwait@1 DESC,s_name@0 ASC NULLS LAST] |+| | SortExec: expr=[numwait@1 DESC,s_name@0 ASC NULLS LAST] |+| | ProjectionExec: expr=[s_name@0 as s_name, COUNT(UInt8(1))@1 as numwait] |+| | AggregateExec: mode=FinalPartitioned, gby=[s_name@0 as s_name], aggr=[COUNT(UInt8(1))] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_name", index: 0 }], 2), input_partitions=2 |+| | AggregateExec: mode=Partial, gby=[s_name@0 as s_name], aggr=[COUNT(UInt8(1))] |+| | ProjectionExec: expr=[s_name@0 as s_name] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=LeftAnti, on=[(Column { name: "l_orderkey", index: 1 }, Column { name: "l_orderkey", index: 0 })], filter=l_suppkey@1 != l_suppkey@0 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(Column { name: "l_orderkey", index: 1 }, Column { name: "l_orderkey", index: 0 })], filter=l_suppkey@1 != l_suppkey@0 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 1 }], 2), input_partitions=2 |+| | ProjectionExec: expr=[s_name@0 as s_name, l_orderkey@2 as l_orderkey, l_suppkey@3 as l_suppkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_nationkey", index: 1 }, Column { name: "n_nationkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_nationkey", index: 1 }], 2), input_partitions=2 |+| | ProjectionExec: expr=[s_name@0 as s_name, s_nationkey@1 as s_nationkey, l_orderkey@2 as l_orderkey, l_suppkey@3 as l_suppkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_orderkey", index: 2 }, Column { name: "o_orderkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 2 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |+| | ProjectionExec: expr=[s_name@1 as s_name, s_nationkey@2 as s_nationkey, l_orderkey@3 as l_orderkey, l_suppkey@4 as l_suppkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_suppkey", index: 0 }, Column { name: "l_suppkey", index: 1 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_suppkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_suppkey", index: 1 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[l_orderkey@0 as l_orderkey, l_suppkey@1 as l_suppkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: l_receiptdate@3 > l_commitdate@2 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "o_orderkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[o_orderkey@0 as o_orderkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: o_orderstatus@1 = F |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[n_nationkey@0 as n_nationkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: n_name@1 = SAUDI ARABIA |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | ProjectionExec: expr=[l_orderkey@0 as l_orderkey, l_suppkey@1 as l_suppkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: l_receiptdate@3 > l_commitdate@2 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | |++---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of filediff --git a/benchmarks/expected-plans/q7.txt b/benchmarks/expected-plans/q7.txtindex 572ee28ff0..341f76c1d1 100644--- a/benchmarks/expected-plans/q7.txt+++ b/benchmarks/expected-plans/q7.txt@@ -1,88 +1,88 @@-+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| plan_type | plan |-+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-| logical_plan | Sort: shipping.supp_nation ASC NULLS LAST, shipping.cust_nation ASC NULLS LAST, shipping.l_year ASC NULLS LAST |-| | Projection: shipping.supp_nation, shipping.cust_nation, shipping.l_year, SUM(shipping.volume) AS revenue |-| | Aggregate: groupBy=[[shipping.supp_nation, shipping.cust_nation, shipping.l_year]], aggr=[[SUM(shipping.volume)]] |-| | SubqueryAlias: shipping |-| | Projection: n1.n_name AS supp_nation, n2.n_name AS cust_nation, datepart(Utf8("YEAR"), lineitem.l_shipdate) AS l_year, lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - lineitem.l_discount) AS volume |-| | Inner Join: customer.c_nationkey = n2.n_nationkey Filter: n1.n_name = Utf8("FRANCE") AND n2.n_name = Utf8("GERMANY") OR n1.n_name = Utf8("GERMANY") AND n2.n_name = Utf8("FRANCE") |-| | Projection: lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate, customer.c_nationkey, n1.n_name |-| | Inner Join: supplier.s_nationkey = n1.n_nationkey |-| | Projection: supplier.s_nationkey, lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate, customer.c_nationkey |-| | Inner Join: orders.o_custkey = customer.c_custkey |-| | Projection: supplier.s_nationkey, lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate, orders.o_custkey |-| | Inner Join: lineitem.l_orderkey = orders.o_orderkey |-| | Projection: supplier.s_nationkey, lineitem.l_orderkey, lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate |-| | Inner Join: supplier.s_suppkey = lineitem.l_suppkey |-| | TableScan: supplier projection=[s_suppkey, s_nationkey] |-| | Filter: lineitem.l_shipdate >= Date32("9131") AND lineitem.l_shipdate <= Date32("9861") |-| | TableScan: lineitem projection=[l_orderkey, l_suppkey, l_extendedprice, l_discount, l_shipdate] |-| | TableScan: orders projection=[o_orderkey, o_custkey] |-| | TableScan: customer projection=[c_custkey, c_nationkey] |-| | SubqueryAlias: n1 |-| | Filter: nation.n_name = Utf8("FRANCE") OR nation.n_name = Utf8("GERMANY") |-| | TableScan: nation projection=[n_nationkey, n_name] |-| | SubqueryAlias: n2 |-| | Filter: nation.n_name = Utf8("GERMANY") OR nation.n_name = Utf8("FRANCE") |-| | TableScan: nation projection=[n_nationkey, n_name] |-| physical_plan | SortPreservingMergeExec: [supp_nation@0 ASC NULLS LAST,cust_nation@1 ASC NULLS LAST,l_year@2 ASC NULLS LAST] |-| | SortExec: expr=[supp_nation@0 ASC NULLS LAST,cust_nation@1 ASC NULLS LAST,l_year@2 ASC NULLS LAST] |-| | ProjectionExec: expr=[supp_nation@0 as supp_nation, cust_nation@1 as cust_nation, l_year@2 as l_year, SUM(shipping.volume)@3 as revenue] |-| | AggregateExec: mode=FinalPartitioned, gby=[supp_nation@0 as supp_nation, cust_nation@1 as cust_nation, l_year@2 as l_year], aggr=[SUM(shipping.volume)] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "supp_nation", index: 0 }, Column { name: "cust_nation", index: 1 }, Column { name: "l_year", index: 2 }], 2), input_partitions=2 |-| | AggregateExec: mode=Partial, gby=[supp_nation@0 as supp_nation, cust_nation@1 as cust_nation, l_year@2 as l_year], aggr=[SUM(shipping.volume)] |-| | ProjectionExec: expr=[n_name@4 as supp_nation, n_name@6 as cust_nation, datepart(YEAR, l_shipdate@2) as l_year, l_extendedprice@0 * (Some(1),20,0 - l_discount@1) as volume] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "c_nationkey", index: 3 }, Column { name: "n_nationkey", index: 0 })], filter=BinaryExpr { left: BinaryExpr { left: BinaryExpr { left: Column { name: "n_name", index: 0 }, op: Eq, right: Literal { value: Utf8("FRANCE") } }, op: And, right: BinaryExpr { left: Column { name: "n_name", index: 1 }, op: Eq, right: Literal { value: Utf8("GERMANY") } } }, op: Or, right: BinaryExpr { left: BinaryExpr { left: Column { name: "n_name", index: 0 }, op: Eq, right: Literal { value: Utf8("GERMANY") } }, op: And, right: BinaryExpr { left: Column { name: "n_name", index: 1 }, op: Eq, right: Literal { value: Utf8("FRANCE") } } } } |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "c_nationkey", index: 3 }], 2), input_partitions=2 |-| | ProjectionExec: expr=[l_extendedprice@1 as l_extendedprice, l_discount@2 as l_discount, l_shipdate@3 as l_shipdate, c_nationkey@4 as c_nationkey, n_name@6 as n_name] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_nationkey", index: 0 }, Column { name: "n_nationkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_nationkey", index: 0 }], 2), input_partitions=2 |-| | ProjectionExec: expr=[s_nationkey@0 as s_nationkey, l_extendedprice@1 as l_extendedprice, l_discount@2 as l_discount, l_shipdate@3 as l_shipdate, c_nationkey@6 as c_nationkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "o_custkey", index: 4 }, Column { name: "c_custkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "o_custkey", index: 4 }], 2), input_partitions=2 |-| | ProjectionExec: expr=[s_nationkey@0 as s_nationkey, l_extendedprice@2 as l_extendedprice, l_discount@3 as l_discount, l_shipdate@4 as l_shipdate, o_custkey@6 as o_custkey] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_orderkey", index: 1 }, Column { name: "o_orderkey", index: 0 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 1 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |-| | ProjectionExec: expr=[s_nationkey@1 as s_nationkey, l_orderkey@2 as l_orderkey, l_extendedprice@4 as l_extendedprice, l_discount@5 as l_discount, l_shipdate@6 as l_shipdate] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_suppkey", index: 0 }, Column { name: "l_suppkey", index: 1 })] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "s_suppkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "l_suppkey", index: 1 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: l_shipdate@4 >= 9131 AND l_shipdate@4 <= 9861 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "o_orderkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "c_custkey", index: 0 }], 2), input_partitions=0 |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: n_name@1 = FRANCE OR n_name@1 = GERMANY |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |-| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |-| | CoalesceBatchesExec: target_batch_size=8192 |-| | FilterExec: n_name@1 = GERMANY OR n_name@1 = FRANCE |-| | MemoryExec: partitions=0, partition_sizes=[] |-| | |-+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of file++---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| plan_type | plan |++---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------++| logical_plan | Sort: shipping.supp_nation ASC NULLS LAST, shipping.cust_nation ASC NULLS LAST, shipping.l_year ASC NULLS LAST |+| | Projection: shipping.supp_nation, shipping.cust_nation, shipping.l_year, SUM(shipping.volume) AS revenue |+| | Aggregate: groupBy=[[shipping.supp_nation, shipping.cust_nation, shipping.l_year]], aggr=[[SUM(shipping.volume)]] |+| | SubqueryAlias: shipping |+| | Projection: n1.n_name AS supp_nation, n2.n_name AS cust_nation, datepart(Utf8("YEAR"), lineitem.l_shipdate) AS l_year, lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - lineitem.l_discount) AS volume |+| | Inner Join: customer.c_nationkey = n2.n_nationkey Filter: n1.n_name = Utf8("FRANCE") AND n2.n_name = Utf8("GERMANY") OR n1.n_name = Utf8("GERMANY") AND n2.n_name = Utf8("FRANCE") |+| | Projection: lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate, customer.c_nationkey, n1.n_name |+| | Inner Join: supplier.s_nationkey = n1.n_nationkey |+| | Projection: supplier.s_nationkey, lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate, customer.c_nationkey |+| | Inner Join: orders.o_custkey = customer.c_custkey |+| | Projection: supplier.s_nationkey, lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate, orders.o_custkey |+| | Inner Join: lineitem.l_orderkey = orders.o_orderkey |+| | Projection: supplier.s_nationkey, lineitem.l_orderkey, lineitem.l_extendedprice, lineitem.l_discount, lineitem.l_shipdate |+| | Inner Join: supplier.s_suppkey = lineitem.l_suppkey |+| | TableScan: supplier projection=[s_suppkey, s_nationkey] |+| | Filter: lineitem.l_shipdate >= Date32("9131") AND lineitem.l_shipdate <= Date32("9861") |+| | TableScan: lineitem projection=[l_orderkey, l_suppkey, l_extendedprice, l_discount, l_shipdate] |+| | TableScan: orders projection=[o_orderkey, o_custkey] |+| | TableScan: customer projection=[c_custkey, c_nationkey] |+| | SubqueryAlias: n1 |+| | Filter: nation.n_name = Utf8("FRANCE") OR nation.n_name = Utf8("GERMANY") |+| | TableScan: nation projection=[n_nationkey, n_name] |+| | SubqueryAlias: n2 |+| | Filter: nation.n_name = Utf8("GERMANY") OR nation.n_name = Utf8("FRANCE") |+| | TableScan: nation projection=[n_nationkey, n_name] |+| physical_plan | SortPreservingMergeExec: [supp_nation@0 ASC NULLS LAST,cust_nation@1 ASC NULLS LAST,l_year@2 ASC NULLS LAST] |+| | SortExec: expr=[supp_nation@0 ASC NULLS LAST,cust_nation@1 ASC NULLS LAST,l_year@2 ASC NULLS LAST] |+| | ProjectionExec: expr=[supp_nation@0 as supp_nation, cust_nation@1 as cust_nation, l_year@2 as l_year, SUM(shipping.volume)@3 as revenue] |+| | AggregateExec: mode=FinalPartitioned, gby=[supp_nation@0 as supp_nation, cust_nation@1 as cust_nation, l_year@2 as l_year], aggr=[SUM(shipping.volume)] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "supp_nation", index: 0 }, Column { name: "cust_nation", index: 1 }, Column { name: "l_year", index: 2 }], 2), input_partitions=2 |+| | AggregateExec: mode=Partial, gby=[supp_nation@0 as supp_nation, cust_nation@1 as cust_nation, l_year@2 as l_year], aggr=[SUM(shipping.volume)] |+| | ProjectionExec: expr=[n_name@4 as supp_nation, n_name@6 as cust_nation, datepart(YEAR, l_shipdate@2) as l_year, l_extendedprice@0 * (Some(1),20,0 - l_discount@1) as volume] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "c_nationkey", index: 3 }, Column { name: "n_nationkey", index: 0 })], filter=n_name@0 = FRANCE AND n_name@1 = GERMANY OR n_name@0 = GERMANY AND n_name@1 = FRANCE |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "c_nationkey", index: 3 }], 2), input_partitions=2 |+| | ProjectionExec: expr=[l_extendedprice@1 as l_extendedprice, l_discount@2 as l_discount, l_shipdate@3 as l_shipdate, c_nationkey@4 as c_nationkey, n_name@6 as n_name] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_nationkey", index: 0 }, Column { name: "n_nationkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_nationkey", index: 0 }], 2), input_partitions=2 |+| | ProjectionExec: expr=[s_nationkey@0 as s_nationkey, l_extendedprice@1 as l_extendedprice, l_discount@2 as l_discount, l_shipdate@3 as l_shipdate, c_nationkey@6 as c_nationkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "o_custkey", index: 4 }, Column { name: "c_custkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "o_custkey", index: 4 }], 2), input_partitions=2 |+| | ProjectionExec: expr=[s_nationkey@0 as s_nationkey, l_extendedprice@2 as l_extendedprice, l_discount@3 as l_discount, l_shipdate@4 as l_shipdate, o_custkey@6 as o_custkey] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "l_orderkey", index: 1 }, Column { name: "o_orderkey", index: 0 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_orderkey", index: 1 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=2 |+| | ProjectionExec: expr=[s_nationkey@1 as s_nationkey, l_orderkey@2 as l_orderkey, l_extendedprice@4 as l_extendedprice, l_discount@5 as l_discount, l_shipdate@6 as l_shipdate] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "s_suppkey", index: 0 }, Column { name: "l_suppkey", index: 1 })] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "s_suppkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "l_suppkey", index: 1 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: l_shipdate@4 >= 9131 AND l_shipdate@4 <= 9861 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "o_orderkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "c_custkey", index: 0 }], 2), input_partitions=0 |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: n_name@1 = FRANCE OR n_name@1 = GERMANY |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | RepartitionExec: partitioning=Hash([Column { name: "n_nationkey", index: 0 }], 2), input_partitions=2 |+| | RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=0 |+| | CoalesceBatchesExec: target_batch_size=8192 |+| | FilterExec: n_name@1 = GERMANY OR n_name@1 = FRANCE |+| | MemoryExec: partitions=0, partition_sizes=[] |+| | |++---------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\ No newline at end of filediff --git a/datafusion-cli/Cargo.lock b/datafusion-cli/Cargo.lockindex c7dbb875aa..9deb4726bb 100644--- a/datafusion-cli/Cargo.lock+++ b/datafusion-cli/Cargo.lock@@ -68,9 +68,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"[[package]]name = "arrow"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "218ca81dd088b102c0fd6687c72e73fad1ba93d2ef7b3cf9a1043b04b2c39dbf"+checksum = "6619cab21a0cdd8c9b9f1d9e09bfaa9b1974e5ef809a6566aef0b998caf38ace"dependencies = ["ahash","arrow-arith",@@ -90,9 +90,9 @@ dependencies = [[[package]]name = "arrow-arith"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d49309fa2299ec34a709cfc9f487c41ecaead96d1ab70e21857466346bbbd690"+checksum = "e0dc95485623a76e00929bda8caa40c1f838190952365c4f43a7b9ae86d03e94"dependencies = ["arrow-array","arrow-buffer",@@ -105,9 +105,9 @@ dependencies = [[[package]]name = "arrow-array"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e7a27466d897d99654357a6d95dc0a26931d9e4306e60c14fc31a894edb86579"+checksum = "3267847f53d3042473cfd2c769afd8d74a6d7d201fc3a34f5cb84c0282ef47a7"dependencies = ["ahash","arrow-buffer",@@ -122,9 +122,9 @@ dependencies = [[[package]]name = "arrow-buffer"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9405b78106a9d767c7b97c78a70ee1b23ee51a74f5188a821a716d9a85d1af2b"+checksum = "c5f66553e66e120ac4b21570368ee9ebf35ff3f5399f872b0667699e145678f5"dependencies = ["half","num",@@ -132,9 +132,9 @@ dependencies = [[[package]]name = "arrow-cast"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "be0ec5a79a87783dc828b7ff8f89f62880b3f553bc5f5b932a82f4a1035024b4"+checksum = "65e6f3579dbf0d97c683d451b2550062b0f0e62a3169bf74238b5f59f44ad6d8"dependencies = ["arrow-array","arrow-buffer",@@ -149,9 +149,9 @@ dependencies = [[[package]]name = "arrow-csv"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "350d8e55c3b2d602a0a04389bcc1da40167657143a9922a7103190603e7b7692"+checksum = "373579c4c1a8f5307d3125b7a89c700fcf8caf85821c77eb4baab3855ae0aba5"dependencies = ["arrow-array","arrow-buffer",@@ -168,9 +168,9 @@ dependencies = [[[package]]name = "arrow-data"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c6f710d98964d2c069b8baf566130045e79e11baa105623f038a6c942f805681"+checksum = "61bc8df9912cca6642665fdf989d6fa0de2570f18a7f709bcf59d29de96d2097"dependencies = ["arrow-buffer","arrow-schema",@@ -180,9 +180,9 @@ dependencies = [[[package]]name = "arrow-ipc"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9c99787cb8fabc187285da9e7182d22f2b80ecfac61ca0a42c4299e9eecdf903"+checksum = "0105dcf5f91daa7182d87b713ee0b32b3bfc88e0c48e7dc3e9d6f1277a07d1ae"dependencies = ["arrow-array","arrow-buffer",@@ -194,9 +194,9 @@ dependencies = [[[package]]name = "arrow-json"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "91c95a58ce63f60d80d7a3a1222d65df0bc060b71d31353c34a8118c2a6eae7b"+checksum = "e73134fb5b5ec8770f8cbb214c2c487b2d350081e403ca4eeeb6f8f5e19846ac"dependencies = ["arrow-array","arrow-buffer",@@ -214,9 +214,9 @@ dependencies = [[[package]]name = "arrow-ord"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4141e6488610cc144e841da3de5f5371488f3cf5bc6bc7b3e752c64e7639c31b"+checksum = "89f25bc66e18d4c2aa1fe2f9bb03e2269da60e636213210385ae41a107f9965a"dependencies = ["arrow-array","arrow-buffer",@@ -229,9 +229,9 @@ dependencies = [[[package]]name = "arrow-row"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "940191a3c636c111c41e816325b0941484bf904c46de72cd9553acd1afd24d33"+checksum = "1095ff85ea4f5ff02d17b30b089de31b51a50be01c6b674f0a0509ab771232f1"dependencies = ["ahash","arrow-array",@@ -244,15 +244,15 @@ dependencies = [[[package]]name = "arrow-schema"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "18c41d058b2895a12f46dfafc306ee3529ad9660406be0ab8a7967d5e27c417e"+checksum = "25187bbef474151a2e4ddec67b9e34bda5cbfba292dc571392fa3a1f71ff5a82"[[package]]name = "arrow-select"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9fcbdda2772b7e712e77444f3a71f4ee517095aceb993b35de71de41c70d9b4f"+checksum = "fd0d4ee884aec3aa05e41478e3cd312bf609de9babb5d187a43fb45931da4da4"dependencies = ["arrow-array","arrow-buffer",@@ -263,9 +263,9 @@ dependencies = [[[package]]name = "arrow-string"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7081c34f4b534ad320a03db79d58e38972041bb7c65686b98bbcc2f9a67a9cee"+checksum = "d6d71c3ffe4c07e66ce8fdc6aed5b00e0e60c5144911879b10546f5b72d8fa1c"dependencies = ["arrow-array","arrow-buffer",@@ -2114,9 +2114,9 @@ dependencies = [[[package]]name = "parquet"-version = "39.0.0"+version = "40.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b0a1e6fa27f09ebddba280f5966ef435f3ac4d74cfc3ffe370fd3fd59c2e004d"+checksum = "d6a656fcc17e641657c955742c689732684e096f790ff30865d9f8dcc39f7c4a"dependencies = ["ahash","arrow-array",diff --git a/datafusion-cli/Cargo.toml b/datafusion-cli/Cargo.tomlindex 5045cb204e..7106307435 100644--- a/datafusion-cli/Cargo.toml+++ b/datafusion-cli/Cargo.toml@@ -29,7 +29,7 @@ rust-version = "1.62"readme = "README.md"[dependencies]-arrow = "39.0.0"+arrow = "40.0.0"async-trait = "0.1.41"clap = { version = "3", features = ["derive", "cargo"] }datafusion = { path = "../datafusion/core", version = "25.0.0" }diff --git a/datafusion-cli/src/print_format.rs b/datafusion-cli/src/print_format.rsindex a6938428bc..de9e140f5c 100644--- a/datafusion-cli/src/print_format.rs+++ b/datafusion-cli/src/print_format.rs@@ -46,7 +46,7 @@ macro_rules! batches_to_json {let mut bytes = vec![];{let mut writer = $WRITER::new(&mut bytes);- writer.write_batches($batches)?;+ $batches.iter().try_for_each(|batch| writer.write(batch))?;writer.finish()?;}String::from_utf8(bytes).map_err(|e| DataFusionError::External(Box::new(e)))?diff --git a/datafusion-examples/examples/deserialize_to_struct.rs b/datafusion-examples/examples/deserialize_to_struct.rsindex 3bfc7d096a..e999fc4dac 100644--- a/datafusion-examples/examples/deserialize_to_struct.rs+++ b/datafusion-examples/examples/deserialize_to_struct.rs@@ -61,14 +61,15 @@ impl Data {df.collect().await?};+ let batches: Vec<_> = batches.iter().collect();+// converts it to serde_json type and then convert that into Rust type- let list =- datafusion::arrow::json::writer::record_batches_to_json_rows(&batches[..])?- .into_iter()- .map(|val| serde_json::from_value(serde_json::Value::Object(val)))- .take_while(|val| val.is_ok())- .map(|val| val.unwrap())- .collect();+ let list = arrow::json::writer::record_batches_to_json_rows(&batches[..])?+ .into_iter()+ .map(|val| serde_json::from_value(serde_json::Value::Object(val)))+ .take_while(|val| val.is_ok())+ .map(|val| val.unwrap())+ .collect();Ok(list)}diff --git a/datafusion/common/src/scalar.rs b/datafusion/common/src/scalar.rsindex 16a88c283d..13f9d9f900 100644--- a/datafusion/common/src/scalar.rs+++ b/datafusion/common/src/scalar.rs@@ -36,7 +36,7 @@ use arrow::compute::nullif;use arrow::datatypes::{FieldRef, Fields, SchemaBuilder};use arrow::{array::*,- compute::kernels::cast::{cast, cast_with_options, CastOptions},+ compute::kernels::cast::{cast_with_options, CastOptions},datatypes::{ArrowDictionaryKeyType, ArrowNativeType, DataType, Field, Float32Type,Float64Type, Int16Type, Int32Type, Int64Type, Int8Type, IntervalDayTimeType,@@ -1760,17 +1760,17 @@ macro_rules! build_array_from_option {None => new_null_array(&DataType::$DATA_TYPE($ENUM), $SIZE),}}};- ($DATA_TYPE:ident, $ENUM:expr, $ENUM2:expr, $ARRAY_TYPE:ident, $EXPR:expr, $SIZE:expr) => {{+}++macro_rules! build_timestamp_array_from_option {+ ($TIME_UNIT:expr, $TZ:expr, $ARRAY_TYPE:ident, $EXPR:expr, $SIZE:expr) => {match $EXPR {Some(value) => {- let array: ArrayRef = Arc::new($ARRAY_TYPE::from_value(*value, $SIZE));- // Need to call cast to cast to final data type with timezone/extra param- cast(&array, &DataType::$DATA_TYPE($ENUM, $ENUM2))- .expect("cannot do temporal cast")+ Arc::new($ARRAY_TYPE::from_value(*value, $SIZE).with_timezone_opt($TZ))}- None => new_null_array(&DataType::$DATA_TYPE($ENUM, $ENUM2), $SIZE),+ None => new_null_array(&DataType::Timestamp($TIME_UNIT, $TZ), $SIZE),}- }};+ };}macro_rules! eq_array_primitive {@@ -2718,39 +2718,43 @@ impl ScalarValue {ScalarValue::UInt64(e) => {build_array_from_option!(UInt64, UInt64Array, e, size)}- ScalarValue::TimestampSecond(e, tz_opt) => build_array_from_option!(- Timestamp,- TimeUnit::Second,- tz_opt.clone(),- TimestampSecondArray,- e,- size- ),- ScalarValue::TimestampMillisecond(e, tz_opt) => build_array_from_option!(- Timestamp,- TimeUnit::Millisecond,- tz_opt.clone(),- TimestampMillisecondArray,- e,- size- ),+ ScalarValue::TimestampSecond(e, tz_opt) => {+ build_timestamp_array_from_option!(+ TimeUnit::Second,+ tz_opt.clone(),+ TimestampSecondArray,+ e,+ size+ )+ }+ ScalarValue::TimestampMillisecond(e, tz_opt) => {+ build_timestamp_array_from_option!(+ TimeUnit::Millisecond,+ tz_opt.clone(),+ TimestampMillisecondArray,+ e,+ size+ )+ }- ScalarValue::TimestampMicrosecond(e, tz_opt) => build_array_from_option!(- Timestamp,- TimeUnit::Microsecond,- tz_opt.clone(),- TimestampMicrosecondArray,- e,- size- ),- ScalarValue::TimestampNanosecond(e, tz_opt) => build_array_from_option!(- Timestamp,- TimeUnit::Nanosecond,- tz_opt.clone(),- TimestampNanosecondArray,- e,- size- ),+ ScalarValue::TimestampMicrosecond(e, tz_opt) => {+ build_timestamp_array_from_option!(+ TimeUnit::Microsecond,+ tz_opt.clone(),+ TimestampMicrosecondArray,+ e,+ size+ )+ }+ ScalarValue::TimestampNanosecond(e, tz_opt) => {+ build_timestamp_array_from_option!(+ TimeUnit::Nanosecond,+ tz_opt.clone(),+ TimestampNanosecondArray,+ e,+ size+ )+ }ScalarValue::Utf8(e) => match e {Some(value) => {Arc::new(StringArray::from_iter_values(repeat(value).take(size)))@@ -3128,7 +3132,10 @@ impl ScalarValue {/// Try to parse `value` into a ScalarValue of type `target_type`pub fn try_from_string(value: String, target_type: &DataType) -> Result<Self> {let value = ScalarValue::Utf8(Some(value));- let cast_options = CastOptions { safe: false };+ let cast_options = CastOptions {+ safe: false,+ format_options: Default::default(),+ };let cast_arr = cast_with_options(&value.to_array(), target_type, &cast_options)?;ScalarValue::try_from_array(&cast_arr, 0)}diff --git a/datafusion/core/src/physical_optimizer/pruning.rs b/datafusion/core/src/physical_optimizer/pruning.rsindex 8260619a1b..a5f5b635c5 100644--- a/datafusion/core/src/physical_optimizer/pruning.rs+++ b/datafusion/core/src/physical_optimizer/pruning.rs@@ -38,7 +38,6 @@ use crate::{logical_expr::Operator,physical_plan::{ColumnarValue, PhysicalExpr},};-use arrow::compute::DEFAULT_CAST_OPTIONS;use arrow::record_batch::RecordBatchOptions;use arrow::{array::{new_null_array, ArrayRef, BooleanArray},@@ -549,7 +548,7 @@ fn rewrite_expr_to_prunable(let left = Arc::new(phys_expr::CastExpr::new(left,cast.cast_type().clone(),- DEFAULT_CAST_OPTIONS,+ None,));Ok((left, op, right))} else if let Some(try_cast) =diff --git a/datafusion/core/src/physical_plan/aggregates/mod.rs b/datafusion/core/src/physical_plan/aggregates/mod.rsindex 247dfc2778..5e6c5656c8 100644--- a/datafusion/core/src/physical_plan/aggregates/mod.rs+++ b/datafusion/core/src/physical_plan/aggregates/mod.rs@@ -30,7 +30,6 @@ use crate::physical_plan::{SendableRecordBatchStream, Statistics,};use arrow::array::ArrayRef;-use arrow::compute::DEFAULT_CAST_OPTIONS;use arrow::datatypes::{Field, Schema, SchemaRef};use arrow::record_batch::RecordBatch;use datafusion_common::utils::longest_consecutive_prefix;@@ -883,7 +882,7 @@ fn aggregate_expressions(.into_iter().map(|expr| {pre_cast_type.clone().map_or(expr.clone(), |cast_type| {- Arc::new(CastExpr::new(expr, cast_type, DEFAULT_CAST_OPTIONS))+ Arc::new(CastExpr::new(expr, cast_type, None))})}).collect::<Vec<_>>()diff --git a/datafusion/core/src/physical_plan/file_format/json.rs b/datafusion/core/src/physical_plan/file_format/json.rsindex bb686b55a0..071c51b8c0 100644--- a/datafusion/core/src/physical_plan/file_format/json.rs+++ b/datafusion/core/src/physical_plan/file_format/json.rs@@ -268,7 +268,7 @@ pub async fn plan_to_json(let stream = plan.execute(i, task_ctx.clone())?;let handle: JoinHandle<Result<()>> = task::spawn(async move {stream- .map(|batch| writer.write(batch?))+ .map(|batch| writer.write(&batch?)).try_collect().await.map_err(DataFusionError::from)diff --git a/datafusion/core/src/physical_plan/joins/hash_join.rs b/datafusion/core/src/physical_plan/joins/hash_join.rsindex d2759ac75b..2c8f8b55da 100644--- a/datafusion/core/src/physical_plan/joins/hash_join.rs+++ b/datafusion/core/src/physical_plan/joins/hash_join.rs@@ -422,7 +422,7 @@ impl ExecutionPlan for HashJoinExec {DisplayFormatType::Default => {let display_filter = self.filter.as_ref().map_or_else(|| "".to_string(),- |f| format!(", filter={:?}", f.expression()),+ |f| format!(", filter={}", f.expression()),);write!(f,diff --git a/datafusion/core/src/physical_plan/joins/symmetric_hash_join.rs b/datafusion/core/src/physical_plan/joins/symmetric_hash_join.rsindex 9013fb2692..66c3cbbce6 100644--- a/datafusion/core/src/physical_plan/joins/symmetric_hash_join.rs+++ b/datafusion/core/src/physical_plan/joins/symmetric_hash_join.rs@@ -458,7 +458,7 @@ impl ExecutionPlan for SymmetricHashJoinExec {DisplayFormatType::Default => {let display_filter = self.filter.as_ref().map_or_else(|| "".to_string(),- |f| format!(", filter={:?}", f.expression()),+ |f| format!(", filter={}", f.expression()),);write!(f,@@ -2451,7 +2451,7 @@ mod tests {let formatted = displayable(physical_plan.as_ref()).indent().to_string();let expected = {[- "SymmetricHashJoinExec: join_type=Full, on=[(Column { name: \"a2\", index: 1 }, Column { name: \"a2\", index: 1 })], filter=BinaryExpr { left: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 0 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Gt, right: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 1 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Plus, right: Literal { value: Int64(3) } } }, op: And, right: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 0 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Lt, right: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 1 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Plus, right: Literal { value: Int64(10) } } } }",+ "SymmetricHashJoinExec: join_type=Full, on=[(Column { name: \"a2\", index: 1 }, Column { name: \"a2\", index: 1 })], filter=CAST(a1@0 AS Int64) > CAST(a1@1 AS Int64) + 3 AND CAST(a1@0 AS Int64) < CAST(a1@1 AS Int64) + 10"," CoalesceBatchesExec: target_batch_size=8192"," RepartitionExec: partitioning=Hash([Column { name: \"a2\", index: 1 }], 8), input_partitions=1",// " CsvExec: file_groups={1 group: [[tempdir/left.csv]]}, projection=[a1, a2], has_header=false",@@ -2504,7 +2504,7 @@ mod tests {let formatted = displayable(physical_plan.as_ref()).indent().to_string();let expected = {[- "SymmetricHashJoinExec: join_type=Full, on=[(Column { name: \"a2\", index: 1 }, Column { name: \"a2\", index: 1 })], filter=BinaryExpr { left: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 0 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Gt, right: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 1 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Plus, right: Literal { value: Int64(3) } } }, op: And, right: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 0 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Lt, right: BinaryExpr { left: CastExpr { expr: Column { name: \"a1\", index: 1 }, cast_type: Int64, cast_options: CastOptions { safe: false } }, op: Plus, right: Literal { value: Int64(10) } } } }",+ "SymmetricHashJoinExec: join_type=Full, on=[(Column { name: \"a2\", index: 1 }, Column { name: \"a2\", index: 1 })], filter=CAST(a1@0 AS Int64) > CAST(a1@1 AS Int64) + 3 AND CAST(a1@0 AS Int64) < CAST(a1@1 AS Int64) + 10"," CoalesceBatchesExec: target_batch_size=8192"," RepartitionExec: partitioning=Hash([Column { name: \"a2\", index: 1 }], 8), input_partitions=1",// " CsvExec: file_groups={1 group: [[tempdir/left.csv]]}, projection=[a1, a2], has_header=false",diff --git a/datafusion/core/tests/sql/joins.rs b/datafusion/core/tests/sql/joins.rsindex 57343ea95c..32e3de7483 100644--- a/datafusion/core/tests/sql/joins.rs+++ b/datafusion/core/tests/sql/joins.rs@@ -1268,10 +1268,11 @@ async fn right_semi_join() -> Result<()> {let dataframe = ctx.sql(sql).await.expect(&msg);let physical_plan = dataframe.create_physical_plan().await?;let expected = if repartition_joins {- vec!["SortPreservingMergeExec: [t1_id@0 ASC NULLS LAST]",+ vec![+ "SortPreservingMergeExec: [t1_id@0 ASC NULLS LAST]"," SortExec: expr=[t1_id@0 ASC NULLS LAST]"," CoalesceBatchesExec: target_batch_size=4096",- " HashJoinExec: mode=Partitioned, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=BinaryExpr { left: Column { name: \"t2_name\", index: 1 }, op: NotEq, right: Column { name: \"t1_name\", index: 0 } }",+ " HashJoinExec: mode=Partitioned, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=t2_name@1 != t1_name@0"," CoalesceBatchesExec: target_batch_size=4096"," RepartitionExec: partitioning=Hash([Column { name: \"t2_id\", index: 0 }], 2), input_partitions=2"," RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1",@@ -1285,7 +1286,7 @@ async fn right_semi_join() -> Result<()> {vec!["SortExec: expr=[t1_id@0 ASC NULLS LAST]"," CoalesceBatchesExec: target_batch_size=4096",- " HashJoinExec: mode=CollectLeft, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=BinaryExpr { left: Column { name: \"t2_name\", index: 1 }, op: NotEq, right: Column { name: \"t1_name\", index: 0 } }",+ " HashJoinExec: mode=CollectLeft, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=t2_name@1 != t1_name@0"," MemoryExec: partitions=1, partition_sizes=[1]"," MemoryExec: partitions=1, partition_sizes=[1]",]@@ -1312,24 +1313,25 @@ async fn right_semi_join() -> Result<()> {let dataframe = ctx.sql(sql).await.expect(&msg);let physical_plan = dataframe.create_physical_plan().await?;let expected = if repartition_joins {- vec!["SortPreservingMergeExec: [t1_id@0 ASC NULLS LAST]",- " SortExec: expr=[t1_id@0 ASC NULLS LAST]",- " CoalesceBatchesExec: target_batch_size=4096",- " HashJoinExec: mode=Partitioned, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=BinaryExpr { left: Column { name: \"t2_name\", index: 0 }, op: NotEq, right: Column { name: \"t1_name\", index: 1 } }",- " CoalesceBatchesExec: target_batch_size=4096",- " RepartitionExec: partitioning=Hash([Column { name: \"t2_id\", index: 0 }], 2), input_partitions=2",- " RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1",- " MemoryExec: partitions=1, partition_sizes=[1]",- " CoalesceBatchesExec: target_batch_size=4096",- " RepartitionExec: partitioning=Hash([Column { name: \"t1_id\", index: 0 }], 2), input_partitions=2",- " RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1",- " MemoryExec: partitions=1, partition_sizes=[1]",+ vec![+ "SortPreservingMergeExec: [t1_id@0 ASC NULLS LAST]",+ " SortExec: expr=[t1_id@0 ASC NULLS LAST]",+ " CoalesceBatchesExec: target_batch_size=4096",+ " HashJoinExec: mode=Partitioned, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=t2_name@0 != t1_name@1",+ " CoalesceBatchesExec: target_batch_size=4096",+ " RepartitionExec: partitioning=Hash([Column { name: \"t2_id\", index: 0 }], 2), input_partitions=2",+ " RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1",+ " MemoryExec: partitions=1, partition_sizes=[1]",+ " CoalesceBatchesExec: target_batch_size=4096",+ " RepartitionExec: partitioning=Hash([Column { name: \"t1_id\", index: 0 }], 2), input_partitions=2",+ " RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1",+ " MemoryExec: partitions=1, partition_sizes=[1]",]} else {vec!["SortExec: expr=[t1_id@0 ASC NULLS LAST]"," CoalesceBatchesExec: target_batch_size=4096",- " HashJoinExec: mode=CollectLeft, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=BinaryExpr { left: Column { name: \"t2_name\", index: 0 }, op: NotEq, right: Column { name: \"t1_name\", index: 1 } }",+ " HashJoinExec: mode=CollectLeft, join_type=RightSemi, on=[(Column { name: \"t2_id\", index: 0 }, Column { name: \"t1_id\", index: 0 })], filter=t2_name@0 != t1_name@1"," MemoryExec: partitions=1, partition_sizes=[1]"," MemoryExec: partitions=1, partition_sizes=[1]",]diff --git a/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt b/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.sltindex 0bf0816a84..4a3d39bdeb 100644--- a/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt+++ b/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt@@ -321,13 +321,12 @@ select arrow_cast(timestamp '2000-01-01T00:00:00', 'Timestamp(Nanosecond, Some(query Pselect arrow_cast(timestamp '2000-01-01T00:00:00', 'Timestamp(Nanosecond, Some( "+08:00" ))');-----2000-01-01T08:00:00+08:00+2000-01-01T00:00:00+08:00-# once https://github.com/apache/arrow-rs/issues/1936 fixed, please update this queryquery Pselect arrow_cast(timestamp '2000-01-01T00:00:00Z', 'Timestamp(Nanosecond, Some( "+08:00" ))');-----2000-01-01T08:00:00+08:00+2000-01-01T00:00:00+08:00statement error Arrow error: Parser error: Invalid timezone "\+25:00": '\+25:00' is not a valid timezoneselect arrow_cast(timestamp '2000-01-01T00:00:00', 'Timestamp(Nanosecond, Some( "+25:00" ))');diff --git a/datafusion/core/tests/sqllogictests/test_files/set_variable.slt b/datafusion/core/tests/sqllogictests/test_files/set_variable.sltindex 3c276f346e..04e3715fd3 100644--- a/datafusion/core/tests/sqllogictests/test_files/set_variable.slt+++ b/datafusion/core/tests/sqllogictests/test_files/set_variable.slt@@ -193,7 +193,7 @@ SET TIME ZONE = '+08:00'query PSELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ-----2000-01-01T08:00:00+08:00+2000-01-01T00:00:00+08:00statement okSET TIME ZONE = '-08:00'@@ -201,7 +201,7 @@ SET TIME ZONE = '-08:00'query PSELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ-----1999-12-31T16:00:00-08:00+2000-01-01T00:00:00-08:00statement okSET TIME ZONE = '+0800'@@ -209,7 +209,7 @@ SET TIME ZONE = '+0800'query PSELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ-----2000-01-01T08:00:00+08:00+2000-01-01T00:00:00+08:00statement okSET TIME ZONE = '+08'@@ -217,7 +217,7 @@ SET TIME ZONE = '+08'query PSELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ-----2000-01-01T08:00:00+08:00+2000-01-01T00:00:00+08:00# set time zone bad time zone formatstatement ok@@ -247,7 +247,7 @@ SET TIME ZONE = 'Asia/Taipei'query PSELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ-----2000-01-01T08:00:00+08:00+2000-01-01T00:00:00+08:00statement okSET TIME ZONE = 'Asia/Taipei2'diff --git a/datafusion/optimizer/src/unwrap_cast_in_comparison.rs b/datafusion/optimizer/src/unwrap_cast_in_comparison.rsindex 807ce9bb0d..2c70ad0e9a 100644--- a/datafusion/optimizer/src/unwrap_cast_in_comparison.rs+++ b/datafusion/optimizer/src/unwrap_cast_in_comparison.rs@@ -957,7 +957,7 @@ mod tests {TimeUnit::Microsecond,TimeUnit::Nanosecond,] {- let utc = Some("+0:00".into());+ let utc = Some("+00:00".into());// No timezone, utc timezonelet (lit_tz_none, lit_tz_utc) = match time_unit {TimeUnit::Second => (@@ -1098,7 +1098,7 @@ mod tests {let cast_array = cast_with_options(&literal_array,&target_type,- &CastOptions { safe: true },+ &CastOptions::default(),).expect("Expected to be cast array with arrow cast kernel");diff --git a/datafusion/physical-expr/src/expressions/binary.rs b/datafusion/physical-expr/src/expressions/binary.rsindex 46acbe6b5e..841a8dcf75 100644--- a/datafusion/physical-expr/src/expressions/binary.rs+++ b/datafusion/physical-expr/src/expressions/binary.rs@@ -697,9 +697,9 @@ impl PhysicalExpr for BinaryExpr {&right_data_type,);let (left_value, right_value) = if let Some(coerced_type) = coerced_type {- let options = CastOptions { safe: true };- let left_value = cast_column(&left_value, &coerced_type, &options)?;- let right_value = cast_column(&right_value, &coerced_type, &options)?;+ let options = CastOptions::default();+ let left_value = cast_column(&left_value, &coerced_type, Some(&options))?;+ let right_value = cast_column(&right_value, &coerced_type, Some(&options))?;(left_value, right_value)} else {// No need to coerce if it is not decimal or not math operationdiff --git a/datafusion/physical-expr/src/expressions/cast.rs b/datafusion/physical-expr/src/expressions/cast.rsindex ff659edf0d..07038498ca 100644--- a/datafusion/physical-expr/src/expressions/cast.rs+++ b/datafusion/physical-expr/src/expressions/cast.rs@@ -23,8 +23,7 @@ use crate::intervals::Interval;use crate::physical_expr::down_cast_any_ref;use crate::PhysicalExpr;use arrow::compute;-use arrow::compute::kernels;-use arrow::compute::CastOptions;+use arrow::compute::{kernels, CastOptions};use arrow::datatypes::{DataType, Schema};use arrow::record_batch::RecordBatch;use compute::can_cast_types;@@ -33,7 +32,12 @@ use datafusion_common::{DataFusionError, Result};use datafusion_expr::ColumnarValue;/// provide DataFusion default cast options-pub const DEFAULT_DATAFUSION_CAST_OPTIONS: CastOptions = CastOptions { safe: false };+fn default_cast_options() -> CastOptions<'static> {+ CastOptions {+ safe: false,+ format_options: Default::default(),+ }+}/// CAST expression casts an expression to a specific data type and returns a runtime error on invalid cast#[derive(Debug)]@@ -43,7 +47,7 @@ pub struct CastExpr {/// The data type to cast tocast_type: DataType,/// Cast options- cast_options: CastOptions,+ cast_options: CastOptions<'static>,}impl CastExpr {@@ -51,12 +55,12 @@ impl CastExpr {pub fn new(expr: Arc<dyn PhysicalExpr>,cast_type: DataType,- cast_options: CastOptions,+ cast_options: Option<CastOptions<'static>>,) -> Self {Self {expr,cast_type,- cast_options,+ cast_options: cast_options.unwrap_or_else(default_cast_options),}}@@ -69,10 +73,6 @@ impl CastExpr {pub fn cast_type(&self) -> &DataType {&self.cast_type}- /// The data type to cast to- pub fn cast_options(&self) -> &CastOptions {- &self.cast_options- }}impl fmt::Display for CastExpr {@@ -97,7 +97,7 @@ impl PhysicalExpr for CastExpr {fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue> {let value = self.expr.evaluate(batch)?;- cast_column(&value, &self.cast_type, &self.cast_options)+ cast_column(&value, &self.cast_type, Some(&self.cast_options))}fn children(&self) -> Vec<Arc<dyn PhysicalExpr>> {@@ -111,9 +111,7 @@ impl PhysicalExpr for CastExpr {Ok(Arc::new(CastExpr::new(children[0].clone(),self.cast_type.clone(),- CastOptions {- safe: self.cast_options.safe,- },+ Some(self.cast_options.clone()),)))}@@ -154,16 +152,20 @@ impl PartialEq<dyn Any> for CastExpr {pub fn cast_column(value: &ColumnarValue,cast_type: &DataType,- cast_options: &CastOptions,+ cast_options: Option<&CastOptions<'static>>,) -> Result<ColumnarValue> {+ let cast_options = cast_options.cloned().unwrap_or_else(default_cast_options);match value {ColumnarValue::Array(array) => Ok(ColumnarValue::Array(- kernels::cast::cast_with_options(array, cast_type, cast_options)?,+ kernels::cast::cast_with_options(array, cast_type, &cast_options)?,)),ColumnarValue::Scalar(scalar) => {let scalar_array = scalar.to_array();- let cast_array =- kernels::cast::cast_with_options(&scalar_array, cast_type, cast_options)?;+ let cast_array = kernels::cast::cast_with_options(+ &scalar_array,+ cast_type,+ &cast_options,+ )?;let cast_scalar = ScalarValue::try_from_array(&cast_array, 0)?;Ok(ColumnarValue::Scalar(cast_scalar))}@@ -178,7 +180,7 @@ pub fn cast_with_options(expr: Arc<dyn PhysicalExpr>,input_schema: &Schema,cast_type: DataType,- cast_options: CastOptions,+ cast_options: Option<CastOptions<'static>>,) -> Result<Arc<dyn PhysicalExpr>> {let expr_type = expr.data_type(input_schema)?;if expr_type == cast_type {@@ -201,12 +203,7 @@ pub fn cast(input_schema: &Schema,cast_type: DataType,) -> Result<Arc<dyn PhysicalExpr>> {- cast_with_options(- expr,- input_schema,- cast_type,- DEFAULT_DATAFUSION_CAST_OPTIONS,- )+ cast_with_options(expr, input_schema, cast_type, None)}#[cfg(test)]@@ -352,7 +349,7 @@ mod tests {Some(5_000_000),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);let decimal_array = array@@ -366,7 +363,7 @@ mod tests {Decimal128Array,DataType::Decimal128(10, 2),vec![Some(123), Some(222), Some(0), Some(400), Some(500), None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);Ok(())@@ -394,7 +391,7 @@ mod tests {Some(5_i8),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// decimal to i16@@ -416,7 +413,7 @@ mod tests {Some(5_i16),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// decimal to i32@@ -438,7 +435,7 @@ mod tests {Some(5_i32),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// decimal to i64@@ -459,7 +456,7 @@ mod tests {Some(5_i64),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// decimal to float32@@ -489,7 +486,7 @@ mod tests {Some(5.0_f32),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// decimal to float64@@ -510,7 +507,7 @@ mod tests {Some(0.005_f64),None,],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);Ok(())}@@ -525,7 +522,7 @@ mod tests {Decimal128Array,DataType::Decimal128(3, 0),vec![Some(1), Some(2), Some(3), Some(4), Some(5),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// int16@@ -536,7 +533,7 @@ mod tests {Decimal128Array,DataType::Decimal128(5, 0),vec![Some(1), Some(2), Some(3), Some(4), Some(5),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// int32@@ -547,7 +544,7 @@ mod tests {Decimal128Array,DataType::Decimal128(10, 0),vec![Some(1), Some(2), Some(3), Some(4), Some(5),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// int64@@ -558,7 +555,7 @@ mod tests {Decimal128Array,DataType::Decimal128(20, 0),vec![Some(1), Some(2), Some(3), Some(4), Some(5),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// int64 to different scale@@ -569,7 +566,7 @@ mod tests {Decimal128Array,DataType::Decimal128(20, 2),vec![Some(100), Some(200), Some(300), Some(400), Some(500),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// float32@@ -580,7 +577,7 @@ mod tests {Decimal128Array,DataType::Decimal128(10, 2),vec![Some(150), Some(250), Some(300), Some(112), Some(550),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);// float64@@ -597,7 +594,7 @@ mod tests {Some(11235),Some(55000),],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);Ok(())}@@ -617,7 +614,7 @@ mod tests {Some(4_u32),Some(5_u32)],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);Ok(())}@@ -631,7 +628,7 @@ mod tests {StringArray,DataType::Utf8,vec![Some("1"), Some("2"), Some("3"), Some("4"), Some("5")],- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);Ok(())}@@ -651,7 +648,7 @@ mod tests {TimestampNanosecondArray,DataType::Timestamp(TimeUnit::Nanosecond, None),expected,- DEFAULT_DATAFUSION_CAST_OPTIONS+ None);Ok(())}@@ -671,12 +668,8 @@ mod tests {let schema = Schema::new(vec![Field::new("a", DataType::Utf8, false)]);let a = StringArray::from(vec!["9.1"]);let batch = RecordBatch::try_new(Arc::new(schema.clone()), vec![Arc::new(a)])?;- let expression = cast_with_options(- col("a", &schema)?,- &schema,- DataType::Int32,- DEFAULT_DATAFUSION_CAST_OPTIONS,- )?;+ let expression =+ cast_with_options(col("a", &schema)?, &schema, DataType::Int32, None)?;let result = expression.evaluate(&batch);match result {@@ -700,7 +693,7 @@ mod tests {col("a", &schema)?,&schema,DataType::Decimal128(38, 38),- DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)?;expression.evaluate(&batch)?;Ok(())diff --git a/datafusion/physical-expr/src/expressions/mod.rs b/datafusion/physical-expr/src/expressions/mod.rsindex 140556b765..e65d17fa28 100644--- a/datafusion/physical-expr/src/expressions/mod.rs+++ b/datafusion/physical-expr/src/expressions/mod.rs@@ -76,9 +76,7 @@ pub use crate::window::row_number::RowNumber;pub use binary::{binary, BinaryExpr};pub use case::{case, CaseExpr};-pub use cast::{- cast, cast_column, cast_with_options, CastExpr, DEFAULT_DATAFUSION_CAST_OPTIONS,-};+pub use cast::{cast, cast_column, cast_with_options, CastExpr};pub use column::{col, Column, UnKnownColumn};pub use datetime::{date_time_interval_expr, DateTimeIntervalExpr};pub use get_indexed_field::GetIndexedFieldExpr;diff --git a/datafusion/physical-expr/src/functions.rs b/datafusion/physical-expr/src/functions.rsindex 2dbf4559dd..498d611995 100644--- a/datafusion/physical-expr/src/functions.rs+++ b/datafusion/physical-expr/src/functions.rs@@ -33,7 +33,7 @@use crate::execution_props::ExecutionProps;use crate::{array_expressions, conditional_expressions, datetime_expressions,- expressions::{cast_column, nullif_func, DEFAULT_DATAFUSION_CAST_OPTIONS},+ expressions::{cast_column, nullif_func},math_expressions, string_expressions, struct_expressions, PhysicalExpr,ScalarFunctionExpr,};@@ -76,7 +76,7 @@ pub fn create_physical_expr(cast_column(&col_values[0],&DataType::Timestamp(TimeUnit::Nanosecond, None),- &DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)}}@@ -95,7 +95,7 @@ pub fn create_physical_expr(cast_column(&col_values[0],&DataType::Timestamp(TimeUnit::Millisecond, None),- &DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)}}@@ -114,7 +114,7 @@ pub fn create_physical_expr(cast_column(&col_values[0],&DataType::Timestamp(TimeUnit::Microsecond, None),- &DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)}}@@ -133,7 +133,7 @@ pub fn create_physical_expr(cast_column(&col_values[0],&DataType::Timestamp(TimeUnit::Second, None),- &DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)}}@@ -151,7 +151,7 @@ pub fn create_physical_expr(cast_column(&col_values[0],&DataType::Timestamp(TimeUnit::Second, None),- &DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)},other => {diff --git a/datafusion/proto/src/physical_plan/from_proto.rs b/datafusion/proto/src/physical_plan/from_proto.rsindex 1290db0752..f8f55242a8 100644--- a/datafusion/proto/src/physical_plan/from_proto.rs+++ b/datafusion/proto/src/physical_plan/from_proto.rs@@ -36,7 +36,7 @@ use datafusion::physical_plan::file_format::FileScanConfig;use datafusion::physical_plan::{expressions::{BinaryExpr, CaseExpr, CastExpr, Column, IsNotNullExpr, IsNullExpr, Literal,- NegativeExpr, NotExpr, TryCastExpr, DEFAULT_DATAFUSION_CAST_OPTIONS,+ NegativeExpr, NotExpr, TryCastExpr,},functions, Partitioning,};@@ -237,7 +237,7 @@ pub fn parse_physical_expr(input_schema,)?,convert_required!(e.arrow_type)?,- DEFAULT_DATAFUSION_CAST_OPTIONS,+ None,)),ExprType::TryCast(e) => Arc::new(TryCastExpr::new(parse_required_physical_expr(