|
| 1 | +-- Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +-- or more contributor license agreements. See the NOTICE file |
| 3 | +-- distributed with this work for additional information |
| 4 | +-- regarding copyright ownership. The ASF licenses this file |
| 5 | +-- to you under the Apache License, Version 2.0 (the |
| 6 | +-- "License"); you may not use this file except in compliance |
| 7 | +-- with the License. You may obtain a copy of the License at |
| 8 | +-- |
| 9 | +-- http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +-- |
| 11 | +-- Unless required by applicable law or agreed to in writing, |
| 12 | +-- software distributed under the License is distributed on an |
| 13 | +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +-- KIND, either express or implied. See the License for the |
| 15 | +-- specific language governing permissions and limitations |
| 16 | +-- under the License. |
| 17 | + |
| 18 | +-- regr_slope, regr_intercept, regr_r2, regr_sxx, regr_syy and regr_sxy fall back to Spark by |
| 19 | +-- default, because their native merge of partial aggregates orders its floating-point operations |
| 20 | +-- differently from Spark's (https://github.com/apache/datafusion-comet/issues/6423). Each query |
| 21 | +-- below holds a single regr function, so it checks that function's own fallback. regr.sql opts in |
| 22 | +-- and covers the native path. |
| 23 | + |
| 24 | +-- The data from #6423: x is constant at 0.1, and each INSERT writes one file of three rows, so the |
| 25 | +-- rows are merged from two partial aggregates. The native merge leaves x with a tiny non-zero |
| 26 | +-- variance there, and returns wrong values where Spark returns NULL, 0.0 or 1.0. |
| 27 | +statement |
| 28 | +CREATE TABLE test_regr_fallback(y double, x double) USING parquet |
| 29 | + |
| 30 | +statement |
| 31 | +INSERT INTO test_regr_fallback SELECT CAST(id AS DOUBLE), 0.1D FROM range(0, 3, 1, 1) |
| 32 | + |
| 33 | +statement |
| 34 | +INSERT INTO test_regr_fallback SELECT CAST(id AS DOUBLE), 0.1D FROM range(3, 6, 1, 1) |
| 35 | + |
| 36 | +query expect_fallback(issues/6423) |
| 37 | +SELECT regr_slope(y, x) FROM test_regr_fallback |
| 38 | + |
| 39 | +query expect_fallback(issues/6423) |
| 40 | +SELECT regr_intercept(y, x) FROM test_regr_fallback |
| 41 | + |
| 42 | +query expect_fallback(issues/6423) |
| 43 | +SELECT regr_r2(y, x) FROM test_regr_fallback |
| 44 | + |
| 45 | +-- The constant as the dependent variable |
| 46 | +query expect_fallback(issues/6423) |
| 47 | +SELECT regr_r2(x, y) FROM test_regr_fallback |
| 48 | + |
| 49 | +query expect_fallback(issues/6423) |
| 50 | +SELECT regr_sxx(y, x) FROM test_regr_fallback |
| 51 | + |
| 52 | +query expect_fallback(issues/6423) |
| 53 | +SELECT regr_sxy(y, x) FROM test_regr_fallback |
| 54 | + |
| 55 | +query expect_fallback(issues/6423) |
| 56 | +SELECT regr_syy(x, y) FROM test_regr_fallback |
0 commit comments