diff options
author | Reynold Xin <rxin@databricks.com> | 2016-04-21 00:31:06 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-04-21 00:31:06 -0700 |
commit | 228128ce2571c3058cb13ae502a5328745eeeef5 (patch) | |
tree | 3ce6739a0fa1ac9bd8e0c64698da4aff91d0d56a | |
parent | 3b9fd517397bca98f8202103c4a4b4fd6074f22e (diff) | |
download | spark-228128ce2571c3058cb13ae502a5328745eeeef5.tar.gz spark-228128ce2571c3058cb13ae502a5328745eeeef5.tar.bz2 spark-228128ce2571c3058cb13ae502a5328745eeeef5.zip |
[SPARK-14794][SQL] Don't pass analyze command into Hive
## What changes were proposed in this pull request?
We shouldn't pass analyze command to Hive because some of those would require running MapReduce jobs. For now, let's just always run the no scan analyze.
## How was this patch tested?
Updated test case to reflect this change.
Author: Reynold Xin <rxin@databricks.com>
Closes #12558 from rxin/parser-analyze.
-rw-r--r-- | sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveSqlParser.scala | 4 | ||||
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveSqlParser.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveSqlParser.scala index 00f829d850..1c4cda7109 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveSqlParser.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveSqlParser.scala @@ -77,7 +77,9 @@ class HiveSqlAstBuilder(conf: SQLConf) extends SparkSqlAstBuilder(conf) { ctx.identifier.getText.toLowerCase == "noscan") { AnalyzeTable(visitTableIdentifier(ctx.tableIdentifier).toString) } else { - HiveNativeCommand(command(ctx)) + // Always just run the no scan analyze. We should fix this and implement full analyze + // command in the future. + AnalyzeTable(visitTableIdentifier(ctx.tableIdentifier).toString) } } diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala index adc7af32ca..e91870492a 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala @@ -49,19 +49,19 @@ class StatisticsSuite extends QueryTest with TestHiveSingleton { assertAnalyzeCommand( "ANALYZE TABLE Table1 COMPUTE STATISTICS", - classOf[HiveNativeCommand]) + classOf[AnalyzeTable]) assertAnalyzeCommand( "ANALYZE TABLE Table1 PARTITION(ds='2008-04-09', hr=11) COMPUTE STATISTICS", - classOf[HiveNativeCommand]) + classOf[AnalyzeTable]) assertAnalyzeCommand( "ANALYZE TABLE Table1 PARTITION(ds='2008-04-09', hr=11) COMPUTE STATISTICS noscan", - classOf[HiveNativeCommand]) + classOf[AnalyzeTable]) assertAnalyzeCommand( "ANALYZE TABLE Table1 PARTITION(ds, hr) COMPUTE STATISTICS", - classOf[HiveNativeCommand]) + classOf[AnalyzeTable]) assertAnalyzeCommand( "ANALYZE TABLE Table1 PARTITION(ds, hr) COMPUTE STATISTICS noscan", - classOf[HiveNativeCommand]) + classOf[AnalyzeTable]) assertAnalyzeCommand( "ANALYZE TABLE Table1 COMPUTE STATISTICS nOscAn", |