@@ -176,32 +176,33 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
176176 withSQLConf(HiveUtils .CONVERT_METASTORE_ORC .key -> s " $convertMetastore" ) {
177177 withTempDir { dir =>
178178 try {
179- hiveClient.runSqlHive (" USE default" )
180- hiveClient.runSqlHive (
179+ sql (" USE default" )
180+ sql (
181181 """
182182 |CREATE EXTERNAL TABLE hive_orc(
183183 | C1 INT,
184184 | C2 INT,
185185 | C3 STRING)
186- |STORED AS orc""" .stripMargin)
186+ |STORED AS orc
187+ |LOCATION '${new File(s"${dir.getCanonicalPath}").toURI}'""" .stripMargin)
188+
187189 // Hive throws an exception if I assign the location in the create table statement.
188- hiveClient.runSqlHive(
189- s " ALTER TABLE hive_orc SET LOCATION " +
190+ sql(s " ALTER TABLE hive_orc SET LOCATION " +
190191 s " ' ${new File (s " ${dir.getCanonicalPath}/l1/ " ).toURI}' " )
191192 hiveClient.runSqlHive(
192193 """
193194 |INSERT INTO TABLE hive_orc
194195 |VALUES (1, 1, 'orc1'), (2, 2, 'orc2')""" .stripMargin)
195196
196- hiveClient.runSqlHive (
197+ sql (
197198 s " ALTER TABLE hive_orc SET LOCATION " +
198199 s " ' ${new File (s " ${dir.getCanonicalPath}/l1/l2/ " ).toURI}' " )
199200 hiveClient.runSqlHive(
200201 """
201202 |INSERT INTO TABLE hive_orc
202203 |VALUES (3, 3, 'orc3'), (4, 4, 'orc4')""" .stripMargin)
203204
204- hiveClient.runSqlHive (
205+ sql (
205206 s " ALTER TABLE hive_orc SET LOCATION " +
206207 s " ' ${new File (s " ${dir.getCanonicalPath}/l1/l2/l3/ " ).toURI}' " )
207208 hiveClient.runSqlHive(
@@ -219,7 +220,7 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
219220 |STORED AS orc
220221 |LOCATION ' ${s " ${dir.getCanonicalPath}" }' """ .stripMargin
221222 sql(topDirStatement)
222- val topDirSqlStatement = s " select * from tbl1"
223+ val topDirSqlStatement = s " SELECT * FROM tbl1"
223224 if (convertMetastore) {
224225 checkAnswer(sql(topDirSqlStatement), Nil )
225226 } else {
@@ -236,7 +237,7 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
236237 |STORED AS orc
237238 |LOCATION ' ${s " ${dir.getCanonicalPath}/l1/ " }' """ .stripMargin
238239 sql(l1DirStatement)
239- val l1DirSqlStatement = s " select * from tbl2"
240+ val l1DirSqlStatement = s " SELECT * FROM tbl2"
240241 if (convertMetastore) {
241242 checkAnswer(sql(l1DirSqlStatement),
242243 (1 to 2 ).map(i => Row (i, i, s " orc $i" )))
@@ -254,7 +255,7 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
254255 |STORED AS orc
255256 |LOCATION ' ${s " ${dir.getCanonicalPath}/l1/l2/ " }' """ .stripMargin
256257 sql(l2DirStatement)
257- val l2DirSqlStatement = s " select * from tbl3"
258+ val l2DirSqlStatement = s " SELECT * FROM tbl3"
258259 if (convertMetastore) {
259260 checkAnswer(sql(l2DirSqlStatement),
260261 (3 to 4 ).map(i => Row (i, i, s " orc $i" )))
@@ -272,7 +273,7 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
272273 |STORED AS orc
273274 |LOCATION ' ${new File (s " ${dir}/* " ).toURI}' """ .stripMargin
274275 sql(wildcardTopDirStatement)
275- val wildcardTopDirSqlStatement = s " select * from tbl4"
276+ val wildcardTopDirSqlStatement = s " SELECT * FROM tbl4"
276277 if (convertMetastore) {
277278 checkAnswer(sql(wildcardTopDirSqlStatement),
278279 (1 to 2 ).map(i => Row (i, i, s " orc $i" )))
@@ -289,7 +290,7 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
289290 |STORED AS orc
290291 |LOCATION ' ${new File (s " ${dir}/l1/* " ).toURI}' """ .stripMargin
291292 sql(wildcardL1DirStatement)
292- val wildcardL1DirSqlStatement = s " select * from tbl5"
293+ val wildcardL1DirSqlStatement = s " SELECT * FROM tbl5"
293294 if (convertMetastore) {
294295 checkAnswer(sql(wildcardL1DirSqlStatement),
295296 (1 to 4 ).map(i => Row (i, i, s " orc $i" )))
@@ -306,7 +307,7 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
306307 |STORED AS orc
307308 |LOCATION ' ${new File (s " ${dir}/l1/l2/* " ).toURI}' """ .stripMargin
308309 sql(wildcardL2Statement)
309- val wildcardL2SqlStatement = s " select * from tbl6"
310+ val wildcardL2SqlStatement = s " SELECT * FROM tbl6"
310311 if (convertMetastore) {
311312 checkAnswer(sql(wildcardL2SqlStatement),
312313 (3 to 6 ).map(i => Row (i, i, s " orc $i" )))
0 commit comments