Search in sources :

Example 1 with NodeSpillConfig

use of com.facebook.presto.spiller.NodeSpillConfig in project presto by prestodb.

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 NodeMemoryConfig(), new WarningCollectorConfig(), new NodeSchedulerConfig(), new NodeSpillConfig(), new TracingConfig()))).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, TOO_MANY_GROUPING_SETS, "line 3:10: GROUP BY has 4096 grouping sets but can contain at most 2048", "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)");
    assertFails(session, TOO_MANY_GROUPING_SETS, format("line 3:10: GROUP BY has more than %s grouping sets but can contain at most 2048", Integer.MAX_VALUE), "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)");
}
Also used : WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) TracingConfig(com.facebook.presto.tracing.TracingConfig) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) NodeMemoryConfig(com.facebook.presto.memory.NodeMemoryConfig) NodeSpillConfig(com.facebook.presto.spiller.NodeSpillConfig) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) TaskManagerConfig(com.facebook.presto.execution.TaskManagerConfig) MemoryManagerConfig(com.facebook.presto.memory.MemoryManagerConfig) Session(com.facebook.presto.Session) SystemSessionProperties(com.facebook.presto.SystemSessionProperties) Test(org.testng.annotations.Test)

Example 2 with NodeSpillConfig

use of com.facebook.presto.spiller.NodeSpillConfig in project presto by prestodb.

the class TestAnalyzer method testWindowOrderByAnalysis.

@Test
public void testWindowOrderByAnalysis() {
    assertHasWarning(analyzeWithWarnings("SELECT SUM(x) OVER (PARTITION BY y ORDER BY 1) AS s\n" + "FROM (values (1,10), (2, 10)) AS T(x, y)"), PERFORMANCE_WARNING, "ORDER BY literals/constants with window function:");
    assertHasWarning(analyzeWithWarnings("SELECT SUM(x) OVER (ORDER BY 1) AS s\n" + "FROM (values (1,10), (2, 10)) AS T(x, y)"), PERFORMANCE_WARNING, "ORDER BY literals/constants with window function:");
    // Now test for error when the session param is set to disallow this.
    Session session = testSessionBuilder(new SessionPropertyManager(new SystemSessionProperties(new QueryManagerConfig(), new TaskManagerConfig(), new MemoryManagerConfig(), new FeaturesConfig().setAllowWindowOrderByLiterals(false), new NodeMemoryConfig(), new WarningCollectorConfig(), new NodeSchedulerConfig(), new NodeSpillConfig(), new TracingConfig()))).build();
    assertFails(session, WINDOW_FUNCTION_ORDERBY_LITERAL, "SELECT SUM(x) OVER (PARTITION BY y ORDER BY 1) AS s\n" + "FROM (values (1,10), (2, 10)) AS T(x, y)");
    assertFails(session, WINDOW_FUNCTION_ORDERBY_LITERAL, "SELECT SUM(x) OVER (ORDER BY 1) AS s\n" + "FROM (values (1,10), (2, 10)) AS T(x, y)");
    analyze(session, "SELECT SUM(x) OVER (PARTITION BY y ORDER BY y) AS s\n" + "FROM (values (1,10), (2, 10)) AS T(x, y)");
}
Also used : WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) TracingConfig(com.facebook.presto.tracing.TracingConfig) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) NodeMemoryConfig(com.facebook.presto.memory.NodeMemoryConfig) NodeSpillConfig(com.facebook.presto.spiller.NodeSpillConfig) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) TaskManagerConfig(com.facebook.presto.execution.TaskManagerConfig) MemoryManagerConfig(com.facebook.presto.memory.MemoryManagerConfig) Session(com.facebook.presto.Session) SystemSessionProperties(com.facebook.presto.SystemSessionProperties) Test(org.testng.annotations.Test)

Example 3 with NodeSpillConfig

use of com.facebook.presto.spiller.NodeSpillConfig in project presto by prestodb.

the class TestAggregationOperator method testDistinctMaskWithNull.

