Skip to content

Commit 72c7873

Browse files
committed
fix can't find mysqlasyncside plugin bug
1 parent d6fb44a commit 72c7873

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package com.dtstack.flink.sql.side;
2222

2323
import com.dtstack.flink.sql.classloader.DtClassLoader;
24+
import com.dtstack.flink.sql.enums.ECacheType;
2425
import com.dtstack.flink.sql.table.AbsSideTableParser;
2526
import com.dtstack.flink.sql.table.AbsTableParser;
2627
import com.dtstack.flink.sql.util.PluginUtil;
@@ -36,14 +37,11 @@ public class StreamSideFactory {
3637

3738
private static final String CURR_TYPE = "side";
3839

39-
private static final String SIDE_DIR_TMPL = "%s%sside";
40-
4140
public static AbsTableParser getSqlParser(String pluginType, String sqlRootDir, String cacheType) throws Exception {
4241

43-
cacheType = cacheType == null ? "async" : cacheType;
44-
String sideDir = String.format(SIDE_DIR_TMPL, pluginType, cacheType);
42+
String sideOperator = ECacheType.ALL.name().equals(cacheType) ? "all" : "async";
4543
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
46-
String pluginJarPath = PluginUtil.getJarFileDirPath(sideDir, sqlRootDir);
44+
String pluginJarPath = PluginUtil.getSideJarFileDirPath(pluginType, sideOperator, "side", sqlRootDir);
4745

4846
DtClassLoader dtClassLoader = (DtClassLoader) classLoader;
4947
PluginUtil.addPluginJar(pluginJarPath, dtClassLoader);

core/src/main/java/com/dtstack/flink/sql/util/PluginUtil.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ public static String getJarFileDirPath(String type, String sqlRootDir){
6363
return jarPath;
6464
}
6565

66+
public static String getSideJarFileDirPath(String pluginType, String sideOperator, String tableType, String sqlRootDir) throws MalformedURLException {
67+
String dirName = sqlRootDir + SP + pluginType + sideOperator + tableType.toLowerCase();
68+
File jarFile = new File(dirName);
69+
70+
if(!jarFile.exists()){
71+
throw new RuntimeException(String.format("path %s not exists!!!", dirName));
72+
}
73+
74+
return dirName;
75+
}
76+
6677
public static String getGenerClassName(String pluginTypeName, String type) throws IOException {
6778
String pluginClassName = upperCaseFirstChar(pluginTypeName) + upperCaseFirstChar(type);
6879
return CLASS_PRE_STR + "." + type.toLowerCase() + "." + pluginTypeName + "." + pluginClassName;

0 commit comments

Comments
 (0)