Revert "SlowCompositeCodecWrapper: remove redundant FieldInfo lookup in its PointsReader.getValues method"

This reverts commit 0aff41379795c85954b4653601a217b619db1e05.
This commit is contained in:
Mike McCandless 2023-12-08 08:14:00 -05:00
parent ba81826951
commit 9ec938f2ef

View File

@ -565,10 +565,12 @@ final class SlowCompositeCodecReaderWrapper extends CodecReader {
private static class SlowCompositePointsReaderWrapper extends PointsReader { private static class SlowCompositePointsReaderWrapper extends PointsReader {
private final CodecReader[] codecReaders;
private final PointsReader[] readers; private final PointsReader[] readers;
private final int[] docStarts; private final int[] docStarts;
SlowCompositePointsReaderWrapper(CodecReader[] codecReaders, int[] docStarts) { SlowCompositePointsReaderWrapper(CodecReader[] codecReaders, int[] docStarts) {
this.codecReaders = codecReaders;
this.readers = this.readers =
Arrays.stream(codecReaders) Arrays.stream(codecReaders)
.map(CodecReader::getPointsReader) .map(CodecReader::getPointsReader)
@ -594,9 +596,12 @@ final class SlowCompositeCodecReaderWrapper extends CodecReader {
public PointValues getValues(String field) throws IOException { public PointValues getValues(String field) throws IOException {
List<PointValuesSub> values = new ArrayList<>(); List<PointValuesSub> values = new ArrayList<>();
for (int i = 0; i < readers.length; ++i) { for (int i = 0; i < readers.length; ++i) {
if (readers[i] != null) { FieldInfo fi = codecReaders[i].getFieldInfos().fieldInfo(field);
if (fi != null && fi.getPointDimensionCount() > 0) {
PointValues v = readers[i].getValues(field); PointValues v = readers[i].getValues(field);
if (v != null) { if (v != null) {
// Apparently FieldInfo can claim a field has points, yet the returned
// PointValues is null
values.add(new PointValuesSub(v, docStarts[i])); values.add(new PointValuesSub(v, docStarts[i]));
} }
} }