Skip to content

Commit a934ddf

Browse files
committed
fix bug
1 parent 969e71a commit a934ddf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

server/src/main/java/org/elasticsearch/index/mapper/TSDimensionBlockLoader.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.elasticsearch.search.fetch.StoredFieldsSpec;
1919

2020
import java.io.IOException;
21+
import java.util.Objects;
2122

2223
public class TSDimensionBlockLoader implements BlockLoader {
2324

@@ -38,7 +39,10 @@ public Builder builder(BlockFactory factory, int expectedCount) {
3839
public ColumnAtATimeReader columnAtATimeReader(LeafReaderContext context) throws IOException {
3940
var singleton = DocValues.unwrapSingleton(context.reader().getSortedSetDocValues(fieldName));
4041
if (singleton instanceof BlockAwareSortedDocValues b) {
41-
return new TSDimensions(b);
42+
var loader = b.getSingletonBlockLoader();
43+
if (loader != null) {
44+
return new TSDimensions(b, loader);
45+
}
4246
}
4347
return fallback.columnAtATimeReader(context);
4448
}
@@ -72,10 +76,10 @@ public static final class TSDimensions implements ColumnAtATimeReader {
7276
private final SortedDocValues sorted;
7377
private final SingletonDocValuesBlockLoader blockLoader;
7478

75-
TSDimensions(BlockAwareSortedDocValues sorted) {
79+
TSDimensions(BlockAwareSortedDocValues sorted, SingletonDocValuesBlockLoader blockLoader) {
7680
this.creationThread = Thread.currentThread();
77-
this.sorted = sorted;
78-
this.blockLoader = sorted.getSingletonBlockLoader();
81+
this.sorted = Objects.requireNonNull(sorted);
82+
this.blockLoader = Objects.requireNonNull(blockLoader);
7983
}
8084

8185
@Override

0 commit comments

Comments
 (0)