From 7d0506abc298b98a52c551fef721eebb6a4291bb Mon Sep 17 00:00:00 2001 From: Andrii Rosa Date: Tue, 22 Feb 2022 17:32:21 -0500 Subject: [PATCH] Allow enabling tpcds connector in HiveQueryRunner It is useful to have tpcds connector enabled when trying to debug tpcds queries locally --- plugin/trino-hive/pom.xml | 6 ++++++ .../java/io/trino/plugin/hive/HiveQueryRunner.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/plugin/trino-hive/pom.xml b/plugin/trino-hive/pom.xml index 6ba64842fa4c..10b26773d32a 100644 --- a/plugin/trino-hive/pom.xml +++ b/plugin/trino-hive/pom.xml @@ -371,6 +371,12 @@ test + + io.trino + trino-tpcds + test + + io.trino trino-tpch diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java index 93d9288bd6e2..32da3017970d 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java @@ -26,6 +26,7 @@ import io.trino.plugin.hive.metastore.MetastoreConfig; import io.trino.plugin.hive.metastore.file.FileHiveMetastore; import io.trino.plugin.hive.metastore.file.FileHiveMetastoreConfig; +import io.trino.plugin.tpcds.TpcdsPlugin; import io.trino.plugin.tpch.TpchPlugin; import io.trino.spi.security.Identity; import io.trino.spi.security.PrincipalType; @@ -110,6 +111,7 @@ public static class Builder> }; private Module module = EMPTY_MODULE; private Optional cachingDirectoryLister = Optional.empty(); + private boolean tpcdsCatalogEnabled; protected Builder() { @@ -182,6 +184,12 @@ public SELF setCachingDirectoryLister(CachingDirectoryLister cachingDirectoryLis return self(); } + public SELF setTpcdsCatalogEnabled(boolean tpcdsCatalogEnabled) + { + this.tpcdsCatalogEnabled = tpcdsCatalogEnabled; + return self(); + } + @Override public DistributedQueryRunner build() throws Exception @@ -194,6 +202,11 @@ public DistributedQueryRunner build() queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); + if (tpcdsCatalogEnabled) { + queryRunner.installPlugin(new TpcdsPlugin()); + queryRunner.createCatalog("tpcds", "tpcds"); + } + HiveMetastore metastore = this.metastore.apply(queryRunner); queryRunner.installPlugin(new TestingHivePlugin(metastore, module, cachingDirectoryLister)); @@ -358,6 +371,7 @@ public static void main(String[] args) .setHiveProperties(ImmutableMap.of()) .setInitialTables(TpchTable.getTables()) .setBaseDataDir(baseDataDir) + .setTpcdsCatalogEnabled(true) .build(); Thread.sleep(10); log.info("======== SERVER STARTED ========");