Skip to content

Commit 39dc98f

Browse files
committed
Remove BaseNumericDocValues and BaseSortedNumericDocValues
1 parent 5a2da25 commit 39dc98f

File tree

1 file changed

+7
-67
lines changed

1 file changed

+7
-67
lines changed

server/src/main/java/org/elasticsearch/index/codec/tsdb/es819/ES819TSDBDocValuesProducer.java

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ private NumericDocValues getNumeric(NumericEntry entry, long maxOrd) throws IOEx
10461046
// Special case for maxOrd 1, no need to read blocks and use ordinal 0 as only value
10471047
if (entry.docsWithFieldOffset == -1) {
10481048
// Special case when all docs have a value
1049-
return new BaseNumericDocValues(entry) {
1049+
return new NumericDocValues() {
10501050

10511051
private final int maxDoc = ES819TSDBDocValuesProducer.this.maxDoc;
10521052
private int doc = -1;
@@ -1095,7 +1095,7 @@ public long cost() {
10951095
entry.denseRankPower,
10961096
entry.numValues
10971097
);
1098-
return new BaseNumericDocValues(entry) {
1098+
return new NumericDocValues() {
10991099

11001100
@Override
11011101
public int advance(int target) throws IOException {
@@ -1140,7 +1140,7 @@ public long longValue() {
11401140
final int bitsPerOrd = maxOrd >= 0 ? PackedInts.bitsRequired(maxOrd - 1) : -1;
11411141
if (entry.docsWithFieldOffset == -1) {
11421142
// dense
1143-
return new BaseNumericDocValues(entry) {
1143+
return new NumericDocValues() {
11441144

11451145
private final int maxDoc = ES819TSDBDocValuesProducer.this.maxDoc;
11461146
private int doc = -1;
@@ -1207,7 +1207,7 @@ public long longValue() throws IOException {
12071207
entry.denseRankPower,
12081208
entry.numValues
12091209
);
1210-
return new BaseNumericDocValues(entry) {
1210+
return new NumericDocValues() {
12111211

12121212
private final TSDBDocValuesEncoder decoder = new TSDBDocValuesEncoder(ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SIZE);
12131213
private long currentBlockIndex = -1;
@@ -1262,15 +1262,6 @@ public long longValue() throws IOException {
12621262
}
12631263
}
12641264

1265-
abstract static class BaseNumericDocValues extends NumericDocValues {
1266-
1267-
final NumericEntry entry;
1268-
1269-
BaseNumericDocValues(NumericEntry entry) {
1270-
this.entry = entry;
1271-
}
1272-
}
1273-
12741265
private NumericValues getValues(NumericEntry entry, final long maxOrd) throws IOException {
12751266
assert entry.numValues > 0;
12761267
final RandomAccessInput indexSlice = data.randomAccessSlice(entry.indexOffset, entry.indexLength);
@@ -1307,49 +1298,7 @@ long advance(long index) throws IOException {
13071298

13081299
private SortedNumericDocValues getSortedNumeric(SortedNumericEntry entry, long maxOrd) throws IOException {
13091300
if (entry.numValues == entry.numDocsWithField) {
1310-
var numeric = getNumeric(entry, maxOrd);
1311-
if (merging) {
1312-
return new BaseSortedNumericDocValues(entry) {
1313-
1314-
@Override
1315-
public long nextValue() throws IOException {
1316-
return numeric.longValue();
1317-
}
1318-
1319-
@Override
1320-
public int docValueCount() {
1321-
return 1;
1322-
}
1323-
1324-
@Override
1325-
public boolean advanceExact(int target) throws IOException {
1326-
return numeric.advanceExact(target);
1327-
}
1328-
1329-
@Override
1330-
public int docID() {
1331-
return numeric.docID();
1332-
}
1333-
1334-
@Override
1335-
public int nextDoc() throws IOException {
1336-
return numeric.nextDoc();
1337-
}
1338-
1339-
@Override
1340-
public int advance(int target) throws IOException {
1341-
return numeric.advance(target);
1342-
}
1343-
1344-
@Override
1345-
public long cost() {
1346-
return numeric.cost();
1347-
}
1348-
};
1349-
} else {
1350-
// Required otherwise search / compute engine can't otherwise optimize for when each document has exactly one value:
1351-
return DocValues.singleton(getNumeric(entry, maxOrd));
1352-
}
1301+
return DocValues.singleton(getNumeric(entry, maxOrd));
13531302
}
13541303

13551304
final RandomAccessInput addressesInput = data.randomAccessSlice(entry.addressesOffset, entry.addressesLength);
@@ -1359,7 +1308,7 @@ public long cost() {
13591308

13601309
if (entry.docsWithFieldOffset == -1) {
13611310
// dense
1362-
return new BaseSortedNumericDocValues(entry) {
1311+
return new SortedNumericDocValues() {
13631312

13641313
int doc = -1;
13651314
long start, end;
@@ -1420,7 +1369,7 @@ public int docValueCount() {
14201369
entry.denseRankPower,
14211370
entry.numDocsWithField
14221371
);
1423-
return new BaseSortedNumericDocValues(entry) {
1372+
return new SortedNumericDocValues() {
14241373

14251374
boolean set;
14261375
long start, end;
@@ -1479,15 +1428,6 @@ private void set() {
14791428
}
14801429
}
14811430

1482-
abstract static class BaseSortedNumericDocValues extends SortedNumericDocValues {
1483-
1484-
final SortedNumericEntry entry;
1485-
1486-
BaseSortedNumericDocValues(SortedNumericEntry entry) {
1487-
this.entry = entry;
1488-
}
1489-
}
1490-
14911431
private record DocValuesSkipperEntry(long offset, long length, long minValue, long maxValue, int docCount, int maxDocId) {}
14921432

14931433
static class NumericEntry {

0 commit comments

Comments
 (0)