|
| 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 | +# This file is part of the implementation of the datafusion-spark function library. |
| 19 | +# For more information, please see: |
| 20 | +# https://github.com/apache/datafusion/issues/15914 |
| 21 | + |
| 22 | +# Scalar input: float64 |
| 23 | +query BBBBB |
| 24 | +SELECT isnan(1.0::DOUBLE), isnan('NaN'::DOUBLE), isnan('inf'::DOUBLE), isnan(0.0::DOUBLE), isnan(-1.0::DOUBLE); |
| 25 | +---- |
| 26 | +false true false false false |
| 27 | + |
| 28 | +# Scalar input: float64 NULL returns false (Spark behaviour, not NULL) |
| 29 | +query B |
| 30 | +SELECT isnan(NULL::DOUBLE); |
| 31 | +---- |
| 32 | +false |
| 33 | + |
| 34 | +# Scalar input: float32 |
| 35 | +query BBBBB |
| 36 | +SELECT isnan(1.0::FLOAT), isnan('NaN'::FLOAT), isnan('inf'::FLOAT), isnan(0.0::FLOAT), isnan(-1.0::FLOAT); |
| 37 | +---- |
| 38 | +false true false false false |
| 39 | + |
| 40 | +# Scalar input: float32 NULL returns false |
| 41 | +query B |
| 42 | +SELECT isnan(NULL::FLOAT); |
| 43 | +---- |
| 44 | +false |
| 45 | + |
| 46 | +# Array input: float64 — NULL produces false, not NULL |
| 47 | +query B |
| 48 | +SELECT isnan(a) FROM (VALUES (1.0::DOUBLE), ('NaN'::DOUBLE), (NULL::DOUBLE), ('inf'::DOUBLE), (0.0::DOUBLE)) AS t(a); |
| 49 | +---- |
| 50 | +false |
| 51 | +true |
| 52 | +false |
| 53 | +false |
| 54 | +false |
| 55 | + |
| 56 | +# Array input: float32 |
| 57 | +query B |
| 58 | +SELECT isnan(a) FROM (VALUES (1.0::FLOAT), ('NaN'::FLOAT), (NULL::FLOAT), ('inf'::FLOAT), (0.0::FLOAT)) AS t(a); |
| 59 | +---- |
| 60 | +false |
| 61 | +true |
| 62 | +false |
| 63 | +false |
| 64 | +false |
0 commit comments