Partition partition = Iterables.getOnlyElement(partitions);
checkArgument(partition instanceof SystemPartition, "Partition must be a system partition");
SystemPartition systemPartition = (SystemPartition) partition;
SystemTable systemTable = tables.get(systemPartition.getTableHandle().getSchemaTableName());
checkArgument(systemTable != null, "Table %s does not exist", systemPartition.getTableHandle().getTableName());
ImmutableMap.Builder<String, Object> filters = ImmutableMap.builder();
for (Entry<ColumnHandle, Comparable<?>> entry : systemPartition.getFilters().entrySet()) {
SystemColumnHandle systemColumnHandle = (SystemColumnHandle) entry.getKey();
filters.put(systemColumnHandle.getColumnName(), entry.getValue());
}
if (systemTable.isDistributed()) {
ImmutableList.Builder<Split> splits = ImmutableList.builder();
for (Node node : nodeManager.getAllNodes().getActiveNodes()) {
splits.add(new SystemSplit(systemPartition.tableHandle, filters.build(), node.getHostAndPort()));
}
return new FixedSplitSource(null, splits.build());