Unverified Commit 23e8d5a5 authored by Licho's avatar Licho Committed by GitHub

fix: udf not support CASE INSENSITIVE (#1509)

Signed-off-by: 's avatarLicho <chinabhsun@gmail.com> Signed-off-by: 's avatarLicho <chinabhsun@gmail.com>
parent 7a7c8eb0
...@@ -280,13 +280,13 @@ public class UDFUtil { ...@@ -280,13 +280,13 @@ public class UDFUtil {
return MD5.create().digestHex(FileUtil.file(filePath)); return MD5.create().digestHex(FileUtil.file(filePath));
} }
public static boolean isUdfStatement(String statement) { public static boolean isUdfStatement(Pattern pattern, String statement) {
return !StrUtil.isBlank(statement) && CollUtil.isNotEmpty(ReUtil.findAll(FUNCTION_SQL_REGEX, statement, 0)); return !StrUtil.isBlank(statement) && CollUtil.isNotEmpty(ReUtil.findAll(pattern, statement, 0));
} }
public static UDF toUDF(String statement) { public static UDF toUDF(String statement) {
if (isUdfStatement(statement)) {
Pattern pattern = Pattern.compile(FUNCTION_SQL_REGEX, Pattern.CASE_INSENSITIVE); Pattern pattern = Pattern.compile(FUNCTION_SQL_REGEX, Pattern.CASE_INSENSITIVE);
if (isUdfStatement(pattern, statement)) {
List<String> groups = CollUtil.removeEmpty(ReUtil.getAllGroups(pattern, statement)); List<String> groups = CollUtil.removeEmpty(ReUtil.getAllGroups(pattern, statement));
String udfName = groups.get(1); String udfName = groups.get(1);
String className = groups.get(2); String className = groups.get(2);
......
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