[NOT-MERGE] poc: aritmetic in math.rs#2223
Draft
davidlghellin wants to merge 1 commit into
Draft
Conversation
Spark 3.5.7 Test ReportCommit Information
Test Summary
Test DetailsError CountsPassed Tests Diff--- before.txt 2026-07-11 14:42:27.152848687 +0000
+++ after.txt 2026-07-11 14:42:27.277847458 +0000
@@ -264,0 +265 @@
+pyspark/sql/functions.py::pyspark.sql.functions.first
@@ -1274,0 +1276 @@
+pyspark/sql/tests/connect/test_parity_udtf.py::ArrowUDTFParityTests::test_udtf_with_table_argument_multiple
@@ -1338,0 +1341 @@
+pyspark/sql/tests/connect/test_parity_udtf.py::UDTFParityTests::test_udtf_with_table_argument_multipleFailed Tests |
Spark 4.1.1 Test ReportCommit Information
Test Summary
Test DetailsError CountsPassed Tests Diff--- before.txt 2026-07-11 14:44:56.863016661 +0000
+++ after.txt 2026-07-11 14:44:57.218020932 +0000
@@ -279,0 +280 @@
+pyspark/sql/functions/builtin.py::pyspark.sql.functions.builtin.first
@@ -503,0 +505 @@
+pyspark/sql/functions/builtin.py::pyspark.sql.functions.builtin.to_xml
@@ -2138,0 +2141 @@
+pyspark/sql/tests/connect/test_parity_udtf.py::ArrowUDTFParityTests::test_udtf_with_table_argument_multiple
@@ -2225,0 +2229 @@
+pyspark/sql/tests/connect/test_parity_udtf.py::LegacyArrowUDTFParityTests::test_udtf_with_table_argument_multiple
@@ -2318,0 +2323 @@
+pyspark/sql/tests/connect/test_parity_udtf.py::UDTFParityTests::test_udtf_with_table_argument_multipleFailed Tests(truncated) |
Ibis Test ReportCommit Information
Test Summary
Test DetailsError CountsPassed Tests Diff--- before.txt 2026-07-11 14:43:45.194773516 +0000
+++ after.txt 2026-07-11 14:43:45.389773928 +0000
@@ -58,0 +59,3 @@
+ibis/backends/tests/test_aggregation.py::test_aggregate_list_like[pyspark-list]
+ibis/backends/tests/test_aggregation.py::test_aggregate_list_like[pyspark-ndarray]
+ibis/backends/tests/test_aggregation.py::test_aggregate_mixed_udf[pyspark]
@@ -1595,0 +1599,2 @@
+ibis/backends/tests/test_window.py::test_ungrouped_unbounded_window[pyspark-unordered-lag]
+ibis/backends/tests/test_window.py::test_ungrouped_unbounded_window[pyspark-unordered-lead]Failed Tests |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #2223 +/- ##
==========================================
- Coverage 78.37% 77.32% -1.05%
==========================================
Files 1022 1035 +13
Lines 170179 174804 +4625
==========================================
+ Hits 133373 135172 +1799
- Misses 36806 39632 +2826
*This pull request uses carry forward flags. Click here to find out more.
... and 110 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
POC for Spark-compatible type coercion of the
+ - *operators, applied in thearithmetic plan builders (
math.rs) so the logical plan is valid by construction.Covers the cases where DataFusion's
BinaryTypeCoercerdiverges from Spark 4.1.1:(
DecimalType.fromLiteral), e.g.dec(10,2) * 3⇒decimal(12,2)(wasdecimal(21,2)),dec(10,2) + 3⇒decimal(11,2).double(wasfloat).Why here (not an analyzer rule, not a UDF)
Per the discussion on #2220:
ExprSchemable::get_typetypes binary ops viaBinaryTypeCoercerbefore an analyzer rule runs, so the override isn't reflected at construction time
(see Proposal: introduced typed expressions, separate AST and IR apache/datafusion#12604, #14618). Doing it in the plan builder keeps the plan valid by
construction.
BinaryExprstays vectorized.Validation
arithmetic_coercion.feature) green.(literal
Decimal(10,0)→ minimal decimal; downstream decimal precisions match Spark).nextest+ gold data +pytestgreen.Known gap → follow-up (custom
PhysicalExpr)The plan-builder approach nails the result type but cannot reproduce Spark's
nullability for decimal arithmetic (Spark marks it
nullable=true; a nativeBinaryExprinherits its operands' nullability). This — plus ANSI overflow and consolidating the
try_*ops — is the customPhysicalExprfollow-up . Tracked bythe
@sail-bugnullability scenario in the feature file.Scope
Types only (
+ - *). Out of scope / follow-up: division & modulo scale rules, precision-38capping, ANSI string→bigint width, nullability, overflow,
try_*consolidation.