Skip to content

Commit f1f0b23

Browse files
committed
[fix-32715][core]fix the same table join more than once, then throw 'table exists' error. The sql is analogous with 'Select a, b From TA join TB Union All Select a, b From TA join TB'
1 parent 22499cc commit f1f0b23

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

core/src/main/java/com/dtstack/flink/sql/side/SideSqlExec.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import java.util.Map;
7575
import java.util.Queue;
7676
import java.util.Set;
77+
import java.util.concurrent.atomic.AtomicBoolean;
7778

7879
import static org.apache.calcite.sql.SqlKind.AS;
7980
import static org.apache.calcite.sql.SqlKind.INSERT;
@@ -546,7 +547,13 @@ private void joinFun(Object pollObj,
546547
EnvironmentSettings.DEFAULT_BUILTIN_CATALOG,
547548
EnvironmentSettings.DEFAULT_BUILTIN_DATABASE,
548549
targetTableName);
549-
boolean tableExists = tableEnv.getCatalog(EnvironmentSettings.DEFAULT_BUILTIN_CATALOG).get().tableExists(objectIdentifier.toObjectPath());
550+
boolean tableExists = false;
551+
for (String table : tableEnv.listTables()) {
552+
if (table.equals(targetTableName)) {
553+
tableExists = true;
554+
break;
555+
}
556+
}
550557

551558
if (!tableExists) {
552559
Table joinTable = tableEnv.fromDataStream(dsOut);

0 commit comments

Comments
 (0)