use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestTableScanNodePartitioning method createLocalQueryRunner.
@Override
protected LocalQueryRunner createLocalQueryRunner() {
Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog(MOCK_CATALOG).setSchema(TEST_SCHEMA);
LocalQueryRunner queryRunner = LocalQueryRunner.builder(sessionBuilder.build()).withNodeCountForStats(10).build();
queryRunner.createCatalog(MOCK_CATALOG, createMockFactory(), ImmutableMap.of());
queryRunner.getNodePartitioningManager().addPartitioningProvider(new CatalogName(MOCK_CATALOG), new TestPartitioningProvider(new InMemoryNodeManager()));
return queryRunner;
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestHivePlans method createQueryRunner.
protected LocalQueryRunner createQueryRunner(Session session, HiveMetastore metastore) {
LocalQueryRunner queryRunner = LocalQueryRunner.create(session);
queryRunner.createCatalog(HIVE_CATALOG_NAME, new TestingHiveConnectorFactory(metastore), Map.of("hive.max-partitions-per-scan", "5"));
return queryRunner;
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestHiveProjectionPushdownIntoTableScan method createLocalQueryRunner.
@Override
protected LocalQueryRunner createLocalQueryRunner() {
baseDir = Files.createTempDir();
HdfsConfig config = new HdfsConfig();
HdfsConfiguration configuration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config), ImmutableSet.of());
HdfsEnvironment environment = new HdfsEnvironment(configuration, config, new NoHdfsAuthentication());
HiveMetastore metastore = new FileHiveMetastore(new NodeVersion("test_version"), environment, new MetastoreConfig(), new FileHiveMetastoreConfig().setCatalogDirectory(baseDir.toURI().toString()).setMetastoreUser("test"));
Database database = Database.builder().setDatabaseName(SCHEMA_NAME).setOwnerName(Optional.of("public")).setOwnerType(Optional.of(PrincipalType.ROLE)).build();
metastore.createDatabase(database);
LocalQueryRunner queryRunner = LocalQueryRunner.create(HIVE_SESSION);
queryRunner.createCatalog(HIVE_CATALOG_NAME, new TestingHiveConnectorFactory(metastore), ImmutableMap.of());
return queryRunner;
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestConnectorEventListener method testConnectorWithoutEventListener.
@Test
public void testConnectorWithoutEventListener() {
LocalQueryRunner queryRunner = LocalQueryRunner.builder(testSessionBuilder().build()).build();
queryRunner.loadEventListeners();
assertThatCode(() -> queryRunner.execute("SELECT 1")).doesNotThrowAnyException();
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestConnectorEventListener method testConnectorWithEventListener.
@Test
public void testConnectorWithEventListener() {
MockEventListenerFactory listenerFactory = new MockEventListenerFactory();
LocalQueryRunner queryRunner = LocalQueryRunner.builder(testSessionBuilder().build()).build();
queryRunner.createCatalog("event_listening", MockConnectorFactory.builder().withEventListener(listenerFactory).build(), ImmutableMap.of());
queryRunner.loadEventListeners();
assertThat(listenerFactory.getEventListenerInvocationCounter).hasValue(1);
}
Aggregations