@Test public void testRemoveAddFileStmt() throws Exception { List<String> rawStmts = new ArrayList<>(); String sql1 = " add file asdasdasd "; String sql2 = " aDd fIle With asdasdasd "; String sql3 = " INSERT INTO dwd_foo SELECT id, name FROM ods_foo"; String sql4 = " ADD FILE asb "; rawStmts.add(sql1); rawStmts.add(sql2); rawStmts.add(sql3); rawStmts.add(sql4); List<String> stmts = Whitebox.invokeMethod(SqlParser.class, "removeAddFileStmt", rawStmts); Assert.assertEquals(stmts.get(0), sql3); }
private static List<String> removeAddFileStmt(List<String> stmts) { List<String> cleanedStmts = new ArrayList<>(); for (String stmt : stmts) { Matcher matcher = ADD_FIlE_PATTERN.matcher(stmt); if(!matcher.matches()) { cleanedStmts.add(stmt); } } return cleanedStmts; }
SqlParser { private static List<String> removeAddFileStmt(List<String> stmts) { List<String> cleanedStmts = new ArrayList<>(); for (String stmt : stmts) { Matcher matcher = ADD_FIlE_PATTERN.matcher(stmt); if(!matcher.matches()) { cleanedStmts.add(stmt); } } return cleanedStmts; } }
SqlParser { private static List<String> removeAddFileStmt(List<String> stmts) { List<String> cleanedStmts = new ArrayList<>(); for (String stmt : stmts) { Matcher matcher = ADD_FIlE_PATTERN.matcher(stmt); if(!matcher.matches()) { cleanedStmts.add(stmt); } } return cleanedStmts; }  }
SqlParser { private static List<String> removeAddFileStmt(List<String> stmts) { List<String> cleanedStmts = new ArrayList<>(); for (String stmt : stmts) { Matcher matcher = ADD_FIlE_PATTERN.matcher(stmt); if(!matcher.matches()) { cleanedStmts.add(stmt); } } return cleanedStmts; }  static void setLocalSqlPluginRoot(String localSqlPluginRoot); static SqlTree parseSql(String sql, String pluginLoadMode); }
SqlParser { private static List<String> removeAddFileStmt(List<String> stmts) { List<String> cleanedStmts = new ArrayList<>(); for (String stmt : stmts) { Matcher matcher = ADD_FIlE_PATTERN.matcher(stmt); if(!matcher.matches()) { cleanedStmts.add(stmt); } } return cleanedStmts; }  static void setLocalSqlPluginRoot(String localSqlPluginRoot); static SqlTree parseSql(String sql, String pluginLoadMode);  }