Skip to content

Commit

Permalink
Allow enabling tpcds connector in HiveQueryRunner
Browse files Browse the repository at this point in the history
It is useful to have tpcds connector enabled when trying to debug tpcds
queries locally
  • Loading branch information
arhimondr authored and findepi committed Feb 26, 2022
1 parent 43e0431 commit 7d0506a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugin/trino-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-tpcds</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-tpch</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -110,6 +111,7 @@ public static class Builder<SELF extends Builder<?>>
};
private Module module = EMPTY_MODULE;
private Optional<CachingDirectoryLister> cachingDirectoryLister = Optional.empty();
private boolean tpcdsCatalogEnabled;

protected Builder()
{
Expand Down Expand Up @@ -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
Expand All @@ -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));

Expand Down Expand Up @@ -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 ========");
Expand Down

0 comments on commit 7d0506a

Please sign in to comment.