use of io.trino.plugin.base.metrics.LongCount in project trino by trinodb.
the class TestOperatorStats method assertExpectedOperatorStats.
public static void assertExpectedOperatorStats(OperatorStats actual) {
assertEquals(actual.getStageId(), 0);
assertEquals(actual.getOperatorId(), 41);
assertEquals(actual.getOperatorType(), "test");
assertEquals(actual.getTotalDrivers(), 1);
assertEquals(actual.getAddInputCalls(), 2);
assertEquals(actual.getAddInputWall(), new Duration(3, NANOSECONDS));
assertEquals(actual.getAddInputCpu(), new Duration(4, NANOSECONDS));
assertEquals(actual.getPhysicalInputDataSize(), DataSize.ofBytes(51));
assertEquals(actual.getPhysicalInputPositions(), 511);
assertEquals(actual.getInternalNetworkInputDataSize(), DataSize.ofBytes(52));
assertEquals(actual.getInternalNetworkInputPositions(), 522);
assertEquals(actual.getRawInputDataSize(), DataSize.ofBytes(5));
assertEquals(actual.getInputDataSize(), DataSize.ofBytes(6));
assertEquals(actual.getInputPositions(), 7);
assertEquals(actual.getSumSquaredInputPositions(), 8.0);
assertEquals(actual.getGetOutputCalls(), 9);
assertEquals(actual.getGetOutputWall(), new Duration(10, NANOSECONDS));
assertEquals(actual.getGetOutputCpu(), new Duration(11, NANOSECONDS));
assertEquals(actual.getOutputDataSize(), DataSize.ofBytes(12));
assertEquals(actual.getOutputPositions(), 13);
assertEquals(actual.getDynamicFilterSplitsProcessed(), 533);
assertEquals(actual.getMetrics().getMetrics(), ImmutableMap.of("metrics", new LongCount(42)));
assertEquals(actual.getConnectorMetrics().getMetrics(), ImmutableMap.of("connectorMetrics", new LongCount(43)));
assertEquals(actual.getPhysicalWrittenDataSize(), DataSize.ofBytes(14));
assertEquals(actual.getBlockedWall(), new Duration(15, NANOSECONDS));
assertEquals(actual.getFinishCalls(), 16);
assertEquals(actual.getFinishWall(), new Duration(17, NANOSECONDS));
assertEquals(actual.getFinishCpu(), new Duration(18, NANOSECONDS));
assertEquals(actual.getUserMemoryReservation(), DataSize.ofBytes(19));
assertEquals(actual.getRevocableMemoryReservation(), DataSize.ofBytes(20));
assertEquals(actual.getPeakUserMemoryReservation(), DataSize.ofBytes(22));
assertEquals(actual.getPeakRevocableMemoryReservation(), DataSize.ofBytes(24));
assertEquals(actual.getPeakTotalMemoryReservation(), DataSize.ofBytes(25));
assertEquals(actual.getSpilledDataSize(), DataSize.ofBytes(26));
assertEquals(actual.getInfo().getClass(), SplitOperatorInfo.class);
assertEquals(((SplitOperatorInfo) actual.getInfo()).getSplitInfo(), NON_MERGEABLE_INFO.getSplitInfo());
}
use of io.trino.plugin.base.metrics.LongCount in project trino by trinodb.
the class TestOperatorStats method testAddMergeable.
@Test
public void testAddMergeable() {
OperatorStats actual = MERGEABLE.add(ImmutableList.of(MERGEABLE, MERGEABLE));
assertEquals(actual.getStageId(), 0);
assertEquals(actual.getOperatorId(), 41);
assertEquals(actual.getOperatorType(), "test");
assertEquals(actual.getTotalDrivers(), 3 * 1);
assertEquals(actual.getAddInputCalls(), 3 * 2);
assertEquals(actual.getAddInputWall(), new Duration(3 * 3, NANOSECONDS));
assertEquals(actual.getAddInputCpu(), new Duration(3 * 4, NANOSECONDS));
assertEquals(actual.getPhysicalInputDataSize(), DataSize.ofBytes(3 * 51));
assertEquals(actual.getPhysicalInputPositions(), 3 * 511);
assertEquals(actual.getInternalNetworkInputDataSize(), DataSize.ofBytes(3 * 52));
assertEquals(actual.getInternalNetworkInputPositions(), 3 * 522);
assertEquals(actual.getRawInputDataSize(), DataSize.ofBytes(3 * 5));
assertEquals(actual.getInputDataSize(), DataSize.ofBytes(3 * 6));
assertEquals(actual.getInputPositions(), 3 * 7);
assertEquals(actual.getSumSquaredInputPositions(), 3 * 8.0);
assertEquals(actual.getGetOutputCalls(), 3 * 9);
assertEquals(actual.getGetOutputWall(), new Duration(3 * 10, NANOSECONDS));
assertEquals(actual.getGetOutputCpu(), new Duration(3 * 11, NANOSECONDS));
assertEquals(actual.getOutputDataSize(), DataSize.ofBytes(3 * 12));
assertEquals(actual.getOutputPositions(), 3 * 13);
assertEquals(actual.getDynamicFilterSplitsProcessed(), 3 * 533);
assertEquals(actual.getMetrics().getMetrics(), ImmutableMap.of("metrics", new LongCount(3 * 42)));
assertEquals(actual.getConnectorMetrics().getMetrics(), ImmutableMap.of("connectorMetrics", new LongCount(3 * 43)));
assertEquals(actual.getPhysicalWrittenDataSize(), DataSize.ofBytes(3 * 14));
assertEquals(actual.getBlockedWall(), new Duration(3 * 15, NANOSECONDS));
assertEquals(actual.getFinishCalls(), 3 * 16);
assertEquals(actual.getFinishWall(), new Duration(3 * 17, NANOSECONDS));
assertEquals(actual.getFinishCpu(), new Duration(3 * 18, NANOSECONDS));
assertEquals(actual.getUserMemoryReservation(), DataSize.ofBytes(3 * 19));
assertEquals(actual.getRevocableMemoryReservation(), DataSize.ofBytes(3 * 20));
assertEquals(actual.getPeakUserMemoryReservation(), DataSize.ofBytes(22));
assertEquals(actual.getPeakRevocableMemoryReservation(), DataSize.ofBytes(24));
assertEquals(actual.getPeakTotalMemoryReservation(), DataSize.ofBytes(25));
assertEquals(actual.getSpilledDataSize(), DataSize.ofBytes(3 * 26));
assertEquals(actual.getInfo().getClass(), PartitionedOutputInfo.class);
assertEquals(((PartitionedOutputInfo) actual.getInfo()).getPagesAdded(), 3 * MERGEABLE_INFO.getPagesAdded());
}
use of io.trino.plugin.base.metrics.LongCount 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);
}
Aggregations