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/05/17 08:53:54 UTC

[GitHub] [flink] SteNicholas opened a new pull request #12197: [FLINK-15349][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   ## What is the purpose of the change
   
   *DDL statement of table blink planner has no statement that drop catalog, this should add 'DROP catalog' DDL to blink planner.*
   
   ## Brief change log
   
     - *Add `DROP CATALOG` ddl statement to `SqlCommandParser` and `TableEnvironmentImpl`.*
   
   ## Verifying this change
   
     - *`SqlCommandParserTest` add `DROP CATALOG` statement parser test.*
     - *`FlinkSqlParserImplTest` add `DROP CATALOG` statement parser test.*
     - *`TableEnvironmentTest` add `DROP CATALOG` statement execution test.*
   
   ## 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] flinkbot edited a comment on pull request #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   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 651eb1227a72a0600434462a878c4db5033a1abe (Fri Oct 16 10:48:04 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] lirui-apache commented on a change in pull request #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

Posted by GitBox <gi...@apache.org>.
lirui-apache commented on a change in pull request #12197:
URL: https://github.com/apache/flink/pull/12197#discussion_r426532648



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlDropCatalog.java
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.SqlDrop;
+import org.apache.calcite.sql.SqlIdentifier;
+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 java.util.List;
+
+/**
+ * DROP CATALOG DDL sql call.
+ */
+public class SqlDropCatalog extends SqlDrop {
+
+	private static final SqlOperator OPERATOR = new SqlSpecialOperator("DROP CATALOG", SqlKind.OTHER_DDL);
+
+	private final SqlIdentifier catalogName;
+	private boolean ifExists;

Review comment:
       make it final

##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlDropCatalog.java
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.SqlDrop;
+import org.apache.calcite.sql.SqlIdentifier;
+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 java.util.List;
+
+/**
+ * DROP CATALOG DDL sql call.
+ */
+public class SqlDropCatalog extends SqlDrop {
+
+	private static final SqlOperator OPERATOR = new SqlSpecialOperator("DROP CATALOG", SqlKind.OTHER_DDL);
+
+	private final SqlIdentifier catalogName;
+	private boolean ifExists;
+
+	public SqlDropCatalog(SqlParserPos pos, SqlIdentifier catalogName, boolean ifExists) {
+		super(OPERATOR, pos, false);
+		this.catalogName = catalogName;
+		this.ifExists = ifExists;
+	}
+
+	@Override
+	public List<SqlNode> getOperandList() {
+		return ImmutableNullableList.of(catalogName);
+	}
+
+	public SqlIdentifier getCatalogName() {
+		return catalogName;
+	}
+
+	public boolean getIfExists() {
+		return this.ifExists;
+	}
+
+	@Override
+	public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
+		writer.keyword("DROP");
+		writer.keyword("CATALOG");
+		catalogName.unparse(writer, leftPrec, rightPrec);

Review comment:
       `IF EXISTS` should be reflected in unparse




----------------------------------------------------------------
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 #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "15cb31fea013766318c482cd266aa294b9df225b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "15cb31fea013766318c482cd266aa294b9df225b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a2db8c158cd4492f84815d068176550d569d5c1f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601) 
   * 15cb31fea013766318c482cd266aa294b9df225b 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 #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "15cb31fea013766318c482cd266aa294b9df225b",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603",
       "triggerID" : "15cb31fea013766318c482cd266aa294b9df225b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a2db8c158cd4492f84815d068176550d569d5c1f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601) 
   * 15cb31fea013766318c482cd266aa294b9df225b Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603) 
   
   <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 #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "15cb31fea013766318c482cd266aa294b9df225b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603",
       "triggerID" : "15cb31fea013766318c482cd266aa294b9df225b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1dd4c872d42e9b26907e350aeacb5f278b2b74c1",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1703",
       "triggerID" : "1dd4c872d42e9b26907e350aeacb5f278b2b74c1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 15cb31fea013766318c482cd266aa294b9df225b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603) 
   * 1dd4c872d42e9b26907e350aeacb5f278b2b74c1 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1703) 
   
   <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 #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "15cb31fea013766318c482cd266aa294b9df225b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603",
       "triggerID" : "15cb31fea013766318c482cd266aa294b9df225b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1dd4c872d42e9b26907e350aeacb5f278b2b74c1",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1dd4c872d42e9b26907e350aeacb5f278b2b74c1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 15cb31fea013766318c482cd266aa294b9df225b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603) 
   * 1dd4c872d42e9b26907e350aeacb5f278b2b74c1 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 #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "15cb31fea013766318c482cd266aa294b9df225b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603",
       "triggerID" : "15cb31fea013766318c482cd266aa294b9df225b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 15cb31fea013766318c482cd266aa294b9df225b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603) 
   
   <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 #12197: [FLINK-15349][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   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 a2db8c158cd4492f84815d068176550d569d5c1f (Sun May 17 08:56:49 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] lirui-apache commented on pull request #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   Thanks @SteNicholas for working on this. I think we should clarify that this is more like `unregister` than `drop`, which means "dropping" a catalog doesn't drop the metadata stored in that catalog. It's different from dropping a database which will also drop all metadata associated with that database.


