[ZEPPELIN-6465] Extract magic numbers in EmbeddingSearch.saveIndex() into named constants #5489
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 255 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5489"
general
weight: 0.35
ParkGyeongTae
What is this PR for?
EmbeddingSearchdeclares its tuning values as namedprivate static final intconstants near the top of the class (EMBEDDING_DIM,MAX_TEXT_LENGTH,MAX_INDEX_ENTRIES), but the two truncation limits insaveIndex()were left as bare literals. Each value appeared twice — once in the length check and once in thesubstring(0, ...)call — so changing only one occurrence would silently let the check bound and the truncation bound drift apart.This extracts
2000and1000intoMAX_PERSISTED_TEXT_LENGTHandMAX_PERSISTED_OUTPUT_LENGTH, following the constant style already used in the class, and replaces all four usages.The names deliberately distinguish these persistence limits from the existing
MAX_TEXT_LENGTH(1500), which bounds in-memory processing before embedding and is a different value for a different purpose. Javadoc on the new text constant makes that distinction explicit.Values are unchanged, so behavior and the persisted binary format are identical and
INDEX_VERSIONdoes not need to move.loadIndex()has no corresponding truncation logic and is untouched.What type of PR is it?
Refactoring
Todos
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6465
How should this be tested?
The EmbeddingSearch tests are gated behind
ZEPPELIN_EMBEDDING_TESTand require the embedding model to be installed first:bash bin/install-search-model.sh
ZEPPELIN_EMBEDDING_TEST=true ./mvnw test -pl zeppelin-server -Dtest='EmbeddingSearch'
All 12 tests pass.
grep -n "2000\|1000" EmbeddingSearch.javashows the values only at the two constant declarations, with no bare literals left insaveIndex().Screenshots (if appropriate)
N/A
Questions:
Does the license files need to update? No
Is there breaking changes for older versions? No