Projector downstream = projectorChain.newShardDownstreamProjector(projectorVisitor);
if (normalizedCollectNode.whereClause().noMatch()) {
return CrateCollector.NOOP;
} else {
RowGranularity granularity = normalizedCollectNode.maxRowGranularity();
if (granularity == RowGranularity.DOC) {
if (isBlobShard) {
return getBlobIndexCollector(normalizedCollectNode, downstream);
} else {
return getLuceneIndexCollector(normalizedCollectNode, downstream);
}
} else if (granularity == RowGranularity.SHARD) {
ImplementationSymbolVisitor.Context shardCtx = shardImplementationSymbolVisitor.process(normalizedCollectNode);
return new SimpleOneRowCollector(shardCtx.topLevelInputs(), shardCtx.collectExpressions(), downstream);
}
throw new UnhandledServerException(String.format("Granularity %s not supported", granularity.name()));
}
}