Source:
public void setup() throws Exception { queryRunner = DistributedQueryRunner.builder(session).build(); queryRunner.installPlugin(new Plugin() { @Override public Iterable<ConnectorFactory> getConnectorFactories() { Function<ConnectorSession, List<String>> listSchemaNames = session -> IntStream.range(0, Integer.parseInt(schemasCount)) .boxed() .map(i -> "stream_" + i) .collect(toImmutableList()); BiFunction<ConnectorSession, String, List<SchemaTableName>> listTables = (session, schemaNameOrNull) -> { List<String> tables = IntStream.range(0, Integer.parseInt(tablesCount)) .boxed() .map(i -> "table_" + i) .collect(toImmutableList()); List<String> schemas; if (schemaNameOrNull == null) { schemas = listSchemaNames.apply(session); } else { schemas = ImmutableList.of(schemaNameOrNull); } return schemas.stream() .flatMap(schema -> tables.stream().map(table -> new SchemaTableName(schema, table))) .collect(toImmutableList()); }; BiFunction<ConnectorSession, ConnectorTableHandle, Map<String, TpchColumnHandle>> getColumnHandles = (session, tableHandle) -> IntStream.range(0, Integer.parseInt(columnsCount)) .boxed() .map(i -> "column_" + i) .collect(toImmutableMap(column -> column, column -> new TpchColumnHandle(column, createUnboundedVarcharType()) {})); MockConnectorFactory.Builder builder = new MockConnectorFactory.Builder(); MockConnectorFactory connectorFactory = builder.withListSchemaNames(listSchemaNames) .withListTables(listTables) .withGetViews((session, prefix) -> ImmutableMap.of()) .withGetColumnHandles(getColumnHandles) .build(); return ImmutableList.of(connectorFactory); } }); queryRunner.createCatalog("test_catalog", "mock", ImmutableMap.of()); query = queries.get(queryId); }

Target:
public void setup() throws Exception { queryRunner = DistributedQueryRunner.builder(session).build(); queryRunner.installPlugin(new Plugin() { @Override public Iterable<ConnectorFactory> getConnectorFactories() { Function<ConnectorSession, List<String>> listSchemaNames = session -> IntStream.range(0, Integer.parseInt(schemasCount)) .boxed() .map(i -> "stream_" + i) .collect(toImmutableList()); BiFunction<ConnectorSession, String, List<SchemaTableName>> listTables = (session, schemaNameOrNull) -> { List<String> tables = IntStream.range(0, Integer.parseInt(tablesCount)) .boxed() .map(i -> "table_" + i) .collect(toImmutableList()); List<String> schemas; if (schemaNameOrNull == null) { schemas = listSchemaNames.apply(session); } else { schemas = ImmutableList.of(schemaNameOrNull); } return schemas.stream() .flatMap(schema -> tables.stream().map(table -> new SchemaTableName(schema, table))) .collect(toImmutableList()); }; BiFunction<ConnectorSession, ConnectorTableHandle, Map<String, TpchColumnHandle>> getColumnHandles = (session, tableHandle) -> IntStream.range(0, Integer.parseInt(columnsCount)) .boxed() .map(i -> "column_" + i) .collect(toImmutableMap(column -> column, column -> new TpchColumnHandle(column, createUnboundedVarcharType()) {})); MockConnectorFactory connectorFactory = MockConnectorFactory.builder() .withListSchemaNames(listSchemaNames) .withListTables(listTables) .withGetViews((session, prefix) -> ImmutableMap.of()) .withGetColumnHandles(getColumnHandles) .build(); return ImmutableList.of(connectorFactory); } }); queryRunner.createCatalog("test_catalog", "mock", ImmutableMap.of()); query = queries.get(queryId); }