airborne12 commented on code in PR #67917:
URL: https://github.com/apache/doris/pull/67917#discussion_r4000399335
##########
fe/fe-core/src/main/java/org/apache/doris/indexpolicy/NGramTokenizerValidator.java:
##########
@@ -28,7 +28,7 @@
public class NGramTokenizerValidator extends BasePolicyValidator {
private static final Set<String> ALLOWED_PROPS = ImmutableSet.of(
- "type", "min_gram", "max_gram", "token_chars",
"custom_token_chars");
+ "type", "min_gram", "max_gram", "max_ngram_diff", "token_chars",
"custom_token_chars");
Review Comment:
Fixed in 89137eab9b7. `resolveComponentIdentity` now removes
`max_ngram_diff` only for ngram tokenizer policies, because this setting is a
policy-creation ceiling and does not affect emitted tokens. The new
`AnalyzerIdentityBuilderTest` resolves two custom analyzers through
`IndexPolicyMgr` whose tokenizer policies differ only by this ceiling and
verifies that their identities are equal. Both CREATE and ALTER duplicate-index
checks consume this same `AnalyzerIdentityBuilder` identity, so the shared
invariant covers both paths. `./run-fe-ut.sh --run
org.apache.doris.analysis.invertedindex.AnalyzerIdentityBuilderTest,org.apache.doris.indexpolicy.PolicyValidatorTests`
passed all 27 tests, and the exact merge-tree Checkstyle preflight passed.
##########
fe/fe-core/src/main/java/org/apache/doris/indexpolicy/NGramTokenizerValidator.java:
##########
@@ -77,6 +77,24 @@ protected void validateSpecific(Map<String, String> props)
throws DdlException {
+ "cannot be smaller than min_gram [" + minGram + "]");
}
+ int maxNgramDiff = 1;
+ if (props.containsKey("max_ngram_diff")) {
+ try {
+ maxNgramDiff = Integer.parseInt(props.get("max_ngram_diff"));
Review Comment:
Fixed in 89137eab9b7. FE now requires `max_ngram_diff` to match ASCII
integer syntax before calling `Integer.parseInt`, so an Arabic-Indic value such
as `٧` is rejected at policy validation and cannot be persisted or forwarded to
BE. The new validator test exercises that exact value and verifies rejection;
together with the existing BE integer parsing path, this closes the FE/BE
handoff mismatch. `./run-fe-ut.sh --run
org.apache.doris.analysis.invertedindex.AnalyzerIdentityBuilderTest,org.apache.doris.indexpolicy.PolicyValidatorTests`
passed all 27 tests, and the exact merge-tree Checkstyle preflight passed.
--
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]