return node.getSource().accept(this, materializedViewPartitionPredicate);
case SYSTEM: {
NodeSplits nodeSplits = node.getSource().accept(this, materializedViewPartitionPredicate);
if (nodeSplits.dataSource.isPresent()) {
DataSource dataSource = nodeSplits.dataSource.get();
final double ratio = node.getSampleRatio();
Iterable<Split> sampleIterable = Iterables.filter(dataSource.getSplits(), new Predicate<Split>()
{
public boolean apply(@Nullable Split input)
{
return ThreadLocalRandom.current().nextDouble() < ratio;
}
});
DataSource sampledDataSource = new DataSource(dataSource.getDataSourceName(), sampleIterable);
return new NodeSplits(node.getId(), sampledDataSource);
}
else {
// table sampling on a sub query without splits is meaningless