@Override
public RecordSet getRecordSet(Split split, List<? extends ColumnHandle> columns)
{
int sampleWeightField = -1;
for (int i = 0; i < columns.size(); i++) {
ColumnHandle column = columns.get(i);
if (column instanceof TpchColumnHandle && ((TpchColumnHandle) column).getColumnName().equals(SampledTpchMetadata.SAMPLE_WEIGHT_COLUMN_NAME)) {
sampleWeightField = i;
break;
}
}
List<? extends ColumnHandle> delegatedColumns = new ArrayList<>(columns);
if (sampleWeightField > -1) {
delegatedColumns.remove(sampleWeightField);
RecordSet recordSet;
if (delegatedColumns.isEmpty()) {
// Pick a random column, so that we can figure out how many rows there are
TpchSplit tpchSplit = (TpchSplit) split;
ColumnHandle column = Iterables.getFirst(metadata.getColumnHandles(tpchSplit.getTableHandle()).values(), null);
checkNotNull(column, "Could not find any columns");
recordSet = new EmptyRecordSet(super.getRecordSet(split, ImmutableList.of(column)));
}
else {
recordSet = super.getRecordSet(split, delegatedColumns);