Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/12459#discussion_r60510898
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
@@ -450,38 +450,19 @@ class SparkSqlAstBuilder extends AstBuilder {
Option(ctx.partitionSpec).map(visitNonOptionalPartitionSpec))
}
- // TODO: don't even bother parsing alter table commands related to
bucketing and skewing
-
- override def visitBucketTable(ctx: BucketTableContext): LogicalPlan =
withOrigin(ctx) {
- throw new AnalysisException(
- "Operation not allowed: ALTER TABLE ... CLUSTERED BY ... INTO N
BUCKETS")
- }
-
- override def visitUnclusterTable(ctx: UnclusterTableContext):
LogicalPlan = withOrigin(ctx) {
- throw new AnalysisException("Operation not allowed: ALTER TABLE ...
NOT CLUSTERED")
- }
-
- override def visitUnsortTable(ctx: UnsortTableContext): LogicalPlan =
withOrigin(ctx) {
- throw new AnalysisException("Operation not allowed: ALTER TABLE ...
NOT SORTED")
- }
-
- override def visitSkewTable(ctx: SkewTableContext): LogicalPlan =
withOrigin(ctx) {
- throw new AnalysisException("Operation not allowed: ALTER TABLE ...
SKEWED BY ...")
- }
-
- override def visitUnskewTable(ctx: UnskewTableContext): LogicalPlan =
withOrigin(ctx) {
- throw new AnalysisException("Operation not allowed: ALTER TABLE ...
NOT SKEWED")
- }
-
- override def visitUnstoreTable(ctx: UnstoreTableContext): LogicalPlan =
withOrigin(ctx) {
- throw new AnalysisException(
- "Operation not allowed: ALTER TABLE ... NOT STORED AS DIRECTORIES")
- }
-
- override def visitSetTableSkewLocations(
- ctx: SetTableSkewLocationsContext): LogicalPlan = withOrigin(ctx) {
- throw new AnalysisException(
- "Operation not allowed: ALTER TABLE ... SET SKEWED LOCATION ...")
+ /**
+ * Fail an unsupported Hive native command.
+ */
+ override def visitFailNativeCommand(
+ ctx: FailNativeCommandContext): LogicalPlan = withOrigin(ctx) {
+ val keywords = if (ctx.kws != null) {
+ Seq(ctx.kws.kw1, ctx.kws.kw2, ctx.kws.kw3, ctx.kws.kw4, ctx.kws.kw5,
ctx.kws.kw6)
+ .filter(_ != null).map(_.getText).mkString(" ")
+ } else {
+ // SET ROLE is the exception to the rule, because we handle this
before other SET commands.
+ "SET ROLE"
+ }
+ throw new ParseException(s"Operation not allowed: $keywords", ctx)
--- End diff --
I think that makes sense. : ) Let me change it. Thanks!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]