Back to home page

OSCL-LXR

 
 

    


0001 -- Literal parsing
0002 
0003 -- null
0004 select null, Null, nUll;
0005 
0006 -- boolean
0007 select true, tRue, false, fALse;
0008 
0009 -- byte (tinyint)
0010 select 1Y;
0011 select 127Y, -128Y;
0012 
0013 -- out of range byte
0014 select 128Y;
0015 
0016 -- short (smallint)
0017 select 1S;
0018 select 32767S, -32768S;
0019 
0020 -- out of range short
0021 select 32768S;
0022 
0023 -- long (bigint)
0024 select 1L, 2147483648L;
0025 select 9223372036854775807L, -9223372036854775808L;
0026 
0027 -- out of range long
0028 select 9223372036854775808L;
0029 
0030 -- integral parsing
0031 
0032 -- parse int
0033 select 1, -1;
0034 
0035 -- parse int max and min value as int
0036 select 2147483647, -2147483648;
0037 
0038 -- parse long max and min value as long
0039 select 9223372036854775807, -9223372036854775808;
0040 
0041 -- parse as decimals (Long.MaxValue + 1, and Long.MinValue - 1)
0042 select 9223372036854775808, -9223372036854775809;
0043 
0044 -- out of range decimal numbers
0045 select 1234567890123456789012345678901234567890;
0046 select 1234567890123456789012345678901234567890.0;
0047 
0048 -- double
0049 select 1D, 1.2D, 1e10, 1.5e5, .10D, 0.10D, .1e5, .9e+2, 0.9e+2, 900e-1, 9.e+1;
0050 select -1D, -1.2D, -1e10, -1.5e5, -.10D, -0.10D, -.1e5;
0051 -- negative double
0052 select .e3;
0053 -- very large decimals (overflowing double).
0054 select 1E309, -1E309;
0055 
0056 -- decimal parsing
0057 select 0.3, -0.8, .5, -.18, 0.1111, .1111;
0058 
0059 -- super large scientific notation double literals should still be valid doubles
0060 select 123456789012345678901234567890123456789e10d, 123456789012345678901234567890123456789.1e10d;
0061 
0062 -- string
0063 select "Hello Peter!", 'hello lee!';
0064 -- multi string
0065 select 'hello' 'world', 'hello' " " 'lee';
0066 -- single quote within double quotes
0067 select "hello 'peter'";
0068 select 'pattern%', 'no-pattern\%', 'pattern\\%', 'pattern\\\%';
0069 select '\'', '"', '\n', '\r', '\t', 'Z';
0070 -- "Hello!" in octals
0071 select '\110\145\154\154\157\041';
0072 -- "World :)" in unicode
0073 select '\u0057\u006F\u0072\u006C\u0064\u0020\u003A\u0029';
0074 
0075 -- date
0076 select dAte '2016-03-12';
0077 -- invalid date
0078 select date 'mar 11 2016';
0079 
0080 -- timestamp
0081 select tImEstAmp '2016-03-11 20:54:00.000';
0082 -- invalid timestamp
0083 select timestamp '2016-33-11 20:54:00.000';
0084 
0085 -- unsupported data type
0086 select GEO '(10,-6)';
0087 
0088 -- big decimal parsing
0089 select 90912830918230182310293801923652346786BD, 123.0E-28BD, 123.08BD;
0090 
0091 -- out of range big decimal
0092 select 1.20E-38BD;
0093 
0094 -- hexadecimal binary literal
0095 select x'2379ACFe';
0096 
0097 -- invalid hexadecimal binary literal
0098 select X'XuZ';
0099 
0100 -- Hive literal_double test.
0101 SELECT 3.14, -3.14, 3.14e8, 3.14e-8, -3.14e8, -3.14e-8, 3.14e+8, 3.14E8, 3.14E-8;
0102 
0103 -- awareness of the negative/positive sign before type
0104 select +date '1999-01-01';
0105 select +timestamp '1999-01-01';
0106 select +interval '1 day';
0107 select +map(1, 2);
0108 select +array(1,2);
0109 select +named_struct('a', 1, 'b', 'spark');
0110 select +X'1';
0111 -- can't negate date/timestamp/binary
0112 select -date '1999-01-01';
0113 select -timestamp '1999-01-01';
0114 select -x'2379ACFe';