use of io.prestosql.spi.connector.ConnectorSplitSource in project hetu-core by openlookeng.
the class TestJmxSplitManager method getRecordSet.
private RecordSet getRecordSet(SchemaTableName schemaTableName) throws Exception {
JmxTableHandle tableHandle = metadata.getTableHandle(SESSION, schemaTableName);
List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(SESSION, tableHandle).values());
ConnectorSplitSource splitSource = splitManager.getSplits(JmxTransactionHandle.INSTANCE, SESSION, tableHandle, UNGROUPED_SCHEDULING);
List<ConnectorSplit> allSplits = getAllSplits(splitSource);
assertEquals(allSplits.size(), nodes.size());
ConnectorSplit split = allSplits.get(0);
return recordSetProvider.getRecordSet(JmxTransactionHandle.INSTANCE, SESSION, split, tableHandle, columnHandles);
}
use of io.prestosql.spi.connector.ConnectorSplitSource in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits03.
// fieldMinValue and fieldMaxValue is null and dataReadOnly is false
@Test
public void testGetTableSplits03() {
long[][] rangeArray = new long[][] { { 0, 6 }, { 6, 12 }, { 12, Long.MAX_VALUE }, { Long.MIN_VALUE, 0 } };
BaseJdbcConfig config = new BaseJdbcConfig();
config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"splitField\":\"value\",\"calcStepEnable\":\"false\",\"dataReadOnly\":\"false\",\"splitCount\":\"2\"," + "\"fieldMinValue\":\"\",\"fieldMaxValue\":\"\"}]");
tableHandle = getTableHandle(new SchemaTableName("example", "numbers"));
splitManager = new DataSourceTableSplitManager(config, jdbcClient, nodeManager);
TableSplitConfig tableSplitConfig = splitManager.getTableSplitConfig(tableHandle);
tableSplitConfig.setTableSplitFieldValid(true);
ConnectorSplitSource splitSource = splitManager.getTableSplits(JdbcIdentity.from(SESSION), tableHandle);
List<ConnectorSplit> splits = getFutureValue(splitSource.getNextBatch(NOT_PARTITIONED, 1000)).getSplits();
int index = 0;
for (ConnectorSplit split : splits) {
JdbcSplit jdbcSplit = (JdbcSplit) split;
assertEquals(Long.parseLong(jdbcSplit.getRangeStart()), rangeArray[index][0]);
assertEquals(Long.parseLong(jdbcSplit.getRangEnd()), rangeArray[index][1]);
index++;
assertFalse(index > 4);
}
}
use of io.prestosql.spi.connector.ConnectorSplitSource in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits07.
@Test
public void testGetTableSplits07() {
BaseJdbcConfig config = new BaseJdbcConfig();
config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"splitField\":\"value\",\"calcStepEnable\":\"false\",\"dataReadOnly\":\"true\",\"splitCount\":\"-1\"," + "\"fieldMinValue\":\"1\",\"fieldMaxValue\":\"12\"}]");
tableHandle = getTableHandle(new SchemaTableName("example", "numbers"));
splitManager = new DataSourceTableSplitManager(config, jdbcClient, nodeManager);
ConnectorSplitSource splitSource = splitManager.getTableSplits(JdbcIdentity.from(SESSION), tableHandle);
assertEquals(splitSource.getClass(), FixedSplitSource.class);
}
use of io.prestosql.spi.connector.ConnectorSplitSource in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits01.
// calcStepEnable is false
@Test
public void testGetTableSplits01() {
BaseJdbcConfig config = new BaseJdbcConfig();
config.setPushDownEnable(true).setTableSplitEnable(false).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"splitField\":\"value\",\"calcStepEnable\":\"false\",\"dataReadOnly\":\"true\",\"scanNodes\":\"2\"," + "\"fieldMinValue\":\"2\",\"fieldMaxValue\":\"12\"}]");
tableHandle = getTableHandle(new SchemaTableName("example", "numbers"));
splitManager = new DataSourceTableSplitManager(config, jdbcClient, nodeManager);
ConnectorSplitSource splitSource = splitManager.getSplits(JdbcIdentity.from(SESSION), tableHandle);
assertEquals(splitSource.getClass(), FixedSplitSource.class);
}
use of io.prestosql.spi.connector.ConnectorSplitSource in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits13.
// splitField is empty
@Test
public void testGetTableSplits13() {
BaseJdbcConfig config = new BaseJdbcConfig();
config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"splitField\":\"\",\"calcStepEnable\":\"false\",\"dataReadOnly\":\"true\",\"splitCount\":\"2\"," + "\"fieldMinValue\":\"1\",\"fieldMaxValue\":\"12\"}]");
tableHandle = getTableHandle(new SchemaTableName("example", "numbers"));
splitManager = new DataSourceTableSplitManager(config, jdbcClient, nodeManager);
ConnectorSplitSource splitSource = splitManager.getSplits(JdbcIdentity.from(SESSION), tableHandle);
assertEquals(splitSource.getClass(), FixedSplitSource.class);
}
Aggregations