Search in sources :

Example 1 with StatisticsAssertion

use of io.trino.testing.statistics.StatisticsAssertion in project trino by trinodb.

the class TestTpcdsLocalStats method setUp.

@BeforeClass
public void setUp() {
    Session defaultSession = testSessionBuilder().setCatalog("tpcds").setSchema("sf1").setSystemProperty(COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES, "true").build();
    LocalQueryRunner queryRunner = LocalQueryRunner.create(defaultSession);
    queryRunner.createCatalog("tpcds", new TpcdsConnectorFactory(), emptyMap());
    statisticsAssertion = new StatisticsAssertion(queryRunner);
}
Also used : TpcdsConnectorFactory(io.trino.plugin.tpcds.TpcdsConnectorFactory) StatisticsAssertion(io.trino.testing.statistics.StatisticsAssertion) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with StatisticsAssertion

use of io.trino.testing.statistics.StatisticsAssertion in project trino by trinodb.

the class TestTpchDistributedStats method setup.

@BeforeClass
public void setup() throws Exception {
    DistributedQueryRunner runner = TpchQueryRunnerBuilder.builder().amendSession(builder -> builder.setSystemProperty(PREFER_PARTIAL_AGGREGATION, "false").setSystemProperty(COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES, "true")).buildWithoutCatalogs();
    runner.createCatalog("tpch", "tpch", ImmutableMap.of(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name()));
    statisticsAssertion = new StatisticsAssertion(runner);
}
Also used : TpchTable(io.trino.tpch.TpchTable) AfterClass(org.testng.annotations.AfterClass) TPCH_COLUMN_NAMING_PROPERTY(io.trino.plugin.tpch.TpchConnectorFactory.TPCH_COLUMN_NAMING_PROPERTY) ImmutableMap(com.google.common.collect.ImmutableMap) MetricComparisonStrategies.relativeError(io.trino.testing.statistics.MetricComparisonStrategies.relativeError) ColumnNaming(io.trino.plugin.tpch.ColumnNaming) BeforeClass(org.testng.annotations.BeforeClass) PREFER_PARTIAL_AGGREGATION(io.trino.SystemSessionProperties.PREFER_PARTIAL_AGGREGATION) MetricComparisonStrategies.absoluteError(io.trino.testing.statistics.MetricComparisonStrategies.absoluteError) Test(org.testng.annotations.Test) OUTPUT_ROW_COUNT(io.trino.testing.statistics.Metrics.OUTPUT_ROW_COUNT) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) MetricComparisonStrategies.defaultTolerance(io.trino.testing.statistics.MetricComparisonStrategies.defaultTolerance) StatisticsAssertion(io.trino.testing.statistics.StatisticsAssertion) Assert.assertEventually(io.trino.testing.assertions.Assert.assertEventually) Metrics.distinctValuesCount(io.trino.testing.statistics.Metrics.distinctValuesCount) COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES(io.trino.SystemSessionProperties.COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES) MetricComparisonStrategies.noError(io.trino.testing.statistics.MetricComparisonStrategies.noError) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) StatisticsAssertion(io.trino.testing.statistics.StatisticsAssertion) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with StatisticsAssertion

use of io.trino.testing.statistics.StatisticsAssertion in project trino by trinodb.

the class TestTpchLocalStats method setUp.

@BeforeClass
public void setUp() {
    Session defaultSession = testSessionBuilder().setCatalog("tpch").setSchema(TINY_SCHEMA_NAME).setSystemProperty(PREFER_PARTIAL_AGGREGATION, "false").setSystemProperty(COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES, "true").build();
    LocalQueryRunner queryRunner = LocalQueryRunner.create(defaultSession);
    queryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of(TPCH_COLUMN_NAMING_PROPERTY, ColumnNaming.STANDARD.name()));
    statisticsAssertion = new StatisticsAssertion(queryRunner);
}
Also used : TpchConnectorFactory(io.trino.plugin.tpch.TpchConnectorFactory) StatisticsAssertion(io.trino.testing.statistics.StatisticsAssertion) LocalQueryRunner(io.trino.testing.LocalQueryRunner) Session(io.trino.Session) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

StatisticsAssertion (io.trino.testing.statistics.StatisticsAssertion)3 BeforeClass (org.testng.annotations.BeforeClass)3 Session (io.trino.Session)2 LocalQueryRunner (io.trino.testing.LocalQueryRunner)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES (io.trino.SystemSessionProperties.COLLECT_PLAN_STATISTICS_FOR_ALL_QUERIES)1 PREFER_PARTIAL_AGGREGATION (io.trino.SystemSessionProperties.PREFER_PARTIAL_AGGREGATION)1 TpcdsConnectorFactory (io.trino.plugin.tpcds.TpcdsConnectorFactory)1 ColumnNaming (io.trino.plugin.tpch.ColumnNaming)1 TpchConnectorFactory (io.trino.plugin.tpch.TpchConnectorFactory)1 TPCH_COLUMN_NAMING_PROPERTY (io.trino.plugin.tpch.TpchConnectorFactory.TPCH_COLUMN_NAMING_PROPERTY)1 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)1 Assert.assertEventually (io.trino.testing.assertions.Assert.assertEventually)1 MetricComparisonStrategies.absoluteError (io.trino.testing.statistics.MetricComparisonStrategies.absoluteError)1 MetricComparisonStrategies.defaultTolerance (io.trino.testing.statistics.MetricComparisonStrategies.defaultTolerance)1 MetricComparisonStrategies.noError (io.trino.testing.statistics.MetricComparisonStrategies.noError)1 MetricComparisonStrategies.relativeError (io.trino.testing.statistics.MetricComparisonStrategies.relativeError)1 OUTPUT_ROW_COUNT (io.trino.testing.statistics.Metrics.OUTPUT_ROW_COUNT)1 Metrics.distinctValuesCount (io.trino.testing.statistics.Metrics.distinctValuesCount)1 TpchTable (io.trino.tpch.TpchTable)1