Source:
protected final OperatorFactory createTableScanOperator(int operatorId, PlanNodeId planNodeId, String tableName, String... columnNames) { checkArgument(session.getCatalog().isPresent(), "catalog not set"); checkArgument(session.getSchema().isPresent(), "schema not set"); Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName).orElse(null); checkArgument(tableHandle != null, "Table %s does not exist", qualifiedTableName); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); ImmutableList.Builder<ColumnHandle> columnHandlesBuilder = ImmutableList.builder(); ImmutableList.Builder<Type> columnTypesBuilder = ImmutableList.builder(); for (String columnName : columnNames) { ColumnHandle columnHandle = allColumnHandles.get(columnName); checkArgument(columnHandle != null, "Table %s does not have a column %s", tableName, columnName); columnHandlesBuilder.add(columnHandle); ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableHandle, columnHandle); columnTypesBuilder.add(columnMetadata.getType()); } List<ColumnHandle> columnHandles = columnHandlesBuilder.build(); List<Type> columnTypes = columnTypesBuilder.build(); List<TableLayoutResult> layouts = metadata.getLayouts(session, tableHandle, Constraint.alwaysTrue(), Optional.empty()); Split split = getLocalQuerySplit(session, layouts.get(0).getLayout().getHandle()); return new OperatorFactory() { @Override public List<Type> getTypes() { return columnTypes; } @Override public Operator createOperator(DriverContext driverContext) { OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, "BenchmarkSource"); ConnectorPageSource pageSource = localQueryRunner.getPageSourceManager().createPageSource(session, split, columnHandles); return new PageSourceOperator(pageSource, operatorContext); } @Override public void noMoreOperators() { } @Override public OperatorFactory duplicate() { throw new UnsupportedOperationException(); } }; }

Target:
protected final OperatorFactory createTableScanOperator(int operatorId, PlanNodeId planNodeId, String tableName, String... columnNames) { checkArgument(session.getCatalog().isPresent(), "catalog not set"); checkArgument(session.getSchema().isPresent(), "schema not set"); Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName).orElse(null); checkArgument(tableHandle != null, "Table %s does not exist", qualifiedTableName); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); ImmutableList.Builder<ColumnHandle> columnHandlesBuilder = ImmutableList.builder(); for (String columnName : columnNames) { ColumnHandle columnHandle = allColumnHandles.get(columnName); checkArgument(columnHandle != null, "Table %s does not have a column %s", tableName, columnName); columnHandlesBuilder.add(columnHandle); } List<ColumnHandle> columnHandles = columnHandlesBuilder.build(); List<TableLayoutResult> layouts = metadata.getLayouts(session, tableHandle, Constraint.alwaysTrue(), Optional.empty()); Split split = getLocalQuerySplit(session, layouts.get(0).getLayout().getHandle()); return new OperatorFactory() { @Override public Operator createOperator(DriverContext driverContext) { OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, "BenchmarkSource"); ConnectorPageSource pageSource = localQueryRunner.getPageSourceManager().createPageSource(session, split, columnHandles); return new PageSourceOperator(pageSource, operatorContext); } @Override public void noMoreOperators() { } @Override public OperatorFactory duplicate() { throw new UnsupportedOperationException(); } }; }