Commit 9df18f60 authored by 高攀's avatar 高攀

[Fix][common] FlinkSQL开发时,最后一段 SQL 若以分号结尾,校验 SQL 会报错

parent 2dd072f3
......@@ -10,11 +10,20 @@ import com.dlink.assertion.Asserts;
*/
public class SqlUtil {
private static final String SEMICOLON = ";";
public static String[] getStatements(String sql, String sqlSeparator) {
if (Asserts.isNullString(sql)) {
return new String[0];
}
return sql.split(sqlSeparator);
String[] splits = sql.split(sqlSeparator);
String lastStatement = splits[splits.length - 1].trim();
if (lastStatement.endsWith(SEMICOLON)){
splits[splits.length - 1] = lastStatement.substring(0,lastStatement.length()-1);
}
return splits;
}
public static String removeNote(String sql) {
......
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