Skip to content

Commit 012d5b4

Browse files
authored
test: add SQL file test for casting double to string (#3854)
Add test coverage for casting double to string values including negative zero, positive zero, NaN, Infinity, -Infinity, NULL, scientific notation, and regular decimal values.
1 parent d937479 commit 012d5b4

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
statement
21+
CREATE TABLE test_double_to_string(d double, id int) USING parquet
22+
23+
statement
24+
INSERT INTO test_double_to_string VALUES
25+
(-0.0, 1),
26+
(0.0, 2),
27+
(1.5, 3),
28+
(-1.5, 4),
29+
(cast('NaN' as double), 5),
30+
(cast('Infinity' as double), 6),
31+
(cast('-Infinity' as double), 7),
32+
(NULL, 8),
33+
(1.0E20, 9),
34+
(1.0E-20, 10),
35+
(-1.0E20, 11),
36+
(0.001, 12),
37+
(123456789.0, 13),
38+
(1.23456789E10, 14)
39+
40+
query
41+
SELECT cast(d as string), id FROM test_double_to_string ORDER BY id
42+
43+
query
44+
SELECT cast(-0.0 as string), cast(0.0 as string)

0 commit comments

Comments
 (0)