Unverified Commit 254bcb39 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Fix] fix addfile cannot parse (#3278)

parent af931a88
......@@ -252,8 +252,8 @@ public class Submitter {
public static Optional<JobClient> executeJarJob(String type, Executor executor, String[] statements) {
Optional<JobClient> jobClient = Optional.empty();
for (int i = 0; i < statements.length; i++) {
String sqlStatement = executor.pretreatStatement(statements[i]);
for (String statement : statements) {
String sqlStatement = executor.pretreatStatement(statement);
if (ExecuteJarParseStrategy.INSTANCE.match(sqlStatement)) {
ExecuteJarOperation executeJarOperation = new ExecuteJarOperation(sqlStatement);
StreamGraph streamGraph = executeJarOperation.getStreamGraph(executor.getCustomTableEnvironment());
......@@ -276,13 +276,13 @@ public class Submitter {
if (Operations.getOperationType(sqlStatement) == SqlType.ADD) {
File[] info = AddJarSqlParseStrategy.getInfo(sqlStatement);
Arrays.stream(info).forEach(executor.getDinkyClassLoader().getUdfPathContextHolder()::addOtherPlugins);
if ("kubernetes-application".equals(type)) {
if (GatewayType.get(type).isKubernetesApplicationMode()) {
executor.addJar(info);
}
} else if (Operations.getOperationType(sqlStatement) == SqlType.ADD_FILE) {
File[] info = AddFileSqlParseStrategy.getInfo(sqlStatement);
Arrays.stream(info).forEach(executor.getDinkyClassLoader().getUdfPathContextHolder()::addFile);
if ("kubernetes-application".equals(type)) {
if (GatewayType.get(type).isKubernetesApplicationMode()) {
executor.addJar(info);
}
}
......
......@@ -19,6 +19,8 @@
package org.dinky.executor;
import org.dinky.utils.LogUtil;
import org.apache.calcite.sql.SqlNode;
import org.apache.flink.table.catalog.UnresolvedIdentifier;
import org.apache.flink.table.expressions.ResolvedExpression;
......@@ -44,8 +46,12 @@ public class ParserWrapper implements ExtendedParser {
if (result != null) {
return result;
}
return customParser.getParser().parse(statement);
try {
return customParser.getParser().parse(statement);
} catch (Exception e) {
throw new RuntimeException(
String.format("Failed to parse statement: %s , reason: %s", statement, LogUtil.getError(e)), e);
}
}
@Override
......
......@@ -30,13 +30,13 @@ import java.util.Optional;
/**
* @since 0.7.0
*/
public class AddFilerOperation extends AbstractOperation implements ExtendOperation {
public class AddFileOperation extends AbstractOperation implements ExtendOperation {
public AddFilerOperation(String statement) {
public AddFileOperation(String statement) {
super(statement);
}
public AddFilerOperation() {}
public AddFileOperation() {}
@Override
public Optional<? extends TableResult> execute(CustomTableEnvironment tEnv) {
......
......@@ -20,7 +20,7 @@
package org.dinky.trans.parse;
import org.dinky.data.exception.DinkyException;
import org.dinky.trans.ddl.AddFilerOperation;
import org.dinky.trans.ddl.AddFileOperation;
import org.dinky.utils.URLUtils;
import org.apache.flink.table.operations.Operation;
......@@ -86,7 +86,7 @@ public class AddFileSqlParseStrategy extends AbstractRegexParseStrategy {
@Override
public Operation convert(String statement) {
return new AddFilerOperation(statement);
return new AddFileOperation(statement);
}
@Override
......
org.dinky.trans.parse.AddJarSqlParseStrategy
org.dinky.trans.parse.AddFileSqlParseStrategy
org.dinky.trans.parse.CreateAggTableSelectSqlParseStrategy
org.dinky.trans.parse.CreateTemporalTableFunctionParseStrategy
org.dinky.trans.parse.ExecuteJarParseStrategy
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment