use of io.trino.spi.connector.ConnectorSplitSource in project trino by trinodb.
the class TestPrometheusIntegrationSchema method testCorrectNumberOfSplitsCreated.
@Test
public void testCorrectNumberOfSplitsCreated() {
PrometheusConnectorConfig config = new PrometheusConnectorConfig();
config.setPrometheusURI(server.getUri());
config.setMaxQueryRangeDuration(new Duration(21, DAYS));
config.setQueryChunkSizeDuration(new Duration(1, DAYS));
config.setCacheDuration(new Duration(30, SECONDS));
PrometheusTable table = client.getTable("default", "up");
PrometheusSplitManager splitManager = new PrometheusSplitManager(client, new PrometheusClock(), config);
ConnectorSplitSource splits = splitManager.getSplits(null, null, new PrometheusTableHandle("default", table.getName()), null, (DynamicFilter) null);
int numSplits = splits.getNextBatch(NOT_PARTITIONED, NUMBER_MORE_THAN_EXPECTED_NUMBER_SPLITS).getNow(null).getSplits().size();
assertEquals(numSplits, config.getMaxQueryRangeDuration().getValue(TimeUnit.SECONDS) / config.getQueryChunkSizeDuration().getValue(TimeUnit.SECONDS), 0.001);
}
Aggregations