aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorYin Huai <yhuai@databricks.com>2016-03-18 13:40:53 -0700
committerYin Huai <yhuai@databricks.com>2016-03-18 13:40:53 -0700
commit238fb485be4cdf8337cacc58c31a9f885a99853c (patch)
treed1bd8a138c83464a9aea42fdd732f2ef5035807b /sql/hive
parent2e0c5284fd88ba89f53f93dcf1eb26bca2be49c5 (diff)
downloadspark-238fb485be4cdf8337cacc58c31a9f885a99853c.tar.gz
spark-238fb485be4cdf8337cacc58c31a9f885a99853c.tar.bz2
spark-238fb485be4cdf8337cacc58c31a9f885a99853c.zip
[SPARK-13972][SQL][FOLLOW-UP] When creating the query execution for a converted SQL query, we eagerly trigger analysis
## What changes were proposed in this pull request? As part of testing generating SQL query from a analyzed SQL plan, we run the generated SQL for tests in HiveComparisonTest. This PR makes the generated SQL get eagerly analyzed. So, when a generated SQL has any analysis error, we can see the error message created by ``` case NonFatal(e) => fail( s"""Failed to analyze the converted SQL string: | |# Original HiveQL query string: |$queryString | |# Resolved query plan: |${originalQuery.analyzed.treeString} | |# Converted SQL query string: |$convertedSQL """.stripMargin, e) ``` Right now, if we can parse a generated SQL but fail to analyze it, we will see error message generated by the following code (it only mentions that we cannot execute the original query, i.e. `queryString`). ``` case e: Throwable => val errorMessage = s""" |Failed to execute query using catalyst: |Error: ${e.getMessage} |${stackTraceToString(e)} |$queryString |$query |== HIVE - ${hive.size} row(s) == |${hive.mkString("\n")} """.stripMargin ``` ## How was this patch tested? Existing tests. Author: Yin Huai <yhuai@databricks.com> Closes #11825 from yhuai/SPARK-13972-follow-up.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala5
1 files changed, 4 insertions, 1 deletions
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 019d752a13..cfca93bbf0 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
@@ -409,7 +409,10 @@ abstract class HiveComparisonTest
}
try {
- new TestHive.QueryExecution(convertedSQL)
+ val queryExecution = new TestHive.QueryExecution(convertedSQL)
+ // Trigger the analysis of this converted SQL query.
+ queryExecution.analyzed
+ queryExecution
} catch {
case NonFatal(e) => fail(
s"""Failed to analyze the converted SQL string: