|
| 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 | + |
| 17 | +-- The set operations on arrays of floats, over the edge values (see expressions.sql). Every 4.2+ |
| 18 | +-- release normalizes signed zeros in these functions (array_set_signed_zero.sql), so native |
| 19 | +-- distinct and union, and the except and intersect kernels with allowIncompatible, must run |
| 20 | +-- natively and agree with Spark. Before 4.2 the signed-zero routing differs by release |
| 21 | +-- (array_set_signed_zero_spark_3.sql, array_set_signed_zero_spark_4_0_4_1.sql), so the sweep does |
| 22 | +-- not cover those releases. |
| 23 | +-- The sweep tracks #6385. |
| 24 | +-- |
| 25 | +-- MinSparkVersion: 4.2 |
| 26 | +-- Config: spark.comet.expression.ArrayExcept.allowIncompatible=true |
| 27 | +-- Config: spark.comet.expression.ArrayIntersect.allowIncompatible=true |
| 28 | + |
| 29 | +statement |
| 30 | +CREATE TABLE fs_edge_double(id INT, c DOUBLE, neg BOOLEAN) USING parquet |
| 31 | + |
| 32 | +statement |
| 33 | +INSERT INTO fs_edge_double VALUES |
| 34 | + (1, 0.0D, false), |
| 35 | + (2, double('-0.0'), false), |
| 36 | + (3, double('NaN'), false), |
| 37 | + (4, double('NaN'), true), |
| 38 | + (5, 1.0D, false), |
| 39 | + (6, -1.0D, false), |
| 40 | + (7, double('Infinity'), false), |
| 41 | + (8, double('-Infinity'), false), |
| 42 | + (9, NULL, false) |
| 43 | + |
| 44 | +statement |
| 45 | +CREATE TABLE fs_pair_double USING parquet AS |
| 46 | +SELECT a.id * 10 + b.id AS id, a.c AS l, b.c AS r, a.neg AS lneg, b.neg AS rneg |
| 47 | +FROM fs_edge_double a CROSS JOIN fs_edge_double b |
| 48 | + |
| 49 | +statement |
| 50 | +CREATE TABLE fs_edge_float(id INT, c FLOAT, neg BOOLEAN) USING parquet |
| 51 | + |
| 52 | +statement |
| 53 | +INSERT INTO fs_edge_float VALUES |
| 54 | + (1, float(0.0), false), |
| 55 | + (2, float('-0.0'), false), |
| 56 | + (3, float('NaN'), false), |
| 57 | + (4, float('NaN'), true), |
| 58 | + (5, float(1.0), false), |
| 59 | + (6, float(-1.0), false), |
| 60 | + (7, float('Infinity'), false), |
| 61 | + (8, float('-Infinity'), false), |
| 62 | + (9, NULL, false) |
| 63 | + |
| 64 | +statement |
| 65 | +CREATE TABLE fs_pair_float USING parquet AS |
| 66 | +SELECT a.id * 10 + b.id AS id, a.c AS l, b.c AS r, a.neg AS lneg, b.neg AS rneg |
| 67 | +FROM fs_edge_float a CROSS JOIN fs_edge_float b |
| 68 | + |
| 69 | +-- array_distinct, DOUBLE |
| 70 | +query |
| 71 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_double) |
| 72 | +SELECT id, array_distinct(array(l, r)) FROM p |
| 73 | + |
| 74 | +-- array_distinct, FLOAT |
| 75 | +query |
| 76 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_float) |
| 77 | +SELECT id, array_distinct(array(l, r)) FROM p |
| 78 | + |
| 79 | +-- array_union, DOUBLE |
| 80 | +query |
| 81 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_double) |
| 82 | +SELECT id, array_union(array(l), array(r)) FROM p |
| 83 | + |
| 84 | +-- array_union, FLOAT |
| 85 | +query |
| 86 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_float) |
| 87 | +SELECT id, array_union(array(l), array(r)) FROM p |
| 88 | + |
| 89 | +-- array_intersect, DOUBLE |
| 90 | +query |
| 91 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_double) |
| 92 | +SELECT id, array_intersect(array(l), array(r)) FROM p |
| 93 | + |
| 94 | +-- array_intersect, FLOAT |
| 95 | +query |
| 96 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_float) |
| 97 | +SELECT id, array_intersect(array(l), array(r)) FROM p |
| 98 | + |
| 99 | +-- array_except, DOUBLE |
| 100 | +query |
| 101 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_double) |
| 102 | +SELECT id, array_except(array(l), array(r)) FROM p |
| 103 | + |
| 104 | +-- array_except, FLOAT |
| 105 | +query |
| 106 | +WITH p AS (SELECT id, IF(lneg, -l, l) AS l, IF(rneg, -r, r) AS r FROM fs_pair_float) |
| 107 | +SELECT id, array_except(array(l), array(r)) FROM p |
0 commit comments