Search in sources :

Example 1 with DistributedQueryRunner

use of io.trino.testing.DistributedQueryRunner in project trino by trinodb.

the class GeoQueryRunner method createQueryRunner.

private static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception {
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().build()).setExtraProperties(extraProperties).build();
    queryRunner.installPlugin(new GeoPlugin());
    return queryRunner;
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner)

Example 2 with DistributedQueryRunner

use of io.trino.testing.DistributedQueryRunner in project trino by trinodb.

the class GeoQueryRunner method main.

public static void main(String[] args) throws Exception {
    Logging.initialize();
    DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
    Logger log = Logger.get(GeoQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) Logger(io.airlift.log.Logger)

Example 3 with DistributedQueryRunner

use of io.trino.testing.DistributedQueryRunner in project trino by trinodb.

the class SheetsQueryRunner method main.

public static void main(String[] args) throws Exception {
    Logging.initialize();
    DistributedQueryRunner queryRunner = createSheetsQueryRunner(ImmutableMap.of("http-server.http.port", "8080"), ImmutableMap.of());
    Logger log = Logger.get(SheetsQueryRunner.class);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) Logger(io.airlift.log.Logger)

Example 4 with DistributedQueryRunner

use of io.trino.testing.DistributedQueryRunner in project trino by trinodb.

the class BaseHiveConnectorTest method doTestParquetTimestampPredicatePushdown.

private void doTestParquetTimestampPredicatePushdown(Session baseSession, HiveTimestampPrecision timestampPrecision, LocalDateTime value) {
    Session session = withTimestampPrecision(baseSession, timestampPrecision);
    String tableName = "test_parquet_timestamp_predicate_pushdown_" + randomTableSuffix();
    assertUpdate("DROP TABLE IF EXISTS " + tableName);
    assertUpdate("CREATE TABLE " + tableName + " (t TIMESTAMP) WITH (format = 'PARQUET')");
    assertUpdate(session, format("INSERT INTO %s VALUES (%s)", tableName, formatTimestamp(value)), 1);
    assertQuery(session, "SELECT * FROM " + tableName, format("VALUES (%s)", formatTimestamp(value)));
    DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
    ResultWithQueryId<MaterializedResult> queryResult = queryRunner.executeWithQueryId(session, format("SELECT * FROM %s WHERE t < %s", tableName, formatTimestamp(value)));
    assertEquals(getQueryInfo(queryRunner, queryResult).getQueryStats().getProcessedInputDataSize().toBytes(), 0);
    queryResult = queryRunner.executeWithQueryId(session, format("SELECT * FROM %s WHERE t > %s", tableName, formatTimestamp(value)));
    assertEquals(getQueryInfo(queryRunner, queryResult).getQueryStats().getProcessedInputDataSize().toBytes(), 0);
    assertQueryStats(session, format("SELECT * FROM %s WHERE t = %s", tableName, formatTimestamp(value)), queryStats -> {
        assertThat(queryStats.getProcessedInputDataSize().toBytes()).isGreaterThan(0);
    }, results -> {
    });
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) MaterializedResult(io.trino.testing.MaterializedResult) HiveQueryRunner.createBucketedSession(io.trino.plugin.hive.HiveQueryRunner.createBucketedSession) Session(io.trino.Session)

Example 5 with DistributedQueryRunner

use of io.trino.testing.DistributedQueryRunner in project trino by trinodb.

the class HiveQueryRunner method main.

public static void main(String[] args) throws Exception {
    Optional<Path> baseDataDir = Optional.empty();
    if (args.length > 0) {
        if (args.length != 1) {
            System.err.println("usage: HiveQueryRunner [baseDataDir]");
            System.exit(1);
        }
        Path path = Paths.get(args[0]);
        createDirectories(path);
        baseDataDir = Optional.of(path);
    }
    DistributedQueryRunner queryRunner = HiveQueryRunner.builder().setExtraProperties(ImmutableMap.of("http-server.http.port", "8080")).setSkipTimezoneSetup(true).setHiveProperties(ImmutableMap.of()).setInitialTables(TpchTable.getTables()).setBaseDataDir(baseDataDir).setTpcdsCatalogEnabled(true).setSecurity(ALLOW_ALL).build();
    Thread.sleep(10);
    log.info("======== SERVER STARTED ========");
    log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
Also used : Path(java.nio.file.Path) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner)

Aggregations

DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)141 Test (org.testng.annotations.Test)46 TpchPlugin (io.trino.plugin.tpch.TpchPlugin)38 Session (io.trino.Session)34 Logger (io.airlift.log.Logger)32 QueryId (io.trino.spi.QueryId)15 ResourceGroupManagerPlugin (io.trino.plugin.resourcegroups.ResourceGroupManagerPlugin)14 MaterializedResult (io.trino.testing.MaterializedResult)13 ImmutableMap (com.google.common.collect.ImmutableMap)12 ImmutableList (com.google.common.collect.ImmutableList)11 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)11 File (java.io.File)10 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)9 QueryRunner (io.trino.testing.QueryRunner)9 Optional (java.util.Optional)9 MockConnectorFactory (io.trino.connector.MockConnectorFactory)8 Plugin (io.trino.spi.Plugin)8 SchemaTableName (io.trino.spi.connector.SchemaTableName)8 HiveMetastore (io.trino.plugin.hive.metastore.HiveMetastore)7 ImmutableSet (com.google.common.collect.ImmutableSet)6