Repository navigation
Commit a49fd8f
authored
fix: fall back to Spark for regr_* aggregates until their merge matches Spark (#6451)
* fix: fall back to Spark for regr_* aggregates until their merge matches Spark
The native merge of partial aggregates (variance_merge and covariance_merge
in welford.rs) orders its floating-point operations differently from Spark's
CentralMomentAgg and Covariance. For a variable that is constant at a value
binary floating point cannot represent exactly, merged from two or more
partial aggregates, m2 ends up around 1e-34 instead of 0, so Spark's exact
m2 == 0 degenerate-case checks never fire and regr_slope, regr_intercept,
regr_r2, regr_sxx, regr_syy and regr_sxy return wrong values.
Mark the five serdes behind these six functions Incompatible, so they fall
back to Spark by default as they did in 1.0.0 and run natively only with the
per-expression allowIncompatible config. The regr SQL-file tests opt in to
keep covering the native path, and a new test from the issue's reproducer
checks that the default plan falls back and matches Spark.
Closes #6423.
* test: move the regr_* fallback check into a SQL file test
One query per function, each expecting the #6423 fallback reason, over the reproducer's data: x
constant at 0.1 in two three-row files, which the native merge gets wrong. regr.sql still opts in
and covers the native path.1 parent 02df813 commit a49fd8f
4 files changed
Lines changed: 109 additions & 17 deletions
File tree
- docs/source/user-guide/latest
- spark/src
- main/scala/org/apache/comet/serde
- test/resources/sql-tests/expressions/aggregate
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
Lines changed: 37 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
932 | | - | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
933 | 953 | | |
934 | 954 | | |
935 | 955 | | |
| |||
966 | 986 | | |
967 | 987 | | |
968 | 988 | | |
969 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
970 | 992 | | |
971 | 993 | | |
972 | 994 | | |
| |||
982 | 1004 | | |
983 | 1005 | | |
984 | 1006 | | |
985 | | - | |
986 | | - | |
987 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
988 | 1010 | | |
989 | 1011 | | |
990 | 1012 | | |
| |||
1000 | 1022 | | |
1001 | 1023 | | |
1002 | 1024 | | |
1003 | | - | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1004 | 1028 | | |
1005 | 1029 | | |
1006 | 1030 | | |
| |||
1010 | 1034 | | |
1011 | 1035 | | |
1012 | 1036 | | |
1013 | | - | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1014 | 1040 | | |
1015 | 1041 | | |
1016 | 1042 | | |
| |||
1027 | 1053 | | |
1028 | 1054 | | |
1029 | 1055 | | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
1033 | 1059 | | |
1034 | 1060 | | |
1035 | 1061 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
| |||
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments