Search in sources :

Example 1 with Count

use of io.trino.spi.metrics.Count in project trino by trinodb.

the class TestMemoryConnectorTest method testCustomMetricsScanFilter.

@Test
// TODO (https://github.com/trinodb/trino/issues/8691) fix the test
@Flaky(issue = "https://github.com/trinodb/trino/issues/8691", match = "ComparisonFailure: expected:<LongCount\\{total=\\[\\d+]}> but was:<(LongCount\\{total=\\[\\d+]}|null)>")
public void testCustomMetricsScanFilter() {
    Metrics metrics = collectCustomMetrics("SELECT partkey FROM part WHERE partkey % 1000 > 0");
    assertThat(metrics.getMetrics().get("rows")).isEqualTo(new LongCount(PART_COUNT));
    assertThat(metrics.getMetrics().get("started")).isEqualTo(metrics.getMetrics().get("finished"));
    assertThat(((Count<?>) metrics.getMetrics().get("finished")).getTotal()).isGreaterThan(0);
}
Also used : Metrics(io.trino.spi.metrics.Metrics) LongCount(io.trino.plugin.base.metrics.LongCount) LongCount(io.trino.plugin.base.metrics.LongCount) Count(io.trino.spi.metrics.Count) Test(org.testng.annotations.Test) BaseConnectorTest(io.trino.testing.BaseConnectorTest) Flaky(io.trino.testng.services.Flaky)

Example 2 with Count

use of io.trino.spi.metrics.Count in project trino by trinodb.

the class TestMemoryConnectorTest method testCustomMetricsScanOnly.

@Test
@Flaky(issue = "https://github.com/trinodb/trino/issues/8691", match = "ComparisonFailure: expected:<LongCount\\{total=\\[\\d+]}> but was:<(LongCount\\{total=\\[\\d+]}|null)>")
public void testCustomMetricsScanOnly() {
    Metrics metrics = collectCustomMetrics("SELECT partkey FROM part");
    assertThat(metrics.getMetrics().get("rows")).isEqualTo(new LongCount(PART_COUNT));
    assertThat(metrics.getMetrics().get("started")).isEqualTo(metrics.getMetrics().get("finished"));
    assertThat(((Count<?>) metrics.getMetrics().get("finished")).getTotal()).isGreaterThan(0);
}
Also used : Metrics(io.trino.spi.metrics.Metrics) LongCount(io.trino.plugin.base.metrics.LongCount) LongCount(io.trino.plugin.base.metrics.LongCount) Count(io.trino.spi.metrics.Count) Test(org.testng.annotations.Test) BaseConnectorTest(io.trino.testing.BaseConnectorTest) Flaky(io.trino.testng.services.Flaky)

Aggregations

LongCount (io.trino.plugin.base.metrics.LongCount)2 Count (io.trino.spi.metrics.Count)2 Metrics (io.trino.spi.metrics.Metrics)2 BaseConnectorTest (io.trino.testing.BaseConnectorTest)2 Flaky (io.trino.testng.services.Flaky)2 Test (org.testng.annotations.Test)2