@Test public void testConcatReplace() { String originString = "select count(*) as cnt from test_kylin_fact where lstg_format_name||'a'='ABINa'"; String replacedString = HivePushDownConverter.concatReplace(originString); assertEquals("select count(*) as cnt from test_kylin_fact where concat(lstg_format_name,'a')='ABINa'", replacedString); }
public static String concatReplace(String originString) { Matcher concatMatcher = CONCAT_PATTERN.matcher(originString); String replacedString = originString; while (concatMatcher.find()) { String leftString = concatMatcher.group(1); String rightString = concatMatcher.group(2); replacedString = replaceString(replacedString, leftString + "||" + rightString, "concat(" + leftString + "," + rightString + ")"); } return replacedString; }
HivePushDownConverter implements IPushDownConverter { public static String concatReplace(String originString) { Matcher concatMatcher = CONCAT_PATTERN.matcher(originString); String replacedString = originString; while (concatMatcher.find()) { String leftString = concatMatcher.group(1); String rightString = concatMatcher.group(2); replacedString = replaceString(replacedString, leftString + "||" + rightString, "concat(" + leftString + "," + rightString + ")"); } return replacedString; } }
HivePushDownConverter implements IPushDownConverter { public static String concatReplace(String originString) { Matcher concatMatcher = CONCAT_PATTERN.matcher(originString); String replacedString = originString; while (concatMatcher.find()) { String leftString = concatMatcher.group(1); String rightString = concatMatcher.group(2); replacedString = replaceString(replacedString, leftString + "||" + rightString, "concat(" + leftString + "," + rightString + ")"); } return replacedString; }  }
HivePushDownConverter implements IPushDownConverter { public static String concatReplace(String originString) { Matcher concatMatcher = CONCAT_PATTERN.matcher(originString); String replacedString = originString; while (concatMatcher.find()) { String leftString = concatMatcher.group(1); String rightString = concatMatcher.group(2); replacedString = replaceString(replacedString, leftString + "||" + rightString, "concat(" + leftString + "," + rightString + ")"); } return replacedString; }  static String replaceString(String originString, String fromString, String toString); static String extractReplace(String originString); static String castReplace(String originString); static String subqueryReplace(String originString); static String timestampAddDiffReplace(String originString); static String concatReplace(String originString); static String addLimit(String originString); static String doConvert(String originStr, boolean isPrepare); @Override String convert(String originSql, String project, String defaultSchema, boolean isPrepare); }
HivePushDownConverter implements IPushDownConverter { public static String concatReplace(String originString) { Matcher concatMatcher = CONCAT_PATTERN.matcher(originString); String replacedString = originString; while (concatMatcher.find()) { String leftString = concatMatcher.group(1); String rightString = concatMatcher.group(2); replacedString = replaceString(replacedString, leftString + "||" + rightString, "concat(" + leftString + "," + rightString + ")"); } return replacedString; }  static String replaceString(String originString, String fromString, String toString); static String extractReplace(String originString); static String castReplace(String originString); static String subqueryReplace(String originString); static String timestampAddDiffReplace(String originString); static String concatReplace(String originString); static String addLimit(String originString); static String doConvert(String originStr, boolean isPrepare); @Override String convert(String originSql, String project, String defaultSchema, boolean isPrepare);  }