Skip to content

Commit f30e753

Browse files
committed
iter
1 parent 71a92d4 commit f30e753

File tree

1 file changed

+42
-30
lines changed

1 file changed

+42
-30
lines changed

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

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,22 +1269,28 @@ private void loadCurrentBlock(int blockIndex) throws IOException {
12691269

12701270
@Override
12711271
public void loadBlock(BlockLoader.LongBuilder builder, BlockLoader.Docs docs) throws IOException {
1272-
int startIndexInBlock = 0;
1273-
int currentBlockIndex = docs.get(0) >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1274-
for (int i = startIndexInBlock; i < docs.count(); i++) {
1272+
for (int i = 0; i < docs.count(); i++) {
12751273
doc = docs.get(i);
1276-
int blockIndex = doc >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1277-
if (blockIndex != currentBlockIndex) {
1278-
// TODO: make builder aware of codec?
1279-
loadCurrentBlock(blockIndex);
1280-
for (int j = startIndexInBlock; j < i; j++) {
1281-
int blockInIndex = doc & ES819TSDBDocValuesFormat.NUMERIC_BLOCK_MASK;
1282-
builder.appendLong(currentBlock[blockInIndex]);
1283-
}
1284-
currentBlockIndex = blockIndex;
1285-
startIndexInBlock = i;
1286-
}
1274+
builder.appendLong(longValue());
12871275
}
1276+
1277+
// TODO: Try to fix this:
1278+
// int startIndexInBlock = 0;
1279+
// int currentBlockIndex = docs.get(0) >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1280+
// for (int i = startIndexInBlock; i < docs.count(); i++) {
1281+
// doc = docs.get(i);
1282+
// int blockIndex = doc >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1283+
// if (blockIndex != currentBlockIndex) {
1284+
// TODO: make builder aware of codec?
1285+
// loadCurrentBlock(blockIndex);
1286+
// for (int j = startIndexInBlock; j < i; j++) {
1287+
// int blockInIndex = doc & ES819TSDBDocValuesFormat.NUMERIC_BLOCK_MASK;
1288+
// builder.appendLong(currentBlock[blockInIndex]);
1289+
// }
1290+
// currentBlockIndex = blockIndex;
1291+
// startIndexInBlock = i;
1292+
// }
1293+
// }
12881294
}
12891295

12901296
@Override
@@ -1299,23 +1305,29 @@ public void loadDoc(BlockLoader.LongBuilder builder, int docId) throws IOExcepti
12991305

13001306
@Override
13011307
public void loadBlock(BlockLoader.IntBuilder builder, BlockLoader.Docs docs) throws IOException {
1302-
int startIndexInBlock = 0;
1303-
int currentBlockIndex = docs.get(0) >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1304-
for (int i = startIndexInBlock; i < docs.count(); i++) {
1305-
int docId = docs.get(i);
1306-
int blockIndex = docId >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1307-
if (blockIndex != currentBlockIndex) {
1308-
// TODO: make builder aware of codec?
1309-
loadCurrentBlock(blockIndex);
1310-
for (int j = startIndexInBlock; j < i; j++) {
1311-
int blockInIndex = docId & ES819TSDBDocValuesFormat.NUMERIC_BLOCK_MASK;
1312-
int value = Math.toIntExact(currentBlock[blockInIndex]);
1313-
builder.appendInt(value);
1314-
}
1315-
currentBlockIndex = blockIndex;
1316-
startIndexInBlock = i;
1317-
}
1308+
for (int i = 0; i < docs.count(); i++) {
1309+
doc = docs.get(i);
1310+
builder.appendInt(Math.toIntExact(longValue()));
13181311
}
1312+
1313+
// TODO: try to fix this:
1314+
// int startIndexInBlock = 0;
1315+
// int currentBlockIndex = docs.get(0) >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1316+
// for (int i = startIndexInBlock; i < docs.count(); i++) {
1317+
// int docId = docs.get(i);
1318+
// int blockIndex = docId >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1319+
// if (blockIndex != currentBlockIndex) {
1320+
// TODO: make builder aware of codec?
1321+
// loadCurrentBlock(blockIndex);
1322+
// for (int j = startIndexInBlock; j < i; j++) {
1323+
// int blockInIndex = docId & ES819TSDBDocValuesFormat.NUMERIC_BLOCK_MASK;
1324+
// int value = Math.toIntExact(currentBlock[blockInIndex]);
1325+
// builder.appendInt(value);
1326+
// }
1327+
// currentBlockIndex = blockIndex;
1328+
// startIndexInBlock = i;
1329+
// }
1330+
// }
13191331
}
13201332

13211333
@Override

0 commit comments

Comments
 (0)