lsyldliu commented on code in PR #19193:
URL: https://github.com/apache/flink/pull/19193#discussion_r906752928
##########
flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl:
##########
@@ -567,12 +568,60 @@ SqlAlterTable SqlAlterTable() :
propertyList);
}
|
- <ADD> constraint = TableConstraint() {
- return new SqlAlterTableAddConstraint(
+ <ADD>
+ (
+ AlterTableAddOrModify(ctx) {
+ // TODO: remove it after supports convert SqlNode to Operation
+ if (ctx.constraints.size() > 0) {
+ return new SqlAlterTableAddConstraint(
+ tableIdentifier,
+ ctx.constraints.get(0),
+ startPos.plus(getPos()));
+ } else {
+ withParen = false;
+ }
+ }
+ |
+ <LPAREN>
+ AlterTableAddOrModify(ctx)
+ (
+ <COMMA> AlterTableAddOrModify(ctx)
+ )*
+ <RPAREN>
+ )
+ {
+ return new SqlAlterTableAdd(
+ startPos.plus(getPos()),
+ tableIdentifier,
+ withParen,
Review Comment:
The `withParen ` is just for SqlNode unparse, I agree with you, this seems
that the code will much cleaner.
> withParen should be true when add multiple columns?
No, user maybe `ADD (a INT)` with single column.
--
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]