Skip to content

Commit ab515e7

Browse files
author
yanxi0227
committed
add tmp table to cache
1 parent 7981f63 commit ab515e7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public class SideSqlExec {
6767

6868
private SideSQLParser sideSQLParser = new SideSQLParser();
6969

70+
private Map<String, Table> localTableCache = Maps.newHashMap();
71+
7072
public void exec(String sql, Map<String, SideTableInfo> sideTableMap, StreamTableEnvironment tableEnv,
7173
Map<String, Table> tableCache)
7274
throws Exception {
@@ -75,7 +77,7 @@ public void exec(String sql, Map<String, SideTableInfo> sideTableMap, StreamTabl
7577
throw new RuntimeException("need to set localSqlPluginPath");
7678
}
7779

78-
Map<String, Table> localTableCache = Maps.newHashMap(tableCache);
80+
localTableCache.putAll(tableCache);
7981
Queue<Object> exeQueue = sideSQLParser.getExeQueue(sql, sideTableMap.keySet());
8082
Object pollObj = null;
8183

@@ -501,7 +503,7 @@ public void registerTmpTable(CreateTmpTableParser.SqlParserResult result,
501503
throw new RuntimeException("need to set localSqlPluginPath");
502504
}
503505

504-
Map<String, Table> localTableCache = Maps.newHashMap(tableCache);
506+
localTableCache.putAll(tableCache);
505507
Queue<Object> exeQueue = sideSQLParser.getExeQueue(result.getExecSql(), sideTableMap.keySet());
506508
Object pollObj = null;
507509

@@ -540,6 +542,7 @@ public void registerTmpTable(CreateTmpTableParser.SqlParserResult result,
540542
throw new RuntimeException("Fields mismatch");
541543
}
542544
}
545+
localTableCache.put(result.getTableName(), table);
543546

544547
}
545548

0 commit comments

Comments
 (0)