@Test
public void testDistinctMaskWithNull() {
    AccumulatorFactory distinctFactory = COUNT.bind(ImmutableList.of(0), Optional.of(1), ImmutableList.of(BIGINT, BOOLEAN), ImmutableList.of(), ImmutableList.of(), null, // distinct
    true, new JoinCompiler(MetadataManager.createTestMetadataManager(), new FeaturesConfig()), ImmutableList.of(), false, TEST_SESSION, new TempStorageStandaloneSpillerFactory(new TestingTempStorageManager(), new BlockEncodingManager(), new NodeSpillConfig(), new FeaturesConfig(), new SpillerStats()));
    OperatorFactory operatorFactory = new AggregationOperatorFactory(0, new PlanNodeId("test"), Step.SINGLE, ImmutableList.of(distinctFactory), false);
    DriverContext driverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION).addPipelineContext(0, true, true, false).addDriverContext();
    ByteArrayBlock trueMaskAllNull = new ByteArrayBlock(4, Optional.of(new boolean[] { true, true, true, true }), /* all positions are null */
    new byte[] { 1, 1, 1, 1 });
    /* non-zero value is true, all masks are true */
    Block trueNullRleMask = new RunLengthEncodedBlock(trueMaskAllNull.getSingleValueBlock(0), 4);
    List<Page> input = ImmutableList.of(new Page(4, createLongsBlock(1, 2, 3, 4), trueMaskAllNull), new Page(4, createLongsBlock(5, 6, 7, 8), trueNullRleMask));
    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT).row(// all rows should be filtered by nulls
    0L).build();
    assertOperatorEquals(operatorFactory, driverContext, input, expected);
}
Also used : JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) NodeSpillConfig(com.facebook.presto.spiller.NodeSpillConfig) Page(com.facebook.presto.common.Page) SpillerStats(com.facebook.presto.spiller.SpillerStats) PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) TestingTempStorageManager(com.facebook.presto.testing.TestingTempStorageManager) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) AccumulatorFactory(com.facebook.presto.operator.aggregation.AccumulatorFactory) RunLengthEncodedBlock(com.facebook.presto.common.block.RunLengthEncodedBlock) ByteArrayBlock(com.facebook.presto.common.block.ByteArrayBlock) BlockAssertions.createLongsBlock(com.facebook.presto.block.BlockAssertions.createLongsBlock) Block(com.facebook.presto.common.block.Block) ByteArrayBlock(com.facebook.presto.common.block.ByteArrayBlock) RunLengthEncodedBlock(com.facebook.presto.common.block.RunLengthEncodedBlock) MaterializedResult(com.facebook.presto.testing.MaterializedResult) Test(org.testng.annotations.Test)

Aggregations

NodeSpillConfig (com.facebook.presto.spiller.NodeSpillConfig)3 Test (org.testng.annotations.Test)3 Session (com.facebook.presto.Session)2 SystemSessionProperties (com.facebook.presto.SystemSessionProperties)2 QueryManagerConfig (com.facebook.presto.execution.QueryManagerConfig)2 TaskManagerConfig (com.facebook.presto.execution.TaskManagerConfig)2 NodeSchedulerConfig (com.facebook.presto.execution.scheduler.NodeSchedulerConfig)2 WarningCollectorConfig (com.facebook.presto.execution.warnings.WarningCollectorConfig)2 MemoryManagerConfig (com.facebook.presto.memory.MemoryManagerConfig)2 NodeMemoryConfig (com.facebook.presto.memory.NodeMemoryConfig)2 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)2 TracingConfig (com.facebook.presto.tracing.TracingConfig)2 BlockAssertions.createLongsBlock (com.facebook.presto.block.BlockAssertions.createLongsBlock)1 Page (com.facebook.presto.common.Page)1 Block (com.facebook.presto.common.block.Block)1 BlockEncodingManager (com.facebook.presto.common.block.BlockEncodingManager)1 ByteArrayBlock (com.facebook.presto.common.block.ByteArrayBlock)1 RunLengthEncodedBlock (com.facebook.presto.common.block.RunLengthEncodedBlock)1 AggregationOperatorFactory (com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory)1 AccumulatorFactory (com.facebook.presto.operator.aggregation.AccumulatorFactory)1