github-actions[bot] commented on code in PR #70396:
URL: https://github.com/apache/doris/pull/70396#discussion_r4545792490
##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -3363,20 +3378,23 @@ private boolean processAddIndex(CreateIndexOp
createIndexOp, OlapTable olapTable
indexDef.checkColumn(column, olapTable.getKeysType(),
olapTable.getEnableUniqueKeyMergeOnWrite(),
olapTable.getInvertedIndexFileStorageFormat());
- if
(!InvertedIndexUtil.getInvertedIndexFieldPattern(indexDef.getProperties()).isEmpty())
{
- throw new DdlException("Can not create index with field
pattern");
+ // checkColumn fills defaults such as gram-family
support_phrase=false after
+ // CreateIndexOp#validate materializes alterIndex. Sync before
template validation
+ // so the binder and BE see the same effective properties.
+ indexDef.applyPropertiesTo(alterIndex);
+ if (column.getType().isVariantType() &&
indexDef.getIndexType() == IndexType.INVERTED) {
+ List<Index> candidateIndexes = new ArrayList<>(newIndexes);
+ candidateIndexes.add(alterIndex);
+ VariantTemplateIndexBinder.validateIndexes(column,
candidateIndexes,
Review Comment:
[P1] Honor the current field-pattern analyzer on historical rowsets
Consider `v VARIANT<'msg':STRING>` with an English root inverted index and
an old `{"msg":"hello world"}` row, then `ADD INDEX idx_msg(v) USING INVERTED
PROPERTIES('field_pattern'='msg', 'parser'='none')`. FE now binds MATCH to the
keyword analyzer, whose analyzer key is empty, but old Segments keep their
original schema: `find_subcolumn_tablet_indexes` inherits the old English root
index, and `select_best_inverted_index_candidate` treats that empty key as
unrestricted. Consequently `WHERE v['msg'] MATCH_ANY 'hello'` returns the old
row while identical newly inserted rows do not match; disabling
`enable_inverted_index_query` returns neither. The new type gate passes both
STRING leaves. Enforce the current keyword/index binding or bypass incompatible
historical indexes, and cover this transition with index-enabled/disabled
queries. Dropping an analyzed field-pattern index while retaining a keyword
root can trigger the same defect.
--
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]