Skip to content

Commit 00bc63a

Browse files
committed
Add more literals
1 parent 3f0b006 commit 00bc63a

File tree

2 files changed

+56
-16
lines changed

2 files changed

+56
-16
lines changed
Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,92 @@
11
-- Literal parsing
22

33
-- null
4-
select null;
4+
select null, Null, nUll;
55

66
-- boolean
7-
select true, false;
7+
select true, tRue, false, fALse;
88

99
-- byte (tinyint)
10-
select 1Y, 127Y, -127Y;
10+
select 1Y;
11+
select 127Y, -128Y;
12+
13+
-- out of range byte
1114
select 128Y;
1215

1316
-- short (smallint)
14-
select 1S, 32767S, -32767S;
17+
select 1S;
18+
select 32767S, -32768S;
19+
20+
-- out of range short
1521
select 32768S;
1622

1723
-- long (bigint)
18-
select 1L, 2147483648L, 9223372036854775807L;
24+
select 1L, 2147483648L;
25+
select 9223372036854775807L, -9223372036854775808L;
26+
27+
-- out of range long
1928
select 9223372036854775808L;
2029

2130
-- integral parsing
2231

2332
-- parse int
2433
select 1, -1;
2534

26-
-- parse int max and min value
35+
-- parse int max and min value as int
2736
select 2147483647, -2147483648;
2837

29-
-- parse as longs (Int.MaxValue + 1, and Int.MinValue - 1)
30-
select 2147483648, -2147483649;
31-
32-
-- parse long max and min value
38+
-- parse long max and min value as long
3339
select 9223372036854775807, -9223372036854775808;
3440

3541
-- parse as decimals (Long.MaxValue + 1, and Long.MinValue - 1)
3642
select 9223372036854775808, -9223372036854775809;
3743

44+
-- out of range decimal numbers
45+
select 1234567890123456789012345678901234567890;
46+
select 1234567890123456789012345678901234567890.0;
47+
3848
-- double
39-
select 1D, 1.2D, 1e10, 1.5e5, .10D, 0.10D, .1e5;
49+
select 1D, 1.2D, 1e10, 1.5e5, .10D, 0.10D, .1e5, .9e+2, 0.9e+2, 900e-1, 9.e+1;
50+
select -1D, -1.2D, -1e10, -1.5e5, -.10D, -0.10D, -.1e5;
51+
-- negative double
52+
select .e3;
53+
-- inf and -inf
54+
select 1E309, -1E309;
4055

4156
-- decimal parsing
4257
select 0.3, -0.8, .5, -.18, 0.1111, .1111;
4358

44-
-- super large decimal numbers
45-
select 1234567890123456789012345678901234567890;
46-
select 1234567890123456789012345678901234567890.0;
47-
4859
-- super large scientific notation numbers should still be valid doubles
4960
select 123456789012345678901234567890123456789e10, 123456789012345678901234567890123456789.1e10;
5061

5162
-- string
52-
select "Hello Peter!";
63+
select "Hello Peter!", 'hello lee!';
64+
-- multi string
65+
select 'hello' 'world', 'hello' " " 'lee';
66+
-- single quote within double quotes
67+
select "hello 'peter'";
68+
select 'pattern%', 'no-pattern\%', 'pattern\\%', 'pattern\\\%';
69+
select '\0', '\'', '"', '\b', '\n', '\r', '\t', 'Z';
70+
-- "Hello!" in octals
71+
select '\110\145\154\154\157\041';
72+
-- "World :)" in unicode
73+
select '\u0057\u006F\u0072\u006C\u0064\u0020\u003A\u0029';
74+
75+
-- date
76+
select dAte '2016-03-12';
77+
-- invalid date
78+
select date 'mar 11 2016';
79+
80+
-- timestamp
81+
select tImEstAmp '2016-03-11 20:54:00.000';
82+
-- invalid timestamp
83+
select timestamp '2016-33-11 20:54:00.000';
84+
85+
-- internal
86+
select interval 13.123456789 seconds, interval -13.123456789 second;
87+
select interval 1 year 2 month 3 week 4 day 5 hour 6 minute 7 seconds 8 millisecond, 9 microsecond;
88+
-- ns is not supported
89+
select interval 10 nanoseconds;
90+
91+
-- unsupported data type
92+
select GEO '(10,-6)';
3.86 KB
Binary file not shown.

0 commit comments

Comments
 (0)