[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.
This commit is contained in:
Reynold Xin 2016-04-21 00:31:06 -07:00
parent 3b9fd51739
commit 228128ce25
2 changed files with 8 additions and 6 deletions

View file

@ -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)
}
}

View file

@ -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",