----------------------------------------------------------------
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] JingsongLi merged pull request #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   


----------------------------------------------------------------
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 #12197: [FLINK-15349][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a2db8c158cd4492f84815d068176550d569d5c1f 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 #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601",
       "triggerID" : "a2db8c158cd4492f84815d068176550d569d5c1f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "15cb31fea013766318c482cd266aa294b9df225b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603",
       "triggerID" : "15cb31fea013766318c482cd266aa294b9df225b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a2db8c158cd4492f84815d068176550d569d5c1f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1601) 
   * 15cb31fea013766318c482cd266aa294b9df225b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1603) 
   
   <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] lirui-apache commented on a change in pull request #12197: [FLINK-17357][table-planner-blink] add 'DROP catalog' DDL to blink pl…

Posted by GitBox <gi...@apache.org>.
lirui-apache commented on a change in pull request #12197:
URL: https://github.com/apache/flink/pull/12197#discussion_r426236545



##########
File path: flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlDropCatalog.java
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.SqlDrop;
+import org.apache.calcite.sql.SqlIdentifier;
+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 java.util.List;
+
+/**
+ * DROP CATALOG DDL sql call.
+ */
+public class SqlDropCatalog extends SqlDrop {
+
+	private static final SqlOperator OPERATOR = new SqlSpecialOperator("DROP CATALOG", SqlKind.OTHER_DDL);
+
+	private final SqlIdentifier catalogName;
+
+	public SqlDropCatalog(SqlParserPos pos, SqlIdentifier catalogName) {
+		super(OPERATOR, pos, false);
+		this.catalogName = catalogName;
+	}
+
+	@Override
+	public List<SqlNode> getOperandList() {
+		return ImmutableNullableList.of(catalogName);
+	}
+
+	public SqlIdentifier getCatalogName() {
+		return catalogName;
+	}
+
+	@Override
+	public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
+		writer.keyword("DROP");
+		writer.keyword("CATALOG");
+		catalogName.unparse(writer, leftPrec, rightPrec);
+	}
+
+	public String catalogName() {
+		return catalogName.names.get(0);

Review comment:
       ```suggestion
   		return catalogName.getSimple();
   ```

##########
File path: flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl
##########
@@ -1302,6 +1315,8 @@ SqlDrop SqlDropExtended(Span s, boolean replace) :
         <TEMPORARY> { isTemporary = true; }
     ]
     (
+        drop = SqlDropCatalog(s, replace)

Review comment:
       Do we have to put it under `SqlDropExtended`? I don't think it makes sense to support temporary catalogs.

##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java
##########
@@ -171,6 +171,24 @@ public void registerCatalog(String catalogName, Catalog catalog) {
 		catalog.open();
 	}
 
+	/**
+	 * Unregisters a catalog under the given name. The catalog name must be existed.
+	 *
+	 * @param catalogName name under which to unregister the given catalog
+	 * @throws CatalogException if the unregistration of the catalog under the given name failed
+	 */
+	public void unregisterCatalog(String catalogName) {
+		checkArgument(!StringUtils.isNullOrWhitespaceOnly(catalogName), "Catalog name cannot be null or empty.");
+
+		if (!catalogs.containsKey(catalogName)) {
+			throw new CatalogException(format("Catalog %s does not exist.", catalogName));

Review comment:
       If we enforce this check, I think we should support `DROP CATALOG IF EXSITS`




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