|
| 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 | +-- ConfigMatrix: parquet.enable.dictionary=false,true |
| 19 | + |
| 20 | +-- Spark's Rint extends UnaryMathExpression with inputTypes = Seq(DoubleType). |
| 21 | +-- It returns the double value closest to the argument equal to a mathematical integer |
| 22 | +-- (Java's Math.rint, IEEE 754 round-half-to-even / banker's rounding). |
| 23 | + |
| 24 | +statement |
| 25 | +CREATE TABLE test_rint(v double) USING parquet |
| 26 | + |
| 27 | +statement |
| 28 | +INSERT INTO test_rint VALUES |
| 29 | + (0.0), |
| 30 | + (-0.0), |
| 31 | + (1.0), |
| 32 | + (-1.0), |
| 33 | + (0.4), |
| 34 | + (0.5), |
| 35 | + (0.6), |
| 36 | + (1.5), |
| 37 | + (2.5), |
| 38 | + (3.5), |
| 39 | + (-0.4), |
| 40 | + (-0.5), |
| 41 | + (-0.6), |
| 42 | + (-1.5), |
| 43 | + (-2.5), |
| 44 | + (-3.5), |
| 45 | + (12.3456), |
| 46 | + (-12.3456), |
| 47 | + (1.7976931348623157E308), |
| 48 | + (-1.7976931348623157E308), |
| 49 | + (4.9E-324), |
| 50 | + (cast('NaN' as double)), |
| 51 | + (cast('Infinity' as double)), |
| 52 | + (cast('-Infinity' as double)), |
| 53 | + (NULL) |
| 54 | + |
| 55 | +query |
| 56 | +SELECT rint(v) FROM test_rint |
| 57 | + |
| 58 | +-- column with arithmetic |
| 59 | +query |
| 60 | +SELECT rint(v + 0.5) FROM test_rint |
0 commit comments