use of io.prestosql.plugin.jdbc.BaseJdbcConfig 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);
}
use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits08.
// splitCount is not exist.
@Test
public void testGetTableSplits08() {
BaseJdbcConfig config = new BaseJdbcConfig();
config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"splitField\":\"value\",\"calcStepEnable\":\"false\",\"dataReadOnly\":\"true\"," + "\"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.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits04.
// dataReadOnly is false
@Test
public void testGetTableSplits04() {
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\":\"1\",\"fieldMaxValue\":\"12\"}]");
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.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits06.
// dataReadOnly is not exist.
@Test
public void testGetTableSplits06() {
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\",\"splitCount\":\"2\"," + "\"fieldMinValue\":\"1\",\"fieldMaxValue\":\"12\"}]");
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.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.
the class TestDataSourceTableSplitManager method testGetTableSplits10.
// fieldMinValue and fieldMaxValue is same value.
@Test
public void testGetTableSplits10() {
BaseJdbcConfig config = new BaseJdbcConfig();
config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"SAME_NUMBERS\"," + "\"splitField\":\"value\",\"calcStepEnable\":\"false\",\"dataReadOnly\":\"true\",\"splitCount\":\"2\"," + "\"fieldMinValue\":\"10\",\"fieldMaxValue\":\"10\"}]");
tableHandle = getTableHandle(new SchemaTableName("example", "same_numbers"));
splitManager = new DataSourceTableSplitManager(config, jdbcClient, nodeManager);
ConnectorSplitSource splitSource = splitManager.getTableSplits(JdbcIdentity.from(SESSION), tableHandle);
assertEquals(splitSource.getClass(), FixedSplitSource.class);
}
Aggregations