Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.0.0
-
None
-
None
Description
There are the following tables under default: order_info, test123
When I execute the following logic (get the table that starts with test), test123 is returned
String tableNameRegex = "^(test).*"; TableName[] tns = admin.listTableNames(Pattern.compile(tableNameRegex));
When I execute the following logic (get a table that doesn't start with test), the return is order_info, test123
String tableNameRegex = "^(?!test).*"; TableName[] tns = admin.listTableNames(Pattern.compile(tableNameRegex));
As you can see, table test123 is returned both times.
When I look at the source code, I find that when I perform a regular match for the table in the default namespace, I perform one step more judgment, resulting in a table starting with test being returned both times.
boolean matched = pattern.matcher(tableName).matches(); if (!matched && htd.getTableName().getNamespaceAsString().equals(defaultNS)) { matched = pattern.matcher(defaultNS + TableName.NAMESPACE_DELIM + tableName).matches(); }
I think there are problems with this regular matching logic