You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ki...@apache.org on 2022/03/21 07:49:30 UTC

[incubator-seatunnel] branch dev updated: [bug][seatunnel-api-flink] - fix tableexits not contain TemporaryTable #1498 (#1526)

This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new e09a49e  [bug][seatunnel-api-flink] - fix tableexits not contain TemporaryTable #1498 (#1526)
e09a49e is described below

commit e09a49e485e4b72cdb93b02ce2d8ca101815bac1
Author: 沫 <32...@njau.edu.cn>
AuthorDate: Mon Mar 21 15:49:25 2022 +0800

    [bug][seatunnel-api-flink] - fix tableexits not contain TemporaryTable #1498 (#1526)
    
    Co-authored-by: zhoutao.tobeone <zh...@bytedance.com>
---
 .../src/main/java/org/apache/seatunnel/flink/util/TableUtil.java | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/seatunnel-apis/seatunnel-api-flink/src/main/java/org/apache/seatunnel/flink/util/TableUtil.java b/seatunnel-apis/seatunnel-api-flink/src/main/java/org/apache/seatunnel/flink/util/TableUtil.java
index a615ec9..e1877ef 100644
--- a/seatunnel-apis/seatunnel-api-flink/src/main/java/org/apache/seatunnel/flink/util/TableUtil.java
+++ b/seatunnel-apis/seatunnel-api-flink/src/main/java/org/apache/seatunnel/flink/util/TableUtil.java
@@ -24,10 +24,10 @@ import org.apache.flink.table.api.Table;
 import org.apache.flink.table.api.TableEnvironment;
 import org.apache.flink.table.api.bridge.java.BatchTableEnvironment;
 import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
-import org.apache.flink.table.catalog.Catalog;
-import org.apache.flink.table.catalog.ObjectPath;
 import org.apache.flink.types.Row;
 
+import java.util.Arrays;
+
 public final class TableUtil {
 
     private TableUtil() {
@@ -59,9 +59,6 @@ public final class TableUtil {
     }
 
     public static boolean tableExists(TableEnvironment tableEnvironment, String name) {
-        String currentCatalog = tableEnvironment.getCurrentCatalog();
-        Catalog catalog = tableEnvironment.getCatalog(currentCatalog).get();
-        ObjectPath objectPath = new ObjectPath(tableEnvironment.getCurrentDatabase(), name);
-        return catalog.tableExists(objectPath);
+        return Arrays.asList(tableEnvironment.listTables()).contains(name);
     }
 }