github-actions[bot] commented on code in PR #69730:
URL: https://github.com/apache/doris/pull/69730#discussion_r4399625245


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java:
##########
@@ -4161,13 +4164,15 @@ public Index getInvertedIndex(Column column, 
List<String> subPath, String analyz
                                 .getPathMatcher("glob:" + childName);
                         if 
(matcher.matches(java.nio.file.Paths.get(subPathString))) {
                             fieldPattern = childName;
+                            break;

Review Comment:
   [P2] Match the BE glob dialect before stopping at the first field
   
   For legal fields declared as `MATCH_NAME_GLOB 'a.{b,c}'` followed by 
`MATCH_NAME 'a.b'`, with different parsers on their field-pattern indexes, this 
new break selects the brace-pattern index for path `a.b`. Java glob treats 
braces as alternatives, but `generate_sub_column_info` in `variant_util.cpp` 
uses `fnmatch(..., FNM_PATHNAME)`, which treats these braces literally and 
builds only the exact field's index. Previously the loop continued to `a.b` and 
selected the correct metadata. The selected parser/analyzer is transmitted to 
MATCH and SEARCH; BE cannot find that analyzer on the physical subcolumn, 
causing index bypass or query failure when MATCH fallback is disabled. Use 
matching semantics equivalent to the BE before applying first-match precedence, 
and cover this case with distinct analyzers. The dialect difference follows the 
[Java glob 
API](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String))
 and [fnmatc
 h wildcard rules](https://man7.org/linux/man-pages/man7/glob.7.html).



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java:
##########
@@ -4161,13 +4164,15 @@ public Index getInvertedIndex(Column column, 
List<String> subPath, String analyz
                                 .getPathMatcher("glob:" + childName);
                         if 
(matcher.matches(java.nio.file.Paths.get(subPathString))) {
                             fieldPattern = childName;
+                            break;
                         }
                     } catch (Exception e) {
                         continue;
                     }
                 } else if (child.getFieldPatternType() == 
PatternType.MATCH_NAME) {
                     if (childName.equals(subPathString)) {
                         fieldPattern = childName;
+                        break;

Review Comment:
   [P2] Restrict fallback to the root index for an unindexed first field
   
   Consider fields declared in order as unindexed `MATCH_NAME 'a.b'`, indexed 
`MATCH_NAME_GLOB 'a.*'`, and indexed `MATCH_NAME 'c'`. Give the root and `a.*` 
indexes no parser/analyzer properties, and give the `c` index `parser=unicode`. 
The BE matches `a.b` first and inherits the root keyword index. Previously FE 
continued to `a.*` and returned equivalent keyword metadata. With this break, 
`a.b` has no field-pattern index, so the fallback below searches all column 
indexes and selects `c` as the only analyzed index. It now sends the unrelated 
unicode analyzer for a physical keyword index, making previously working MATCH 
queries bypass the index or fail with 
`enable_match_without_inverted_index=false`. When the first matched field has 
no indexes, use only root indexes (empty `field_pattern`), matching BE 
inheritance, and add this overlapping-field case to coverage.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to