cloud-fan commented on code in PR #53158:
URL: https://github.com/apache/spark/pull/53158#discussion_r2609904369
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala:
##########
@@ -724,6 +724,65 @@ class SparkSqlAstBuilder extends AstBuilder {
}
}
+ override def visitCodeLiteral(ctx: CodeLiteralContext): String = {
+ assert(ctx != null)
+ dollarQuotedString(ctx.DOLLAR_QUOTED_STRING_BODY())
+ }
+
+ override def visitCreateMetricView(ctx: CreateMetricViewContext):
LogicalPlan = withOrigin(ctx) {
+ checkDuplicateClauses(ctx.commentSpec(), "COMMENT", ctx)
+ checkDuplicateClauses(ctx.TBLPROPERTIES, "TBLPROPERTIES", ctx)
+ checkDuplicateClauses(ctx.routineLanguage(), "LANGUAGE", ctx)
+ checkDuplicateClauses(ctx.METRICS(), "WITH METRICS", ctx)
+ val userSpecifiedColumns = Option(ctx.identifierCommentList).toSeq.flatMap
{ icl =>
+ icl.identifierComment.asScala.map { ic =>
+ ic.identifier.getText -> Option(ic.commentSpec()).map(visitCommentSpec)
+ }
+ }
+
+ if (ctx.EXISTS != null && ctx.REPLACE != null) {
+ throw
QueryParsingErrors.createViewWithBothIfNotExistsAndReplaceError(ctx)
+ }
+
+ if (ctx.METRICS(0) == null) {
+ throw QueryParsingErrors.missingClausesForOperation(
+ ctx, "WITH METRICS", "CREATE METRIC VIEW")
Review Comment:
This is a bit misleading as we don't really support the syntax `CREATE
METRIC VIEW`, shall we just say `metric view creation`?
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala:
##########
@@ -724,6 +724,65 @@ class SparkSqlAstBuilder extends AstBuilder {
}
}
+ override def visitCodeLiteral(ctx: CodeLiteralContext): String = {
+ assert(ctx != null)
+ dollarQuotedString(ctx.DOLLAR_QUOTED_STRING_BODY())
+ }
+
+ override def visitCreateMetricView(ctx: CreateMetricViewContext):
LogicalPlan = withOrigin(ctx) {
+ checkDuplicateClauses(ctx.commentSpec(), "COMMENT", ctx)
+ checkDuplicateClauses(ctx.TBLPROPERTIES, "TBLPROPERTIES", ctx)
+ checkDuplicateClauses(ctx.routineLanguage(), "LANGUAGE", ctx)
+ checkDuplicateClauses(ctx.METRICS(), "WITH METRICS", ctx)
+ val userSpecifiedColumns = Option(ctx.identifierCommentList).toSeq.flatMap
{ icl =>
+ icl.identifierComment.asScala.map { ic =>
+ ic.identifier.getText -> Option(ic.commentSpec()).map(visitCommentSpec)
+ }
+ }
+
+ if (ctx.EXISTS != null && ctx.REPLACE != null) {
+ throw
QueryParsingErrors.createViewWithBothIfNotExistsAndReplaceError(ctx)
+ }
+
+ if (ctx.METRICS(0) == null) {
+ throw QueryParsingErrors.missingClausesForOperation(
+ ctx, "WITH METRICS", "CREATE METRIC VIEW")
+ }
+
+ if (ctx.routineLanguage(0) == null) {
+ throw QueryParsingErrors.missingClausesForOperation(
+ ctx, "LANGUAGE", "CREATE METRIC VIEW")
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]