Search in sources :

Example 1 with QueryManagerConfig

use of io.trino.execution.QueryManagerConfig in project trino by trinodb.

the class TestHttpRemoteTask method createHttpRemoteTaskFactory.

private static HttpRemoteTaskFactory createHttpRemoteTaskFactory(TestingTaskResource testingTaskResource, DynamicFilterService dynamicFilterService) {
    Bootstrap app = new Bootstrap(new JsonModule(), new HandleJsonModule(), new Module() {

        @Override
        public void configure(Binder binder) {
            binder.bind(JsonMapper.class).in(SINGLETON);
            binder.bind(Metadata.class).toInstance(createTestMetadataManager());
            jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
            jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class);
            jsonCodecBinder(binder).bindJsonCodec(VersionedDynamicFilterDomains.class);
            jsonBinder(binder).addSerializerBinding(Block.class).to(BlockJsonSerde.Serializer.class);
            jsonBinder(binder).addDeserializerBinding(Block.class).to(BlockJsonSerde.Deserializer.class);
            jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class);
            jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class);
            jsonCodecBinder(binder).bindJsonCodec(FailTaskRequest.class);
            binder.bind(TypeManager.class).toInstance(TESTING_TYPE_MANAGER);
            binder.bind(BlockEncodingManager.class).in(SINGLETON);
            binder.bind(BlockEncodingSerde.class).to(InternalBlockEncodingSerde.class).in(SINGLETON);
        }

        @Provides
        private HttpRemoteTaskFactory createHttpRemoteTaskFactory(JsonMapper jsonMapper, JsonCodec<TaskStatus> taskStatusCodec, JsonCodec<VersionedDynamicFilterDomains> dynamicFilterDomainsCodec, JsonCodec<TaskInfo> taskInfoCodec, JsonCodec<TaskUpdateRequest> taskUpdateRequestCodec, JsonCodec<FailTaskRequest> failTaskRequestCodec) {
            JaxrsTestingHttpProcessor jaxrsTestingHttpProcessor = new JaxrsTestingHttpProcessor(URI.create("http://fake.invalid/"), testingTaskResource, jsonMapper);
            TestingHttpClient testingHttpClient = new TestingHttpClient(jaxrsTestingHttpProcessor.setTrace(TRACE_HTTP));
            testingTaskResource.setHttpClient(testingHttpClient);
            return new HttpRemoteTaskFactory(new QueryManagerConfig(), TASK_MANAGER_CONFIG, testingHttpClient, new TestSqlTaskManager.MockLocationFactory(), taskStatusCodec, dynamicFilterDomainsCodec, taskInfoCodec, taskUpdateRequestCodec, failTaskRequestCodec, new RemoteTaskStats(), dynamicFilterService);
        }
    });
    Injector injector = app.doNotInitializeLogging().quiet().initialize();
    return injector.getInstance(HttpRemoteTaskFactory.class);
}
Also used : VersionedDynamicFilterDomains(io.trino.execution.DynamicFiltersCollector.VersionedDynamicFilterDomains) TaskInfo(io.trino.execution.TaskInfo) JsonMapper(io.airlift.jaxrs.JsonMapper) JsonCodecBinder.jsonCodecBinder(io.airlift.json.JsonCodecBinder.jsonCodecBinder) Binder(com.google.inject.Binder) JsonBinder.jsonBinder(io.airlift.json.JsonBinder.jsonBinder) FailTaskRequest(io.trino.server.FailTaskRequest) JaxrsTestingHttpProcessor(io.airlift.jaxrs.testing.JaxrsTestingHttpProcessor) HandleJsonModule(io.trino.metadata.HandleJsonModule) Injector(com.google.inject.Injector) HttpRemoteTaskFactory(io.trino.server.HttpRemoteTaskFactory) TestingHttpClient(io.airlift.http.client.testing.TestingHttpClient) Bootstrap(io.airlift.bootstrap.Bootstrap) TypeDeserializer(io.trino.type.TypeDeserializer) TaskUpdateRequest(io.trino.server.TaskUpdateRequest) InternalBlockEncodingSerde(io.trino.metadata.InternalBlockEncodingSerde) BlockEncodingSerde(io.trino.spi.block.BlockEncodingSerde) TaskStatus(io.trino.execution.TaskStatus) Provides(com.google.inject.Provides) JsonModule(io.airlift.json.JsonModule) HandleJsonModule(io.trino.metadata.HandleJsonModule) TypeDeserializer(io.trino.type.TypeDeserializer) QueryManagerConfig(io.trino.execution.QueryManagerConfig) JsonModule(io.airlift.json.JsonModule) Module(com.google.inject.Module) HandleJsonModule(io.trino.metadata.HandleJsonModule)

Example 2 with QueryManagerConfig

use of io.trino.execution.QueryManagerConfig in project trino by trinodb.

the class TestCostCalculator method setUp.

