Deduplicate ingest inference inputs within sub-batches - #1981
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: linjiaye <jiaye@binglan.tech>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Description
Deduplicates equal text inference inputs within a single ingest sub-batch, while preserving the existing document and field order. Each unique input is inferred once and its result is scattered to every original position with independent mutable result objects.
This applies only to the dense
text_embeddingand sparsesparse_encodingingest batching paths. Sparse WORD and TOKEN_ID requests remain separate inference boundaries. Existingskip_existingfiltering and batch error propagation are unchanged.This does not add a search cache, in-flight search coalescing, cross-request cache, node-local TTL cache, or cluster-wide cache.
Related Issues
Refs #1558
Test evidence
gradle.bat test -PskipSpotlessEclipse -x spotlessApply -x buildJniLib -x cmakeJniLib --tests "org.opensearch.neuralsearch.processor.InferenceProcessorTests" --tests "org.opensearch.neuralsearch.processor.TextEmbeddingProcessorTests" --tests "org.opensearch.neuralsearch.processor.SparseEncodingProcessorTests" --no-daemon --max-workers=1— passed: 112 tests, 0 failures (6 shared, 69 dense, 37 sparse).[tiny, duplicate, duplicate, lengthy input]instead of[tiny, duplicate, lengthy input], and sparse format inputs[value1, value1]instead of[value1].The standard
spotlessJavaCheckcould not configure locally because the Eclipse JDT formatter P2 mirror timed out; no formatter configuration change is included.Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.