Skip to content

Commit 4d4cbc0

Browse files
Huaxin Gaorxin
authored andcommitted
[SPARK-11778][SQL] add regression test
Fix regression test for SPARK-11778. marmbrus Could you please take a look? Thank you very much!! Author: Huaxin Gao <huaxing@oc0558782468.ibm.com> Closes #9890 from huaxingao/spark-11778-regression-test.
1 parent d822088 commit 4d4cbc0

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveDataFrameAnalyticsSuite.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,10 @@ class HiveDataFrameAnalyticsSuite extends QueryTest with TestHiveSingleton with
3434
override def beforeAll() {
3535
testData = Seq((1, 2), (2, 2), (3, 4)).toDF("a", "b")
3636
hiveContext.registerDataFrameAsTable(testData, "mytable")
37-
hiveContext.sql("create schema usrdb")
38-
hiveContext.sql("create table usrdb.test(c1 int)")
3937
}
4038

4139
override def afterAll(): Unit = {
4240
hiveContext.dropTempTable("mytable")
43-
hiveContext.sql("drop table usrdb.test")
44-
hiveContext.sql("drop schema usrdb")
4541
}
4642

4743
test("rollup") {
@@ -78,10 +74,4 @@ class HiveDataFrameAnalyticsSuite extends QueryTest with TestHiveSingleton with
7874
sql("select a, b, sum(b) from mytable group by a, b with cube").collect()
7975
)
8076
}
81-
82-
// There was a bug in DataFrameFrameReader.table and it has problem for table with schema name,
83-
// Before fix, it throw Exceptionorg.apache.spark.sql.catalyst.analysis.NoSuchTableException
84-
test("table name with schema") {
85-
hiveContext.read.table("usrdb.test")
86-
}
8777
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.sql.hive
19+
20+
import org.apache.spark.sql.hive.test.TestHiveSingleton
21+
import org.apache.spark.sql.QueryTest
22+
23+
class HiveDataFrameSuite extends QueryTest with TestHiveSingleton {
24+
test("table name with schema") {
25+
// regression test for SPARK-11778
26+
hiveContext.sql("create schema usrdb")
27+
hiveContext.sql("create table usrdb.test(c int)")
28+
hiveContext.read.table("usrdb.test")
29+
hiveContext.sql("drop table usrdb.test")
30+
hiveContext.sql("drop schema usrdb")
31+
}
32+
}

0 commit comments

Comments
 (0)