@@ -72,15 +72,15 @@ case class AllDataTypesScan(
72
72
i.toDouble,
73
73
BigDecimal (i),
74
74
BigDecimal (i),
75
- new Date (10000 + i ),
75
+ new Date ((i + 1 ) * 8640000 ),
76
76
new Timestamp (20000 + i),
77
77
s " varchar_ $i" ,
78
78
Seq (i, i + 1 ),
79
79
Seq (Map (s " str_ $i" -> Row (i.toLong))),
80
80
Map (i -> i.toString),
81
81
Map (Map (s " str_ $i" -> i.toFloat) -> Row (i.toLong)),
82
82
Row (i, i.toString),
83
- Row (Seq (s " str_ $i" , s " str_ ${i + 1 }" ), Row (Seq (new Date (30000 + i )))))
83
+ Row (Seq (s " str_ $i" , s " str_ ${i + 1 }" ), Row (Seq (new Date ((i + 2 ) * 8640000 )))))
84
84
}
85
85
}
86
86
}
@@ -101,15 +101,15 @@ class TableScanSuite extends DataSourceTest {
101
101
i.toDouble,
102
102
BigDecimal (i),
103
103
BigDecimal (i),
104
- new Date (10000 + i ),
104
+ new Date ((i + 1 ) * 8640000 ),
105
105
new Timestamp (20000 + i),
106
106
s " varchar_ $i" ,
107
107
Seq (i, i + 1 ),
108
108
Seq (Map (s " str_ $i" -> Row (i.toLong))),
109
109
Map (i -> i.toString),
110
110
Map (Map (s " str_ $i" -> i.toFloat) -> Row (i.toLong)),
111
111
Row (i, i.toString),
112
- Row (Seq (s " str_ $i" , s " str_ ${i + 1 }" ), Row (Seq (new Date (30000 + i )))))
112
+ Row (Seq (s " str_ $i" , s " str_ ${i + 1 }" ), Row (Seq (new Date ((i + 2 ) * 8640000 )))))
113
113
}.toSeq
114
114
115
115
before {
@@ -126,13 +126,13 @@ class TableScanSuite extends DataSourceTest {
126
126
sql(
127
127
"""
128
128
|CREATE TEMPORARY TABLE tableWithSchema (
129
- |stringField stRIng,
129
+ |`string$%Field` stRIng,
130
130
|binaryField binary,
131
- |booleanField boolean,
132
- |byteField tinyint,
131
+ |` booleanField` boolean,
132
+ |ByteField tinyint,
133
133
|shortField smaLlint,
134
- |intField iNt,
135
- |longField Bigint,
134
+ |int_Field iNt,
135
+ |`longField_:,<>=+/~^` Bigint,
136
136
|floatField flOat,
137
137
|doubleField doubLE,
138
138
|decimalField1 decimal,
@@ -145,7 +145,7 @@ class TableScanSuite extends DataSourceTest {
145
145
|mapFieldSimple MAP<iNt, StRing>,
146
146
|mapFieldComplex Map<Map<stRING, fLOAT>, Struct<key:bigInt>>,
147
147
|structFieldSimple StRuct<key:INt, Value:STrINg>,
148
- |structFieldComplex StRuct<key:Array<String>, Value:struct<value :Array<date>>>
148
+ |structFieldComplex StRuct<key:Array<String>, Value:struct<`value_(2)` :Array<date>>>
149
149
|)
150
150
|USING org.apache.spark.sql.sources.AllDataTypesScanSource
151
151
|OPTIONS (
@@ -177,13 +177,13 @@ class TableScanSuite extends DataSourceTest {
177
177
178
178
test(" Schema and all fields" ) {
179
179
val expectedSchema = StructType (
180
- StructField (" stringField " , StringType , true ) ::
180
+ StructField (" string$%Field " , StringType , true ) ::
181
181
StructField (" binaryField" , BinaryType , true ) ::
182
182
StructField (" booleanField" , BooleanType , true ) ::
183
- StructField (" byteField " , ByteType , true ) ::
183
+ StructField (" ByteField " , ByteType , true ) ::
184
184
StructField (" shortField" , ShortType , true ) ::
185
- StructField (" intField " , IntegerType , true ) ::
186
- StructField (" longField " , LongType , true ) ::
185
+ StructField (" int_Field " , IntegerType , true ) ::
186
+ StructField (" longField_:,<>=+/~^ " , LongType , true ) ::
187
187
StructField (" floatField" , FloatType , true ) ::
188
188
StructField (" doubleField" , DoubleType , true ) ::
189
189
StructField (" decimalField1" , DecimalType .Unlimited , true ) ::
@@ -209,21 +209,22 @@ class TableScanSuite extends DataSourceTest {
209
209
StructField (" key" , ArrayType (StringType ), true ) ::
210
210
StructField (" Value" ,
211
211
StructType (
212
- StructField (" value" , ArrayType (DateType ), true ) :: Nil ), true ) :: Nil ), true ) :: Nil
212
+ StructField (" value_(2)" , ArrayType (DateType ), true ) :: Nil ), true ) :: Nil ), true ) ::
213
+ Nil
213
214
)
214
215
215
216
assert(expectedSchema == table(" tableWithSchema" ).schema)
216
217
217
218
checkAnswer(
218
219
sql(
219
220
""" SELECT
220
- | stringField ,
221
+ | `string$%Field` ,
221
222
| cast(binaryField as string),
222
223
| booleanField,
223
224
| byteField,
224
225
| shortField,
225
- | intField ,
226
- | longField ,
226
+ | int_Field ,
227
+ | `longField_:,<>=+/~^` ,
227
228
| floatField,
228
229
| doubleField,
229
230
| decimalField1,
@@ -246,21 +247,25 @@ class TableScanSuite extends DataSourceTest {
246
247
10 )
247
248
248
249
sqlTest(
249
- " SELECT stringField FROM tableWithSchema" ,
250
+ " SELECT `string$%Field` FROM tableWithSchema" ,
250
251
(1 to 10 ).map(i => Row (s " str_ $i" )).toSeq)
251
252
252
253
sqlTest(
253
- " SELECT intField FROM tableWithSchema WHERE intField < 5" ,
254
+ " SELECT int_Field FROM tableWithSchema WHERE int_Field < 5" ,
254
255
(1 to 4 ).map(Row (_)).toSeq)
255
256
256
257
sqlTest(
257
- " SELECT longField * 2 FROM tableWithSchema" ,
258
+ " SELECT `longField_:,<>=+/~^` * 2 FROM tableWithSchema" ,
258
259
(1 to 10 ).map(i => Row (i * 2 .toLong)).toSeq)
259
260
260
261
sqlTest(
261
- " SELECT structFieldSimple.key, arrayFieldSimple[1] FROM tableWithSchema a where intField =1" ,
262
+ " SELECT structFieldSimple.key, arrayFieldSimple[1] FROM tableWithSchema a where int_Field =1" ,
262
263
Seq (Seq (1 , 2 )))
263
264
265
+ sqlTest(
266
+ " SELECT structFieldComplex.Value.`value_(2)` FROM tableWithSchema" ,
267
+ (1 to 10 ).map(i => Row (Seq (new Date ((i + 2 ) * 8640000 )))).toSeq)
268
+
264
269
test(" Caching" ) {
265
270
// Cached Query Execution
266
271
cacheTable(" oneToTen" )
0 commit comments