Skip to content

Commit 74af8b3

Browse files
[code optimize]
1 parent f715cd0 commit 74af8b3

File tree

1 file changed

+6
-4
lines changed
  • core/src/main/java/com/dtstack/flink/sql

1 file changed

+6
-4
lines changed

core/src/main/java/com/dtstack/flink/sql/Main.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
import java.util.Set;
8686
import java.util.concurrent.TimeUnit;
8787
import com.dtstack.flink.sql.option.Options;
88+
import org.apache.calcite.sql.parser.SqlParser.Config;
8889

8990
/**
9091
* Date: 2018/6/26
@@ -100,6 +101,11 @@ public class Main {
100101

101102
private static final Logger LOG = LoggerFactory.getLogger(Main.class);
102103

104+
private static Config config = org.apache.calcite.sql.parser.SqlParser
105+
.configBuilder()
106+
.setLex(Lex.MYSQL)
107+
.build();
108+
103109
public static void main(String[] args) throws Exception {
104110

105111
OptionParser optionParser = new OptionParser(args);
@@ -174,10 +180,6 @@ private static void sqlTranslation(Options options,StreamTableEnvironment tableE
174180
CreateTmpTableParser.SqlParserResult tmp = sqlTree.getTmpTableMap().get(tableName);
175181
String realSql = DtStringUtil.replaceIgnoreQuota(result.getExecSql(), "`", "");
176182

177-
org.apache.calcite.sql.parser.SqlParser.Config config = org.apache.calcite.sql.parser.SqlParser
178-
.configBuilder()
179-
.setLex(Lex.MYSQL)
180-
.build();
181183
SqlNode sqlNode = org.apache.calcite.sql.parser.SqlParser.create(realSql,config).parseStmt();
182184
String tmpSql = ((SqlInsert) sqlNode).getSource().toString();
183185
tmp.setExecSql(tmpSql);

0 commit comments

Comments
 (0)