From b277fe1eb3b054027cc73717015a19fb0aa7cc02 Mon Sep 17 00:00:00 2001 From: Reynold Xin Date: Wed, 20 Apr 2016 20:53:01 -0700 Subject: [PATCH 1/2] TEST - Throw exception on unsupported analyze command --- .../org/apache/spark/sql/hive/execution/HiveSqlParser.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 90f10d5ebdc6d..b208e13b5db53 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 @@ -103,7 +103,7 @@ class HiveSqlAstBuilder(conf: SQLConf) extends SparkSqlAstBuilder { ctx.identifier.getText.toLowerCase == "noscan") { AnalyzeTable(visitTableIdentifier(ctx.tableIdentifier).toString) } else { - HiveNativeCommand(command(ctx)) + throw new ParseException(s"Unsupported analyze command", ctx) } } From 07d2cfb1eba466514cf031e4ecd7dbe727d38e00 Mon Sep 17 00:00:00 2001 From: Reynold Xin Date: Wed, 20 Apr 2016 23:03:34 -0700 Subject: [PATCH 2/2] [SPARK-14794][SQL] Don't pass analyze command into Hive --- .../spark/sql/hive/execution/HiveSqlParser.scala | 4 +++- .../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 b208e13b5db53..f8e28b7fde51f 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 @@ -103,7 +103,9 @@ class HiveSqlAstBuilder(conf: SQLConf) extends SparkSqlAstBuilder { ctx.identifier.getText.toLowerCase == "noscan") { AnalyzeTable(visitTableIdentifier(ctx.tableIdentifier).toString) } else { - throw new ParseException(s"Unsupported analyze 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 adc7af32ca03f..e91870492ab5a 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",