@BeforeClass
public void setUp() {
    TaskCountEstimator taskCountEstimator = new TaskCountEstimator(() -> NUMBER_OF_NODES);
    costCalculatorUsingExchanges = new CostCalculatorUsingExchanges(taskCountEstimator);
    costCalculatorWithEstimatedExchanges = new CostCalculatorWithEstimatedExchanges(costCalculatorUsingExchanges, taskCountEstimator);
    session = testSessionBuilder().setCatalog("tpch").build();
    localQueryRunner = LocalQueryRunner.create(session);
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(), ImmutableMap.of());
    planFragmenter = new PlanFragmenter(localQueryRunner.getMetadata(), localQueryRunner.getFunctionManager(), localQueryRunner.getNodePartitioningManager(), new QueryManagerConfig());
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) PlanFragmenter(io.trino.sql.planner.PlanFragmenter) QueryManagerConfig(io.trino.execution.QueryManagerConfig) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with QueryManagerConfig

use of io.trino.execution.QueryManagerConfig in project trino by trinodb.

the class TestAnalyzer method testTooManyGroupingElements.

@Test
public void testTooManyGroupingElements() {
    Session session = testSessionBuilder(new SessionPropertyManager(new SystemSessionProperties(new QueryManagerConfig(), new TaskManagerConfig(), new MemoryManagerConfig(), new FeaturesConfig().setMaxGroupingSets(2048), new OptimizerConfig(), new NodeMemoryConfig(), new DynamicFilterConfig(), new NodeSchedulerConfig()))).build();
    analyze(session, "SELECT a, b, c, d, e, f, g, h, i, j, k, SUM(l)" + "FROM (VALUES (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))\n" + "t (a, b, c, d, e, f, g, h, i, j, k, l)\n" + "GROUP BY CUBE (a, b, c, d, e, f), CUBE (g, h, i, j, k)");
    assertFails(session, "SELECT a, b, c, d, e, f, g, h, i, j, k, l, SUM(m)" + "FROM (VALUES (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))\n" + "t (a, b, c, d, e, f, g, h, i, j, k, l, m)\n" + "GROUP BY CUBE (a, b, c, d, e, f), CUBE (g, h, i, j, k, l)").hasErrorCode(TOO_MANY_GROUPING_SETS).hasMessageMatching("line 3:10: GROUP BY has 4096 grouping sets but can contain at most 2048");
    assertFails(session, "SELECT a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, " + "q, r, s, t, u, v, x, w, y, z, aa, ab, ac, ad, ae, SUM(af)" + "FROM (VALUES (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, " + "17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))\n" + "t (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, " + "q, r, s, t, u, v, x, w, y, z, aa, ab, ac, ad, ae, af)\n" + "GROUP BY CUBE (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, " + "q, r, s, t, u, v, x, w, y, z, aa, ab, ac, ad, ae)").hasErrorCode(TOO_MANY_GROUPING_SETS).hasMessageMatching(format("line 3:10: GROUP BY has more than %s grouping sets but can contain at most 2048", Integer.MAX_VALUE));
}
Also used : OptimizerConfig(io.trino.sql.planner.OptimizerConfig) FeaturesConfig(io.trino.FeaturesConfig) SessionPropertyManager(io.trino.metadata.SessionPropertyManager) NodeSchedulerConfig(io.trino.execution.scheduler.NodeSchedulerConfig) NodeMemoryConfig(io.trino.memory.NodeMemoryConfig) QueryManagerConfig(io.trino.execution.QueryManagerConfig) TaskManagerConfig(io.trino.execution.TaskManagerConfig) MemoryManagerConfig(io.trino.memory.MemoryManagerConfig) DynamicFilterConfig(io.trino.execution.DynamicFilterConfig) Session(io.trino.Session) ConnectorSession(io.trino.spi.connector.ConnectorSession) SystemSessionProperties(io.trino.SystemSessionProperties) Test(org.testng.annotations.Test)

Aggregations

QueryManagerConfig (io.trino.execution.QueryManagerConfig)3 Binder (com.google.inject.Binder)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 Provides (com.google.inject.Provides)1 Bootstrap (io.airlift.bootstrap.Bootstrap)1 TestingHttpClient (io.airlift.http.client.testing.TestingHttpClient)1 JsonMapper (io.airlift.jaxrs.JsonMapper)1 JaxrsTestingHttpProcessor (io.airlift.jaxrs.testing.JaxrsTestingHttpProcessor)1 JsonBinder.jsonBinder (io.airlift.json.JsonBinder.jsonBinder)1 JsonCodecBinder.jsonCodecBinder (io.airlift.json.JsonCodecBinder.jsonCodecBinder)1 JsonModule (io.airlift.json.JsonModule)1 FeaturesConfig (io.trino.FeaturesConfig)1 Session (io.trino.Session)1 SystemSessionProperties (io.trino.SystemSessionProperties)1 DynamicFilterConfig (io.trino.execution.DynamicFilterConfig)1 VersionedDynamicFilterDomains (io.trino.execution.DynamicFiltersCollector.VersionedDynamicFilterDomains)1 TaskInfo (io.trino.execution.TaskInfo)1 TaskManagerConfig (io.trino.execution.TaskManagerConfig)1 TaskStatus (io.trino.execution.TaskStatus)1