aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorDilip Biswal <dbiswal@us.ibm.com>2016-10-20 19:39:25 +0800
committerWenchen Fan <wenchen@databricks.com>2016-10-20 19:39:25 +0800
commite895bc25481f73b433a3cc3ad46df066ec602862 (patch)
treec92f45646b3f5d231f2bb09a49baef6dbb0ff148 /sql/hive
parent986a3b8b5bedb1d64e2cf7c95bfdf5505f3e8c69 (diff)
downloadspark-e895bc25481f73b433a3cc3ad46df066ec602862.tar.gz
spark-e895bc25481f73b433a3cc3ad46df066ec602862.tar.bz2
spark-e895bc25481f73b433a3cc3ad46df066ec602862.zip
[SPARK-17860][SQL] SHOW COLUMN's database conflict check should respect case sensitivity configuration
## What changes were proposed in this pull request? SHOW COLUMNS command validates the user supplied database name with database name from qualified table name name to make sure both of them are consistent. This comparison should respect case sensitivity. ## How was this patch tested? Added tests in DDLSuite and existing tests were moved to use new sql based test infrastructure. Author: Dilip Biswal <dbiswal@us.ibm.com> Closes #15423 from dilipbiswal/dkb_show_column_fix.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala23
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala2
2 files changed, 2 insertions, 23 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala
index 2c772ce215..ad1e9b17a9 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala
@@ -22,6 +22,7 @@ import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.analysis.NoSuchTableException
import org.apache.spark.sql.catalyst.catalog.{CatalogStorageFormat, CatalogTable, CatalogTableType}
import org.apache.spark.sql.hive.test.TestHiveSingleton
+import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SQLTestUtils
import org.apache.spark.sql.types.StructType
@@ -336,28 +337,6 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
}
}
- test("show columns") {
- checkAnswer(
- sql("SHOW COLUMNS IN parquet_tab3"),
- Row("col1") :: Row("col 2") :: Nil)
-
- checkAnswer(
- sql("SHOW COLUMNS IN default.parquet_tab3"),
- Row("col1") :: Row("col 2") :: Nil)
-
- checkAnswer(
- sql("SHOW COLUMNS IN parquet_tab3 FROM default"),
- Row("col1") :: Row("col 2") :: Nil)
-
- checkAnswer(
- sql("SHOW COLUMNS IN parquet_tab4 IN default"),
- Row("price") :: Row("qty") :: Row("year") :: Row("month") :: Nil)
-
- val message = intercept[NoSuchTableException] {
- sql("SHOW COLUMNS IN badtable FROM default")
- }.getMessage
- assert(message.contains("'badtable' not found in database"))
- }
test("show partitions - show everything") {
checkAnswer(
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
index 80e75aa898..13ceed7c79 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
@@ -167,7 +167,7 @@ abstract class HiveComparisonTest
// and does not return it as a query answer.
case _: SetCommand => Seq("0")
case _: ExplainCommand => answer
- case _: DescribeTableCommand | ShowColumnsCommand(_) =>
+ case _: DescribeTableCommand | ShowColumnsCommand(_, _) =>
// Filter out non-deterministic lines and lines which do not have actual results but
// can introduce problems because of the way Hive formats these lines.
// Then, remove empty lines. Do not sort the results.