Skip to content
Snippets Groups Projects
Commit 228128ce authored by Reynold Xin's avatar Reynold Xin
Browse files

[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.
parent 3b9fd517
No related branches found
No related tags found
No related merge requests found
......@@ -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)
}
}
......
......@@ -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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment