@@ -19,12 +19,16 @@ package org.apache.spark.sql.hive.client
19
19
20
20
import org .apache .hadoop .conf .Configuration
21
21
import org .apache .hadoop .hive .conf .HiveConf
22
+ import org .apache .hadoop .hive .ql .io .HiveIgnoreKeyTextOutputFormat
23
+ import org .apache .hadoop .hive .serde2 .`lazy` .LazySimpleSerDe
24
+ import org .apache .hadoop .mapred .TextInputFormat
22
25
import org .scalatest .BeforeAndAfterAll
23
26
27
+ import org .apache .spark .sql .catalyst .TableIdentifier
24
28
import org .apache .spark .sql .catalyst .catalog ._
25
29
import org .apache .spark .sql .catalyst .dsl .expressions ._
26
30
import org .apache .spark .sql .catalyst .expressions ._
27
- import org .apache .spark .sql .types .{BooleanType , IntegerType , LongType }
31
+ import org .apache .spark .sql .types .{BooleanType , IntegerType , LongType , StructType }
28
32
29
33
// TODO: Refactor this to `HivePartitionFilteringSuite`
30
34
class HiveClientSuite (version : String )
@@ -46,7 +50,22 @@ class HiveClientSuite(version: String)
46
50
val hadoopConf = new Configuration ()
47
51
hadoopConf.setBoolean(tryDirectSqlKey, tryDirectSql)
48
52
val client = buildClient(hadoopConf)
49
- client.runSqlHive(" CREATE TABLE test (value INT) PARTITIONED BY (ds INT, h INT, chunk STRING)" )
53
+ val tableSchema =
54
+ new StructType ().add(" value" , " int" ).add(" ds" , " int" ).add(" h" , " int" ).add(" chunk" , " string" )
55
+ val table = CatalogTable (
56
+ identifier = TableIdentifier (" test" , Some (" default" )),
57
+ tableType = CatalogTableType .MANAGED ,
58
+ schema = tableSchema,
59
+ partitionColumnNames = Seq (" ds" , " h" , " chunk" ),
60
+ storage = CatalogStorageFormat (
61
+ locationUri = None ,
62
+ inputFormat = Some (classOf [TextInputFormat ].getName),
63
+ outputFormat = Some (classOf [HiveIgnoreKeyTextOutputFormat [_, _]].getName),
64
+ serde = Some (classOf [LazySimpleSerDe ].getName()),
65
+ compressed = false ,
66
+ properties = Map .empty
67
+ ))
68
+ client.createTable(table, ignoreIfExists = false )
50
69
51
70
val partitions =
52
71
for {
0 commit comments