You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by yu...@apache.org on 2023/06/19 09:29:02 UTC
[flink] branch master updated: [FLINK-32233][sql] Introduce SupportsTruncate interface (#22692)
This is an automated email from the ASF dual-hosted git repository.
yuxia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 1a3151b5b9f [FLINK-32233][sql] Introduce SupportsTruncate interface (#22692)
1a3151b5b9f is described below
commit 1a3151b5b9f1df8aaa221b2febfae0431a69b95d
Author: yuxia Luo <lu...@alumni.sjtu.edu.cn>
AuthorDate: Mon Jun 19 17:28:52 2023 +0800
[FLINK-32233][sql] Introduce SupportsTruncate interface (#22692)
---
.../connector/sink/abilities/SupportsTruncate.java | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsTruncate.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsTruncate.java
new file mode 100644
index 00000000000..6b5a43d06df
--- /dev/null
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsTruncate.java
@@ -0,0 +1,43 @@
+/*
+ * 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.table.connector.sink.abilities;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+
+/**
+ * Enables to delete all existing data in a {@link DynamicTableSink} table using {@code TRUNCATE
+ * TABLE} statement.
+ *
+ * <p>For {@code TRUNCATE TABLE} statement, if the corresponding {@link DynamicTableSink} have
+ * implemented this interface, then the method {@link #executeTruncation()} will be invoked in
+ * execution phase. Otherwise, Flink will throw exception directly.
+ */
+@PublicEvolving
+public interface SupportsTruncate {
+
+ /**
+ * Execute truncating table.
+ *
+ * <p>Note: please remember to throw exception if the truncation hasn't been executed
+ * successfully, otherwise it'll be still considered to haven been executed successfully by
+ * Flink.
+ */
+ void executeTruncation();
+}