-
Notifications
You must be signed in to change notification settings - Fork 33
Remove duplicated vector storage and rely on inline vectors for RAVV #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
5355b55
2baf1a6
851d064
61bf31a
16aa30b
7341716
30c74a6
0a2d0f3
caa6a31
61e4bd6
e69b9e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,16 +36,14 @@ class KNN80DocValuesConsumer extends DocValuesConsumer { | |
| private final Logger logger = LogManager.getLogger(KNN80DocValuesConsumer.class); | ||
|
|
||
| private final DocValuesConsumer delegatee; | ||
| private final SegmentWriteState state; | ||
|
|
||
| KNN80DocValuesConsumer(DocValuesConsumer delegatee, SegmentWriteState state) { | ||
| this.delegatee = delegatee; | ||
| this.state = state; | ||
| } | ||
|
|
||
| @Override | ||
| public void addBinaryField(FieldInfo field, DocValuesProducer valuesProducer) throws IOException { | ||
| delegatee.addBinaryField(field, valuesProducer); | ||
| if (!(field.hasVectorValues() && extractKNNEngine(field) == KNNEngine.JVECTOR)) delegatee.addBinaryField(field, valuesProducer); | ||
| if (isKNNBinaryFieldRequired(field)) { | ||
| StopWatch stopWatch = new StopWatch(); | ||
| stopWatch.start(); | ||
|
|
@@ -77,9 +75,38 @@ public void addKNNBinaryField(FieldInfo field, DocValuesProducer valuesProducer, | |
| @Override | ||
| public void merge(MergeState mergeState) { | ||
| try { | ||
| delegatee.merge(mergeState); | ||
| assert mergeState != null; | ||
| assert mergeState.mergeFieldInfos != null; | ||
|
|
||
| for (DocValuesProducer docValuesProducer : mergeState.docValuesProducers) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we just remove doc values all together for KNN fields?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think perhaps what we can do is actually to leverage the "DerivedSourceFormat", glancing at the plugin it seems like it's already there. |
||
| if (docValuesProducer != null) { | ||
| docValuesProducer.checkIntegrity(); | ||
| } | ||
| } | ||
|
|
||
| for (FieldInfo mergeFieldInfo : mergeState.mergeFieldInfos) { | ||
| if (mergeFieldInfo.hasVectorValues() && extractKNNEngine(mergeFieldInfo) == KNNEngine.JVECTOR) { | ||
| continue; | ||
| } | ||
|
|
||
| DocValuesType type = mergeFieldInfo.getDocValuesType(); | ||
| if (type != DocValuesType.NONE) { | ||
| if (type == DocValuesType.NUMERIC) { | ||
| delegatee.mergeNumericField(mergeFieldInfo, mergeState); | ||
| } else if (type == DocValuesType.BINARY) { | ||
| delegatee.mergeBinaryField(mergeFieldInfo, mergeState); | ||
| } else if (type == DocValuesType.SORTED) { | ||
| delegatee.mergeSortedField(mergeFieldInfo, mergeState); | ||
| } else if (type == DocValuesType.SORTED_SET) { | ||
| delegatee.mergeSortedSetField(mergeFieldInfo, mergeState); | ||
| } else if (type == DocValuesType.SORTED_NUMERIC) { | ||
| delegatee.mergeSortedNumericField(mergeFieldInfo, mergeState); | ||
| } else { | ||
| throw new AssertionError("type=" + type); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) { | ||
| DocValuesType type = fieldInfo.getDocValuesType(); | ||
| if (type == DocValuesType.BINARY && fieldInfo.attributes().containsKey(KNNVectorFieldMapper.KNN_FIELD)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just change the conditions for
isKNNBinaryFieldRequired()method?We can place the condition exception for jVector engine there, and also avoid binary field creation altogether for FP vectors.