Skip to content

Commit

Permalink
Remove fetchRequired flag from ReaderBucket
Browse files Browse the repository at this point in the history
If there are no columns to fetch, then there shouldn't be a `_fetchid`,
and therefore no fetch operation happening. So this flag is in a way redundant.
  • Loading branch information
mfussenegger authored and mergify[bot] committed Mar 17, 2020
1 parent da6375c commit dfba29d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private IntObjectHashMap<IntContainer> generateToFetch(IntSet readerIds) {
IntObjectHashMap<IntContainer> toFetch = new IntObjectHashMap<>(readerIds.size());
for (IntCursor readerIdCursor : readerIds) {
ReaderBucket readerBucket = context.readerBucket(readerIdCursor.value);
if (readerBucket != null && readerBucket.fetchRequired() && readerBucket.docs.size() > 0) {
if (readerBucket != null && readerBucket.docs.size() > 0) {
toFetch.put(readerIdCursor.value, readerBucket.docs.keys());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public FetchProjectorContext(Map<RelationName, FetchSource> tableToFetchSource,
this.indexToTable = indexToTable;
}


@Nullable
ReaderBucket readerBucket(int readerId) {
return readerBuckets.get(readerId);
}
Expand All @@ -69,21 +69,13 @@ ReaderBucket require(long fetchId) {
int docId = FetchId.decodeDocId(fetchId);
ReaderBucket readerBucket = readerBuckets.get(readerId);
if (readerBucket == null) {
readerBucket = createReaderBucket(readerId);
readerBucket = new ReaderBucket();
readerBuckets.put(readerId, readerBucket);
}
readerBucket.require(docId);
return readerBucket;
}

private ReaderBucket createReaderBucket(int readerId) {
String index = readerIdToIndex.floorEntry(readerId).getValue();
RelationName relationName = indexToTable.get(index);
FetchSource fetchSource = tableToFetchSource.get(relationName);
assert fetchSource != null : "fetchSource must be available";
return new ReaderBucket(!fetchSource.references().isEmpty());
}

ReaderBucket getReaderBucket(int readerId) {
return readerBuckets.get(readerId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@

class ReaderBucket {

private final boolean fetchRequired;
final IntObjectHashMap<Object[]> docs = new IntObjectHashMap<>();

ReaderBucket(boolean fetchRequired) {
this.fetchRequired = fetchRequired;
ReaderBucket() {
}

void require(int doc) {
Expand All @@ -57,8 +55,4 @@ void fetched(Bucket bucket) {
}
assert !rowIterator.hasNext() : "no more rows should exist";
}

boolean fetchRequired() {
return fetchRequired;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ public void testSqlRequestWithNumericGtFilter() throws Exception {


@Test
@SuppressWarnings("unchecked")
public void testArraySupport() throws Exception {
execute("create table t1 (id int primary key, strings array(string), integers array(integer)) with (number_of_replicas=0)");
ensureYellow();
Expand Down

0 comments on commit dfba29d

Please sign in to comment.