@@ -62,12 +62,6 @@ public TestColumnDefaultOptions()
62
62
plannerContext = plannerContextBuilder ().build ();
63
63
}
64
64
65
- @ Test
66
- void testNull ()
67
- {
68
- assertDefaultColumnValue (TINYINT , new NullLiteral (LOCATION ));
69
- }
70
-
71
65
@ Test
72
66
void testBoolean ()
73
67
{
@@ -84,6 +78,7 @@ void testTinyint()
84
78
{
85
79
assertDefaultColumnValue (TINYINT , new LongLiteral (LOCATION , "-128" ));
86
80
assertDefaultColumnValue (TINYINT , new LongLiteral (LOCATION , "127" ));
81
+ assertDefaultColumnValue (TINYINT , new NullLiteral (LOCATION ));
87
82
88
83
assertInvalidDefaultColumnValue (TINYINT , new LongLiteral (LOCATION , "-129" ), "Out of range for tinyint: -129" );
89
84
assertInvalidDefaultColumnValue (TINYINT , new LongLiteral (LOCATION , "128" ), "Out of range for tinyint: 128" );
@@ -94,6 +89,7 @@ void testSmallint()
94
89
{
95
90
assertDefaultColumnValue (SMALLINT , new LongLiteral (LOCATION , "-32768" ));
96
91
assertDefaultColumnValue (SMALLINT , new LongLiteral (LOCATION , "32767" ));
92
+ assertDefaultColumnValue (SMALLINT , new NullLiteral (LOCATION ));
97
93
98
94
assertInvalidDefaultColumnValue (SMALLINT , new LongLiteral (LOCATION , "-32769" ), " Out of range for smallint: -32769" );
99
95
assertInvalidDefaultColumnValue (SMALLINT , new LongLiteral (LOCATION , "32768" ), " Out of range for smallint: 32768" );
@@ -104,6 +100,7 @@ void testInteger()
104
100
{
105
101
assertDefaultColumnValue (INTEGER , new LongLiteral (LOCATION , "-2147483648" ));
106
102
assertDefaultColumnValue (INTEGER , new LongLiteral (LOCATION , "2147483647" ));
103
+ assertDefaultColumnValue (INTEGER , new NullLiteral (LOCATION ));
107
104
108
105
assertInvalidDefaultColumnValue (INTEGER , new LongLiteral (LOCATION , "-2147483649" ), "Out of range for integer: -2147483649" );
109
106
assertInvalidDefaultColumnValue (INTEGER , new LongLiteral (LOCATION , "2147483648" ), "Out of range for integer: 2147483648" );
@@ -114,6 +111,7 @@ void testBigint()
114
111
{
115
112
assertDefaultColumnValue (BIGINT , new LongLiteral (LOCATION , "-9223372036854775808" ));
116
113
assertDefaultColumnValue (BIGINT , new LongLiteral (LOCATION , "9223372036854775807" ));
114
+ assertDefaultColumnValue (BIGINT , new NullLiteral (LOCATION ));
117
115
118
116
// LongLiteral disallows values outside the range of a long
119
117
}
@@ -128,6 +126,7 @@ void testReal()
128
126
assertDefaultColumnValue (REAL , new GenericLiteral (LOCATION , "REAL" , "NaN" ));
129
127
assertDefaultColumnValue (REAL , new GenericLiteral (LOCATION , "REAL" , "+Infinity" ));
130
128
assertDefaultColumnValue (REAL , new GenericLiteral (LOCATION , "REAL" , "-Infinity" ));
129
+ assertDefaultColumnValue (REAL , new NullLiteral (LOCATION ));
131
130
}
132
131
133
132
@ Test
@@ -141,6 +140,7 @@ void testDouble()
141
140
assertDefaultColumnValue (DOUBLE , new GenericLiteral (LOCATION , "DOUBLE" , "NaN" ));
142
141
assertDefaultColumnValue (DOUBLE , new GenericLiteral (LOCATION , "DOUBLE" , "+Infinity" ));
143
142
assertDefaultColumnValue (DOUBLE , new GenericLiteral (LOCATION , "DOUBLE" , "-Infinity" ));
143
+ assertDefaultColumnValue (DOUBLE , new NullLiteral (LOCATION ));
144
144
}
145
145
146
146
@ Test
@@ -154,6 +154,8 @@ void testDecimal()
154
154
assertDefaultColumnValue (createDecimalType (30 , 5 ), new DecimalLiteral (LOCATION , "-3141592653589793238462643.38327" ));
155
155
assertDefaultColumnValue (createDecimalType (38 ), new DecimalLiteral (LOCATION , "27182818284590452353602874713526624977" ));
156
156
assertDefaultColumnValue (createDecimalType (38 ), new DecimalLiteral (LOCATION , "-27182818284590452353602874713526624977" ));
157
+ assertDefaultColumnValue (createDecimalType (3 ), new NullLiteral (LOCATION ));
158
+ assertDefaultColumnValue (createDecimalType (38 ), new NullLiteral (LOCATION ));
157
159
}
158
160
159
161
@ Test
@@ -177,6 +179,7 @@ void testChar()
177
179
assertDefaultColumnValue (createCharType (10 ), new StringLiteral (LOCATION , "test" ));
178
180
assertDefaultColumnValue (createCharType (5 ), new StringLiteral (LOCATION , "攻殻機動隊" ));
179
181
assertDefaultColumnValue (createCharType (1 ), new StringLiteral (LOCATION , "😂" ));
182
+ assertDefaultColumnValue (createCharType (3 ), new NullLiteral (LOCATION ));
180
183
}
181
184
182
185
@ Test
@@ -200,6 +203,8 @@ void testVarchar()
200
203
assertDefaultColumnValue (VARCHAR , new StringLiteral (LOCATION , "test" ));
201
204
assertDefaultColumnValue (createVarcharType (5 ), new StringLiteral (LOCATION , "攻殻機動隊" ));
202
205
assertDefaultColumnValue (createVarcharType (1 ), new StringLiteral (LOCATION , "😂" ));
206
+ assertDefaultColumnValue (VARCHAR , new NullLiteral (LOCATION ));
207
+ assertDefaultColumnValue (createVarcharType (255 ), new NullLiteral (LOCATION ));
203
208
}
204
209
205
210
@ Test
@@ -233,6 +238,9 @@ void testTime()
233
238
assertDefaultColumnValue (createTimeType (10 ), new GenericLiteral (LOCATION , "TIME" , "00:00:00.1234567890" ));
234
239
assertDefaultColumnValue (createTimeType (11 ), new GenericLiteral (LOCATION , "TIME" , "00:00:00.12345678901" ));
235
240
assertDefaultColumnValue (createTimeType (12 ), new GenericLiteral (LOCATION , "TIME" , "00:00:00.123456789012" ));
241
+
242
+ assertDefaultColumnValue (createTimeType (0 ), new NullLiteral (LOCATION ));
243
+ assertDefaultColumnValue (createTimeType (12 ), new NullLiteral (LOCATION ));
236
244
}
237
245
238
246
@ Test
@@ -242,6 +250,7 @@ void testDate()
242
250
assertDefaultColumnValue (DATE , new GenericLiteral (LOCATION , "DATE" , "1969-12-31" ));
243
251
assertDefaultColumnValue (DATE , new GenericLiteral (LOCATION , "DATE" , "1970-01-01" ));
244
252
assertDefaultColumnValue (DATE , new GenericLiteral (LOCATION , "DATE" , "9999-12-31" ));
253
+ assertDefaultColumnValue (DATE , new NullLiteral (LOCATION ));
245
254
}
246
255
247
256
@ Test
@@ -269,6 +278,9 @@ void testTimestamp()
269
278
assertDefaultColumnValue (createTimestampType (12 ), new GenericLiteral (LOCATION , "TIMESTAMP" , "1970-01-01 00:00:00.9999" ));
270
279
assertDefaultColumnValue (createTimestampType (12 ), new GenericLiteral (LOCATION , "TIMESTAMP" , "1970-01-01 00:00:00.99999" ));
271
280
assertDefaultColumnValue (createTimestampType (12 ), new GenericLiteral (LOCATION , "TIMESTAMP" , "1970-01-01 00:00:00.999999" ));
281
+
282
+ assertDefaultColumnValue (createTimestampType (0 ), new NullLiteral (LOCATION ));
283
+ assertDefaultColumnValue (createTimestampType (12 ), new NullLiteral (LOCATION ));
272
284
}
273
285
274
286
@ Test
@@ -302,6 +314,9 @@ void testTimestampWithTimeZone()
302
314
assertDefaultColumnValue (createTimestampWithTimeZoneType (12 ), new GenericLiteral (LOCATION , "TIMESTAMP" , "1970-01-01 00:00:00.9 UTC" ));
303
315
assertDefaultColumnValue (createTimestampWithTimeZoneType (12 ), new GenericLiteral (LOCATION , "TIMESTAMP" , "1970-01-01 00:00:00.99 UTC" ));
304
316
assertDefaultColumnValue (createTimestampWithTimeZoneType (12 ), new GenericLiteral (LOCATION , "TIMESTAMP" , "1970-01-01 00:00:00.999 UTC" ));
317
+
318
+ assertDefaultColumnValue (createTimestampWithTimeZoneType (0 ), new NullLiteral (LOCATION ));
319
+ assertDefaultColumnValue (createTimestampWithTimeZoneType (12 ), new NullLiteral (LOCATION ));
305
320
}
306
321
307
322
@ Test
0 commit comments