@Test public void testShowTables() { Set<String> expectedTables = ImmutableSet.copyOf(transform(TpchTable.getTables(), TpchTable::getTableName)); MaterializedResult result = computeActual("SHOW TABLES"); assertTrue(result.getOnlyColumnAsSet().containsAll(expectedTables)); }
public TpchMetadata(String connectorId, ColumnNaming columnNaming, boolean predicatePushdownEnabled, boolean partitioningEnabled) { ImmutableSet.Builder<String> tableNames = ImmutableSet.builder(); for (TpchTable<?> tpchTable : TpchTable.getTables()) { tableNames.add(tpchTable.getTableName()); } this.tableNames = tableNames.build(); this.connectorId = connectorId; this.columnNaming = columnNaming; this.predicatePushdownEnabled = predicatePushdownEnabled; this.partitioningEnabled = partitioningEnabled; this.statisticsEstimator = createStatisticsEstimator(); }
@Override public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> filterSchema) { ImmutableList.Builder<SchemaTableName> builder = ImmutableList.builder(); for (String schemaName : getSchemaNames(session, filterSchema)) { for (TpchTable<?> tpchTable : TpchTable.getTables()) { builder.add(new SchemaTableName(schemaName, tpchTable.getTableName())); } } return builder.build(); }
@Override public final List<PrestoThriftSchemaTableName> listTables(PrestoThriftNullableSchemaName schemaNameOrNull) { List<PrestoThriftSchemaTableName> tables = new ArrayList<>(); for (String schemaName : getSchemaNames(schemaNameOrNull.getSchemaName())) { for (TpchTable<?> tpchTable : TpchTable.getTables()) { tables.add(new PrestoThriftSchemaTableName(schemaName, tpchTable.getTableName())); } } return tables; }
@Test public void testShowTablesFrom() { Set<String> expectedTables = ImmutableSet.copyOf(transform(TpchTable.getTables(), TpchTable::getTableName)); String catalog = getSession().getCatalog().get(); String schema = getSession().getSchema().get(); MaterializedResult result = computeActual("SHOW TABLES FROM " + schema); assertTrue(result.getOnlyColumnAsSet().containsAll(expectedTables)); result = computeActual("SHOW TABLES FROM " + catalog + "." + schema); assertTrue(result.getOnlyColumnAsSet().containsAll(expectedTables)); assertQueryFails("SHOW TABLES FROM UNKNOWN", "line 1:1: Schema 'unknown' does not exist"); assertQueryFails("SHOW TABLES FROM UNKNOWNCATALOG.UNKNOWNSCHEMA", "line 1:1: Catalog 'unknowncatalog' does not exist"); }
public TestKafkaDistributed(EmbeddedKafka embeddedKafka) { super(() -> createKafkaQueryRunner(embeddedKafka, TpchTable.getTables())); this.embeddedKafka = embeddedKafka; }
public TestRedisDistributed(EmbeddedRedis embeddedRedis) { super(() -> RedisQueryRunner.createRedisQueryRunner(embeddedRedis, "string", TpchTable.getTables())); this.embeddedRedis = embeddedRedis; }
public TestRedisDistributedHash(EmbeddedRedis embeddedRedis) { super(() -> RedisQueryRunner.createRedisQueryRunner(embeddedRedis, "hash", TpchTable.getTables())); this.embeddedRedis = embeddedRedis; }
public TestElasticsearchIntegrationSmokeTest(EmbeddedElasticsearchNode embeddedElasticsearchNode) { super(() -> createElasticsearchQueryRunner(embeddedElasticsearchNode, TpchTable.getTables())); this.embeddedElasticsearchNode = embeddedElasticsearchNode; }
public TestHiveDistributedAggregations() { super(() -> createQueryRunner(getTables())); } }
public TestPostgreSqlDistributedQueries(TestingPostgreSqlServer postgreSqlServer) { super(() -> createPostgreSqlQueryRunner(postgreSqlServer, TpchTable.getTables())); this.postgreSqlServer = postgreSqlServer; }
public TestMySqlDistributedQueries(TestingMySqlServer mysqlServer) { super(() -> createMySqlQueryRunner(mysqlServer, TpchTable.getTables())); this.mysqlServer = mysqlServer; }
public TestMongoDistributedQueries() { super(() -> createMongoQueryRunner(TpchTable.getTables())); }
public TestHiveDistributedQueries() { super(() -> createQueryRunner(getTables())); }
public TestJdbcDistributedQueries() { super(() -> createJdbcQueryRunner(TpchTable.getTables())); }
@Test public void testTableScanStats() { TpchTable.getTables() .forEach(table -> statisticsAssertion.check("SELECT * FROM " + table.getTableName(), checks -> checks.estimate(OUTPUT_ROW_COUNT, noError()))); }
public static void main(String[] args) throws Exception { // You need to add "--user user" to your CLI for your queries to work Logging.initialize(); DistributedQueryRunner queryRunner = createQueryRunner(TpchTable.getTables(), ImmutableMap.of("http-server.http.port", "8080")); Thread.sleep(10); Logger log = Logger.get(DistributedQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); } }
public static void main(String[] args) { TpchStatisticsRecorder tool = new TpchStatisticsRecorder(new TableStatisticsRecorder(), new TableStatisticsDataRepository(createObjectMapper())); SUPPORTED_SCHEMAS.forEach(schemaName -> { TpchTable.getTables() .forEach(table -> tool.computeAndOutputStatsFor(schemaName, table)); Stream.of("F", "O", "P").forEach(partitionValue -> tool.computeAndOutputStatsFor(schemaName, ORDERS, ORDER_STATUS, partitionValue)); }); }
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createKafkaQueryRunner(EmbeddedKafka.createEmbeddedKafka(), TpchTable.getTables()); Thread.sleep(10); Logger log = Logger.get(KafkaQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); } }
public static void main(String[] args) throws Exception { Logging.initialize(); DistributedQueryRunner queryRunner = createElasticsearchQueryRunner(EmbeddedElasticsearchNode.createEmbeddedElasticsearchNode(), TpchTable.getTables()); Thread.sleep(10); Logger log = Logger.get(ElasticsearchQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); } }