Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal multiply kernel should not cause precision loss #5675

Closed
wants to merge 17 commits into from
46 changes: 23 additions & 23 deletions benchmarks/expected-plans/q1.txt

Large diffs are not rendered by default.

126 changes: 63 additions & 63 deletions benchmarks/expected-plans/q10.txt

Large diffs are not rendered by default.

178 changes: 89 additions & 89 deletions benchmarks/expected-plans/q11.txt

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions benchmarks/expected-plans/q14.txt

Large diffs are not rendered by default.

132 changes: 66 additions & 66 deletions benchmarks/expected-plans/q15.txt

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions benchmarks/expected-plans/q17.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Projection: CAST(SUM(lineitem.l_extendedprice) AS Float64) / Float64(7) AS avg_yearly |
| logical_plan | Projection: PROMOTE_PRECISION(CAST(SUM(lineitem.l_extendedprice) AS Float64)) / Float64(7) AS avg_yearly |
| | Aggregate: groupBy=[[]], aggr=[[SUM(lineitem.l_extendedprice)]] |
| | Projection: lineitem.l_extendedprice |
| | Filter: CAST(lineitem.l_quantity AS Decimal128(30, 15)) < CAST(__scalar_sq_1.__value AS Decimal128(30, 15)) AND __scalar_sq_1.l_partkey = lineitem.l_partkey |
Expand All @@ -14,10 +14,10 @@
| | 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, Float64(0.2) * CAST(AVG(lineitem.l_quantity) AS Float64) AS __value |
| | Projection: lineitem.l_partkey, Float64(0.2) * PROMOTE_PRECISION(CAST(AVG(lineitem.l_quantity) AS Float64)) 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] |
| physical_plan | ProjectionExec: expr=[PROMOTE_PRECISION(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)] |
Expand All @@ -44,7 +44,7 @@
| | 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, 0.2 * CAST(AVG(lineitem.l_quantity)@1 AS Float64) as __value] |
| | ProjectionExec: expr=[l_partkey@0 as l_partkey, 0.2 * PROMOTE_PRECISION(CAST(AVG(lineitem.l_quantity)@1 AS Float64)) 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 |
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/expected-plans/q19.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| plan_type | plan |
+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | Projection: SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount) AS revenue |
| | Aggregate: groupBy=[[]], aggr=[[SUM(CAST(lineitem.l_extendedprice AS Decimal128(38, 4)) * CAST(Decimal128(Some(100),23,2) - CAST(lineitem.l_discount AS Decimal128(23, 2)) AS Decimal128(38, 4))) AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)]] |
| | Aggregate: groupBy=[[]], aggr=[[SUM(PROMOTE_PRECISION(CAST(lineitem.l_extendedprice AS Decimal128(23, 2))) * PROMOTE_PRECISION(CAST(Decimal128(Some(100),23,2) - PROMOTE_PRECISION(CAST(lineitem.l_discount AS Decimal128(23, 2))) AS Decimal128(23, 2)))) AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount)]] |
| | Projection: lineitem.l_extendedprice, lineitem.l_discount |
| | 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_quantity, lineitem.l_extendedprice, lineitem.l_discount, part.p_brand, part.p_size, part.p_container |
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/expected-plans/q20.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
| | 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 |
| | Projection: lineitem.l_partkey, lineitem.l_suppkey, Float64(0.5) * PROMOTE_PRECISION(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") |
Expand Down Expand Up @@ -71,7 +71,7 @@
| | 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] |
| | ProjectionExec: expr=[l_partkey@0 as l_partkey, l_suppkey@1 as l_suppkey, 0.5 * PROMOTE_PRECISION(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 |
Expand Down
Loading