You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/09/08 09:51:59 UTC

[GitHub] [flink] SteNicholas opened a new pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

SteNicholas opened a new pull request #13352:
URL: https://github.com/apache/flink/pull/13352


   ## What is the purpose of the change
   
   *Currently exception of parser is thrown when adding comment on computed column with DDL. Parser should support comment on computed column for DDL of `CREATE TABLE` as follows:*
   ```
   <computed_column_definition>: column_name AS computed_column_expression [COMMENT column_comment]
   ```
   
   ## Brief change log
   
     - *Add `SqlTableComputedColumn` to support commented computed column in `Parser.tdd`.*
     - *`ComputedColumn ` of `parserImpls.ftl` which creates computed column returns the `SqlTableComputedColumn`.*
     - *`SqlCreateTable` modifies validation and unparse about the computed column by `SqlTableComputedColumn`.*
     - *`MergeTableLikeUtil` modifies the check for the computed column whether derivedColumn is instance of `SqlTableComputedColumn`.*
   
   ## Verifying this change
   
     - *`FlinkSqlParserImplTest` adds `testCreateTableWithCommentOnComputedColumn` to verify the test case that creates table with comment on the computed column.*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] danny0405 commented on a change in pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #13352:
URL: https://github.com/apache/flink/pull/13352#discussion_r486043656



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlCreateTable.java
##########
@@ -236,12 +232,12 @@ public String getColumnSqlString() {
 		writer.startList("", "");
 		for (SqlNode column : columnList) {
 			writer.sep(",");
-			if (column instanceof SqlTableColumn) {
-				SqlTableColumn tableColumn = (SqlTableColumn) column;
-				tableColumn.getName().unparse(writer, 0, 0);
-			} else {
-				column.unparse(writer, 0, 0);
+			SqlTableColumn tableColumn = (SqlTableColumn) column;
+			if (tableColumn.isComputed()) {
+				tableColumn.getExpr().unparse(writer, 0, 0);

Review comment:
       We can encapsulate all the unparse logic in `SqlTableColumn`. E.G. the code can be as simple as:
   ```java
   column.unparse(writer, 0, 0)
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d06dbcd04a611f3adfa2812668a13195f65237fd Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688762790


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit d06dbcd04a611f3adfa2812668a13195f65237fd (Tue Sep 08 10:01:54 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688818272


   cc @danny0405 , could you help to review this?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] SteNicholas commented on a change in pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #13352:
URL: https://github.com/apache/flink/pull/13352#discussion_r485651914



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlTableComputedColumn.java
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.sql.parser.ddl;
+
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlCharStringLiteral;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.SqlSpecialOperator;
+import org.apache.calcite.sql.SqlWriter;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.util.ImmutableNullableList;
+
+import javax.annotation.Nullable;
+
+import java.util.List;
+import java.util.Optional;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Table computed column of a CREATE TABLE DDL.
+ */
+public class SqlTableComputedColumn extends SqlCall {
+	private static final SqlSpecialOperator OPERATOR =
+		new SqlSpecialOperator("COLUMN_DECL", SqlKind.COLUMN_DECL);
+
+	private SqlNode identifier;
+	private SqlNode expr;
+	private SqlCharStringLiteral comment;
+
+	public SqlTableComputedColumn(SqlNode identifier, SqlNode expr, @Nullable SqlCharStringLiteral comment, SqlParserPos pos) {
+		super(pos);
+		this.identifier = requireNonNull(identifier, "Column identifier should not be null");
+		this.expr = requireNonNull(expr, "Column expression should not be null");
+		this.comment = comment;
+	}
+

Review comment:
       @danny0405 Yes, I have already merged `SqlTableComputedColumn` into `SqlTableColumn`. Please review this pull request again.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-692439120


   Mering...


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 800d23e1a95bee277aa2dce51c0625901fae92ca Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403) 
   * d9345a586435c7b1efb8aa8ffe210d659bd01c3b UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d06dbcd04a611f3adfa2812668a13195f65237fd Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334) 
   * 800d23e1a95bee277aa2dce51c0625901fae92ca UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427",
       "triggerID" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7074c013502a3b3d966e102bfdbc164cb3ba6ef1",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6436",
       "triggerID" : "7074c013502a3b3d966e102bfdbc164cb3ba6ef1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7074c013502a3b3d966e102bfdbc164cb3ba6ef1 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6436) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong merged pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
wuchong merged pull request #13352:
URL: https://github.com/apache/flink/pull/13352


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 800d23e1a95bee277aa2dce51c0625901fae92ca Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d06dbcd04a611f3adfa2812668a13195f65237fd UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] danny0405 commented on a change in pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #13352:
URL: https://github.com/apache/flink/pull/13352#discussion_r486044814



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlTableColumn.java
##########
@@ -65,34 +67,55 @@ public SqlTableColumn(SqlIdentifier name,
 		this.comment = comment;
 	}
 
+	public SqlTableColumn(SqlIdentifier name,
+			SqlNode expr,
+			@Nullable SqlCharStringLiteral comment,
+			SqlParserPos pos) {
+		super(pos);
+		this.name = requireNonNull(name, "Column name should not be null");
+		this.expr = requireNonNull(expr, "Column expression should not be null");
+		this.comment = comment;
+	}
+
 	@Override
 	public SqlOperator getOperator() {
 		return OPERATOR;
 	}
 
 	@Override
 	public List<SqlNode> getOperandList() {
-		return ImmutableNullableList.of(name, type, comment);
+		return isComputed() ?
+			ImmutableNullableList.of(name, expr, comment) :
+			ImmutableNullableList.of(name, type, comment);
 	}
 
 	@Override
 	public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
 		this.name.unparse(writer, leftPrec, rightPrec);
-		writer.print(" ");
-		this.type.unparse(writer, leftPrec, rightPrec);
-		if (!this.type.getNullable()) {
-			// Default is nullable.
-			writer.keyword("NOT NULL");
-		}
-		if (this.constraint != null) {
-			this.constraint.unparse(writer, leftPrec, rightPrec);
+		if (isComputed()) {
+			writer.keyword("AS");
+			this.expr.unparse(writer, leftPrec, rightPrec);
+		} else {
+			writer.print(" ");
+			this.type.unparse(writer, leftPrec, rightPrec);
+			if (!this.type.getNullable()) {
+				// Default is nullable.
+				writer.keyword("NOT NULL");
+			}
+			if (this.constraint != null) {
+				this.constraint.unparse(writer, leftPrec, rightPrec);
+			}
 		}
 		if (this.comment != null) {
 			writer.print(" COMMENT ");
 			this.comment.unparse(writer, leftPrec, rightPrec);
 		}
 	}
 
+	public boolean isComputed() {
+		return type == null && expr != null;
+	}

Review comment:
       - Can be `isGenerated` to be synced with `TableColumn`
   - `return expr != null;` is enough




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d06dbcd04a611f3adfa2812668a13195f65237fd Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d06dbcd04a611f3adfa2812668a13195f65237fd Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334) 
   * 800d23e1a95bee277aa2dce51c0625901fae92ca Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427",
       "triggerID" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7074c013502a3b3d966e102bfdbc164cb3ba6ef1",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "7074c013502a3b3d966e102bfdbc164cb3ba6ef1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d9345a586435c7b1efb8aa8ffe210d659bd01c3b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427) 
   * 7074c013502a3b3d966e102bfdbc164cb3ba6ef1 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427",
       "triggerID" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 800d23e1a95bee277aa2dce51c0625901fae92ca Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403) 
   * d9345a586435c7b1efb8aa8ffe210d659bd01c3b Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on a change in pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #13352:
URL: https://github.com/apache/flink/pull/13352#discussion_r486161971



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlTableColumn.java
##########
@@ -109,6 +137,14 @@ public void setType(SqlDataTypeSpec type) {
 		this.type = type;
 	}
 
+	public SqlNode getExpr() {
+		return expr;
+	}
+
+	public void setExpr(SqlNode expr) {

Review comment:
       This is never used?

##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlTableColumn.java
##########
@@ -109,6 +137,14 @@ public void setType(SqlDataTypeSpec type) {
 		this.type = type;
 	}
 
+	public SqlNode getExpr() {

Review comment:
       Better to return `Optional<SqlNode>` to keep consistent with other nullable methods.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] danny0405 commented on a change in pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
danny0405 commented on a change in pull request #13352:
URL: https://github.com/apache/flink/pull/13352#discussion_r484870208



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlTableComputedColumn.java
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.sql.parser.ddl;
+
+import org.apache.calcite.sql.SqlCall;
+import org.apache.calcite.sql.SqlCharStringLiteral;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.SqlSpecialOperator;
+import org.apache.calcite.sql.SqlWriter;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.util.ImmutableNullableList;
+
+import javax.annotation.Nullable;
+
+import java.util.List;
+import java.util.Optional;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Table computed column of a CREATE TABLE DDL.
+ */
+public class SqlTableComputedColumn extends SqlCall {
+	private static final SqlSpecialOperator OPERATOR =
+		new SqlSpecialOperator("COLUMN_DECL", SqlKind.COLUMN_DECL);
+
+	private SqlNode identifier;
+	private SqlNode expr;
+	private SqlCharStringLiteral comment;
+
+	public SqlTableComputedColumn(SqlNode identifier, SqlNode expr, @Nullable SqlCharStringLiteral comment, SqlParserPos pos) {
+		super(pos);
+		this.identifier = requireNonNull(identifier, "Column identifier should not be null");
+		this.expr = requireNonNull(expr, "Column expression should not be null");
+		this.comment = comment;
+	}
+

Review comment:
       Can we merge this class into `SqlTableColumn` ? Just like what we do in schema `TableColumn`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13352: [FLINK-19092][sql-parser] Parse comment on computed column failed

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13352:
URL: https://github.com/apache/flink/pull/13352#issuecomment-688773679


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6334",
       "triggerID" : "d06dbcd04a611f3adfa2812668a13195f65237fd",
       "triggerType" : "PUSH"
     }, {
       "hash" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6403",
       "triggerID" : "800d23e1a95bee277aa2dce51c0625901fae92ca",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427",
       "triggerID" : "d9345a586435c7b1efb8aa8ffe210d659bd01c3b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7074c013502a3b3d966e102bfdbc164cb3ba6ef1",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6436",
       "triggerID" : "7074c013502a3b3d966e102bfdbc164cb3ba6ef1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d9345a586435c7b1efb8aa8ffe210d659bd01c3b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6427) 
   * 7074c013502a3b3d966e102bfdbc164cb3ba6ef1 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6436) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org