Skip to content

Commit

Permalink
Add main() to PhoenixQueryRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Sep 30, 2020
1 parent f6e72de commit dfc5f5a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 29 deletions.
45 changes: 21 additions & 24 deletions presto-phoenix/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,6 @@
<dep.hbase.version>1.4.0</dep.hbase.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>log-manager</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.prestosql</groupId>
Expand Down Expand Up @@ -124,6 +100,27 @@
<artifactId>jmxutils</artifactId>
</dependency>

<!-- used by tests but also needed transitively -->
<dependency>
<groupId>io.airlift</groupId>
<artifactId>log-manager</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Presto SPI -->
<dependency>
<groupId>io.prestosql</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.google.common.collect.ImmutableMap;
import io.airlift.log.Logger;
import io.airlift.log.Logging;
import io.prestosql.Session;
import io.prestosql.metadata.QualifiedObjectName;
import io.prestosql.plugin.tpch.TpchPlugin;
Expand Down Expand Up @@ -46,10 +47,13 @@ private PhoenixQueryRunner()
{
}

public static QueryRunner createPhoenixQueryRunner(TestingPhoenixServer server)
public static DistributedQueryRunner createPhoenixQueryRunner(TestingPhoenixServer server, Map<String, String> extraProperties)
throws Exception
{
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession()).build();
DistributedQueryRunner queryRunner = DistributedQueryRunner
.builder(createSession())
.setExtraProperties(extraProperties)
.build();

queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
Expand Down Expand Up @@ -132,4 +136,18 @@ private static Session createSession()
.setSchema(TPCH_SCHEMA)
.build();
}

public static void main(String[] args)
throws Exception
{
Logging.initialize();

DistributedQueryRunner queryRunner = createPhoenixQueryRunner(
TestingPhoenixServer.getInstance(),
ImmutableMap.of("http-server.http.port", "8080"));

Logger log = Logger.get(PhoenixQueryRunner.class);
log.info("======== SERVER STARTED ========");
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.prestosql.plugin.phoenix;

import com.google.common.collect.ImmutableMap;
import io.prestosql.testing.AbstractTestDistributedQueries;
import io.prestosql.testing.QueryRunner;
import io.prestosql.testing.sql.TestTable;
Expand All @@ -28,7 +29,7 @@ public class TestPhoenixDistributedQueries
protected QueryRunner createQueryRunner()
throws Exception
{
return createPhoenixQueryRunner(TestingPhoenixServer.getInstance());
return createPhoenixQueryRunner(TestingPhoenixServer.getInstance(), ImmutableMap.of());
}

@AfterClass(alwaysRun = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.prestosql.plugin.phoenix;

import com.google.common.collect.ImmutableMap;
import io.prestosql.Session;
import io.prestosql.plugin.jdbc.UnsupportedTypeHandling;
import io.prestosql.testing.AbstractTestIntegrationSmokeTest;
Expand Down Expand Up @@ -42,7 +43,7 @@ protected QueryRunner createQueryRunner()
throws Exception
{
testingPhoenixServer = TestingPhoenixServer.getInstance();
return createPhoenixQueryRunner(testingPhoenixServer);
return createPhoenixQueryRunner(testingPhoenixServer, ImmutableMap.of());
}

@AfterClass(alwaysRun = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package io.prestosql.plugin.phoenix;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.prestosql.Session;
import io.prestosql.spi.type.ArrayType;
import io.prestosql.spi.type.TimeZoneKey;
Expand Down Expand Up @@ -76,7 +77,7 @@ protected QueryRunner createQueryRunner()
throws Exception
{
phoenixServer = TestingPhoenixServer.getInstance();
return createPhoenixQueryRunner(phoenixServer);
return createPhoenixQueryRunner(phoenixServer, ImmutableMap.of());
}

@AfterClass(alwaysRun = true)
Expand Down

0 comments on commit dfc5f5a

Please sign in to comment.