michaeljmarshall commented on code in PR #4353:
URL: https://github.com/apache/cassandra/pull/4353#discussion_r2688133280
##########
src/java/org/apache/cassandra/index/sai/plan/QueryViewBuilder.java:
##########
@@ -57,12 +59,19 @@ public static class QueryExpressionView
public final Expression expression;
public final Collection<MemtableIndex> memtableIndexes;
public final Collection<SSTableIndex> sstableIndexes;
+ public final ColumnFamilyStore.ViewFragment viewFragment;
public QueryExpressionView(Expression expression,
Collection<MemtableIndex> memtableIndexes, Collection<SSTableIndex>
sstableIndexes)
{
this.expression = expression;
this.memtableIndexes = memtableIndexes;
this.sstableIndexes = sstableIndexes;
+
+ // Because the SSTableIndex holds a reference to the
SSTableReader, we know the sstable is still accessible
+ // so it is safe to build a view fragment.
+ List<Memtable> memtables =
memtableIndexes.stream().map(MemtableIndex::getMemtable).collect(Collectors.toList());
+ List<SSTableReader> sstableReaders =
sstableIndexes.stream().map(SSTableIndex::getSSTable).collect(Collectors.toList());
+ this.viewFragment = new
ColumnFamilyStore.ViewFragment(sstableReaders, memtables);
Review Comment:
I made it lazy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]