Skip to content

Commit 0af546d

Browse files
author
sishu@dtstack.com
committed
TableInfoParser remove sourceTableInfoMap static
1 parent b4a2693 commit 0af546d

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

core/src/main/java/com/dtstack/flink/sql/parser/SqlParser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import com.dtstack.flink.sql.enums.ETableType;
2424
import com.dtstack.flink.sql.table.TableInfo;
25-
import com.dtstack.flink.sql.table.TableInfoParserFactory;
25+
import com.dtstack.flink.sql.table.TableInfoParser;
2626
import com.dtstack.flink.sql.util.DtStringUtil;
2727
import org.apache.commons.lang3.StringUtils;
2828
import org.apache.flink.shaded.curator.org.apache.curator.shaded.com.google.common.collect.Lists;
@@ -75,7 +75,7 @@ public static SqlTree parseSql(String sql) throws Exception {
7575

7676
List<String> sqlArr = DtStringUtil.splitIgnoreQuota(sql, SQL_DELIMITER);
7777
SqlTree sqlTree = new SqlTree();
78-
78+
TableInfoParser tableInfoParser = new TableInfoParser();
7979
for(String childSql : sqlArr){
8080
if(Strings.isNullOrEmpty(childSql)){
8181
continue;
@@ -112,7 +112,7 @@ public static SqlTree parseSql(String sql) throws Exception {
112112
throw new RuntimeException("can't find table " + tableName);
113113
}
114114

115-
TableInfo tableInfo = TableInfoParserFactory.parseWithTableType(ETableType.SOURCE.getType(),
115+
TableInfo tableInfo = tableInfoParser.parseWithTableType(ETableType.SOURCE.getType(),
116116
createTableResult, LOCAL_SQL_PLUGIN_ROOT);
117117
sqlTree.addTableInfo(tableName, tableInfo);
118118
}
@@ -125,7 +125,7 @@ public static SqlTree parseSql(String sql) throws Exception {
125125
throw new RuntimeException("can't find table " + tableName);
126126
}
127127

128-
TableInfo tableInfo = TableInfoParserFactory.parseWithTableType(ETableType.SINK.getType(),
128+
TableInfo tableInfo = tableInfoParser.parseWithTableType(ETableType.SINK.getType(),
129129
createTableResult, LOCAL_SQL_PLUGIN_ROOT);
130130
sqlTree.addTableInfo(tableName, tableInfo);
131131
}
@@ -141,7 +141,7 @@ public static SqlTree parseSql(String sql) throws Exception {
141141
throw new RuntimeException("can't find table " + tableName);
142142
}
143143

144-
TableInfo tableInfo = TableInfoParserFactory.parseWithTableType(ETableType.SOURCE.getType(),
144+
TableInfo tableInfo = tableInfoParser.parseWithTableType(ETableType.SOURCE.getType(),
145145
createTableResult, LOCAL_SQL_PLUGIN_ROOT);
146146
sqlTree.addTableInfo(tableName, tableInfo);
147147
}

core/src/main/java/com/dtstack/flink/sql/table/TableInfoParserFactory.java renamed to core/src/main/java/com/dtstack/flink/sql/table/TableInfoParser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@
4242
* @author xuchao
4343
*/
4444

45-
public class TableInfoParserFactory {
45+
public class TableInfoParser {
4646

4747
private final static String TYPE_KEY = "type";
4848

4949
private final static String SIDE_TABLE_SIGN = "(?i)^PERIOD\\s+FOR\\s+SYSTEM_TIME$";
5050

5151
private final static Pattern SIDE_PATTERN = Pattern.compile(SIDE_TABLE_SIGN);
5252

53-
private static Map<String, AbsTableParser> sourceTableInfoMap = Maps.newConcurrentMap();
53+
private Map<String, AbsTableParser> sourceTableInfoMap = Maps.newConcurrentMap();
5454

55-
private static Map<String, AbsTableParser> targetTableInfoMap = Maps.newConcurrentMap();
55+
private Map<String, AbsTableParser> targetTableInfoMap = Maps.newConcurrentMap();
5656

57-
private static Map<String, AbsTableParser> sideTableInfoMap = Maps.newConcurrentMap();
57+
private Map<String, AbsTableParser> sideTableInfoMap = Maps.newConcurrentMap();
5858

5959
//Parsing loaded plugin
60-
public static TableInfo parseWithTableType(int tableType, CreateTableParser.SqlParserResult parserResult,
60+
public TableInfo parseWithTableType(int tableType, CreateTableParser.SqlParserResult parserResult,
6161
String localPluginRoot) throws Exception {
6262
AbsTableParser absTableParser = null;
6363
Map<String, Object> props = parserResult.getPropMap();

0 commit comments

Comments
 (0)