@@ -72,15 +72,15 @@ case class AllDataTypesScan(
7272 i.toDouble,
7373 BigDecimal (i),
7474 BigDecimal (i),
75- new Date (10000 + i ),
75+ new Date ((i + 1 ) * 8640000 ),
7676 new Timestamp (20000 + i),
7777 s " varchar_ $i" ,
7878 Seq (i, i + 1 ),
7979 Seq (Map (s " str_ $i" -> Row (i.toLong))),
8080 Map (i -> i.toString),
8181 Map (Map (s " str_ $i" -> i.toFloat) -> Row (i.toLong)),
8282 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 )))))
8484 }
8585 }
8686}
@@ -101,15 +101,15 @@ class TableScanSuite extends DataSourceTest {
101101 i.toDouble,
102102 BigDecimal (i),
103103 BigDecimal (i),
104- new Date (10000 + i ),
104+ new Date ((i + 1 ) * 8640000 ),
105105 new Timestamp (20000 + i),
106106 s " varchar_ $i" ,
107107 Seq (i, i + 1 ),
108108 Seq (Map (s " str_ $i" -> Row (i.toLong))),
109109 Map (i -> i.toString),
110110 Map (Map (s " str_ $i" -> i.toFloat) -> Row (i.toLong)),
111111 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 )))))
113113 }.toSeq
114114
115115 before {
@@ -126,13 +126,13 @@ class TableScanSuite extends DataSourceTest {
126126 sql(
127127 """
128128 |CREATE TEMPORARY TABLE tableWithSchema (
129- |stringField stRIng,
129+ |`string$%Field` stRIng,
130130 |binaryField binary,
131- |booleanField boolean,
132- |byteField tinyint,
131+ |` booleanField` boolean,
132+ |ByteField tinyint,
133133 |shortField smaLlint,
134- |intField iNt,
135- |longField Bigint,
134+ |int_Field iNt,
135+ |`longField_:,<>=+/~^` Bigint,
136136 |floatField flOat,
137137 |doubleField doubLE,
138138 |decimalField1 decimal,
@@ -145,7 +145,7 @@ class TableScanSuite extends DataSourceTest {
145145 |mapFieldSimple MAP<iNt, StRing>,
146146 |mapFieldComplex Map<Map<stRING, fLOAT>, Struct<key:bigInt>>,
147147 |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>>>
149149 |)
150150 |USING org.apache.spark.sql.sources.AllDataTypesScanSource
151151 |OPTIONS (
@@ -177,13 +177,13 @@ class TableScanSuite extends DataSourceTest {
177177
178178 test(" Schema and all fields" ) {
179179 val expectedSchema = StructType (
180- StructField (" stringField " , StringType , true ) ::
180+ StructField (" string$%Field " , StringType , true ) ::
181181 StructField (" binaryField" , BinaryType , true ) ::
182182 StructField (" booleanField" , BooleanType , true ) ::
183- StructField (" byteField " , ByteType , true ) ::
183+ StructField (" ByteField " , ByteType , true ) ::
184184 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 ) ::
187187 StructField (" floatField" , FloatType , true ) ::
188188 StructField (" doubleField" , DoubleType , true ) ::
189189 StructField (" decimalField1" , DecimalType .Unlimited , true ) ::
@@ -209,21 +209,22 @@ class TableScanSuite extends DataSourceTest {
209209 StructField (" key" , ArrayType (StringType ), true ) ::
210210 StructField (" Value" ,
211211 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
213214 )
214215
215216 assert(expectedSchema == table(" tableWithSchema" ).schema)
216217
217218 checkAnswer(
218219 sql(
219220 """ SELECT
220- | stringField ,
221+ | `string$%Field` ,
221222 | cast(binaryField as string),
222223 | booleanField,
223224 | byteField,
224225 | shortField,
225- | intField ,
226- | longField ,
226+ | int_Field ,
227+ | `longField_:,<>=+/~^` ,
227228 | floatField,
228229 | doubleField,
229230 | decimalField1,
@@ -246,21 +247,25 @@ class TableScanSuite extends DataSourceTest {
246247 10 )
247248
248249 sqlTest(
249- " SELECT stringField FROM tableWithSchema" ,
250+ " SELECT `string$%Field` FROM tableWithSchema" ,
250251 (1 to 10 ).map(i => Row (s " str_ $i" )).toSeq)
251252
252253 sqlTest(
253- " SELECT intField FROM tableWithSchema WHERE intField < 5" ,
254+ " SELECT int_Field FROM tableWithSchema WHERE int_Field < 5" ,
254255 (1 to 4 ).map(Row (_)).toSeq)
255256
256257 sqlTest(
257- " SELECT longField * 2 FROM tableWithSchema" ,
258+ " SELECT `longField_:,<>=+/~^` * 2 FROM tableWithSchema" ,
258259 (1 to 10 ).map(i => Row (i * 2 .toLong)).toSeq)
259260
260261 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" ,
262263 Seq (Seq (1 , 2 )))
263264
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+
264269 test(" Caching" ) {
265270 // Cached Query Execution
266271 cacheTable(" oneToTen" )
0 commit comments