mirror of https://github.com/apache/lucene.git
LUCENE-10355: clean zeros (#584)
This commit is contained in:
parent
78da703037
commit
60b80017cb
|
@ -34,16 +34,6 @@ public final class LegacyDirectMonotonicReader extends LongValues implements Acc
|
||||||
private static final long BASE_RAM_BYTES_USED =
|
private static final long BASE_RAM_BYTES_USED =
|
||||||
RamUsageEstimator.shallowSizeOfInstance(LegacyDirectMonotonicReader.class);
|
RamUsageEstimator.shallowSizeOfInstance(LegacyDirectMonotonicReader.class);
|
||||||
|
|
||||||
/** An instance that always returns {@code 0}. */
|
|
||||||
private static final LongValues EMPTY =
|
|
||||||
new LongValues() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long get(long index) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In-memory metadata that needs to be kept around for {@link LegacyDirectMonotonicReader} to read
|
* In-memory metadata that needs to be kept around for {@link LegacyDirectMonotonicReader} to read
|
||||||
* data from disk.
|
* data from disk.
|
||||||
|
@ -105,7 +95,7 @@ public final class LegacyDirectMonotonicReader extends LongValues implements Acc
|
||||||
final LongValues[] readers = new LongValues[meta.numBlocks];
|
final LongValues[] readers = new LongValues[meta.numBlocks];
|
||||||
for (int i = 0; i < meta.mins.length; ++i) {
|
for (int i = 0; i < meta.mins.length; ++i) {
|
||||||
if (meta.bpvs[i] == 0) {
|
if (meta.bpvs[i] == 0) {
|
||||||
readers[i] = EMPTY;
|
readers[i] = LongValues.ZEROES;
|
||||||
} else {
|
} else {
|
||||||
readers[i] = LegacyDirectReader.getInstance(data, meta.bpvs[i], meta.offsets[i]);
|
readers[i] = LegacyDirectReader.getInstance(data, meta.bpvs[i], meta.offsets[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,16 +34,6 @@ public final class DirectMonotonicReader extends LongValues implements Accountab
|
||||||
private static final long BASE_RAM_BYTES_USED =
|
private static final long BASE_RAM_BYTES_USED =
|
||||||
RamUsageEstimator.shallowSizeOfInstance(DirectMonotonicReader.class);
|
RamUsageEstimator.shallowSizeOfInstance(DirectMonotonicReader.class);
|
||||||
|
|
||||||
/** An instance that always returns {@code 0}. */
|
|
||||||
private static final LongValues EMPTY =
|
|
||||||
new LongValues() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long get(long index) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In-memory metadata that needs to be kept around for {@link DirectMonotonicReader} to read data
|
* In-memory metadata that needs to be kept around for {@link DirectMonotonicReader} to read data
|
||||||
* from disk.
|
* from disk.
|
||||||
|
@ -111,7 +101,7 @@ public final class DirectMonotonicReader extends LongValues implements Accountab
|
||||||
final LongValues[] readers = new LongValues[meta.numBlocks];
|
final LongValues[] readers = new LongValues[meta.numBlocks];
|
||||||
for (int i = 0; i < meta.numBlocks; ++i) {
|
for (int i = 0; i < meta.numBlocks; ++i) {
|
||||||
if (meta.bpvs[i] == 0) {
|
if (meta.bpvs[i] == 0) {
|
||||||
readers[i] = EMPTY;
|
readers[i] = LongValues.ZEROES;
|
||||||
} else if (merging
|
} else if (merging
|
||||||
&& i < meta.numBlocks - 1 // we only know the number of values for the last block
|
&& i < meta.numBlocks - 1 // we only know the number of values for the last block
|
||||||
&& meta.blockShift >= DirectReader.MERGE_BUFFER_SHIFT) {
|
&& meta.blockShift >= DirectReader.MERGE_BUFFER_SHIFT) {
|
||||||
|
|
Loading…
Reference in New Issue