Search in sources :

Example 1 with ConnectorSplitSource

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);
}
Also used : ColumnHandle(io.prestosql.spi.connector.ColumnHandle) ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource) ConnectorSplit(io.prestosql.spi.connector.ConnectorSplit)

Example 2 with ConnectorSplitSource

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);
    }
}
Also used : JdbcSplit(io.prestosql.plugin.jdbc.JdbcSplit) ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) ConnectorSplit(io.prestosql.spi.connector.ConnectorSplit) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Test(org.testng.annotations.Test)

Example 3 with ConnectorSplitSource

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);
}
Also used : ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Test(org.testng.annotations.Test)

Example 4 with ConnectorSplitSource

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);
}
Also used : ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Test(org.testng.annotations.Test)

Example 5 with ConnectorSplitSource

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);
}
Also used : ConnectorSplitSource(io.prestosql.spi.connector.ConnectorSplitSource) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Test(org.testng.annotations.Test)

Aggregations

ConnectorSplitSource (io.prestosql.spi.connector.ConnectorSplitSource)37 Test (org.testng.annotations.Test)28 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)19 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)19 ConnectorSplit (io.prestosql.spi.connector.ConnectorSplit)17 BaseJdbcConfig (io.prestosql.plugin.jdbc.BaseJdbcConfig)14 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)14 ColumnHandle (io.prestosql.spi.connector.ColumnHandle)12 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)10 TestingConnectorSession (io.prestosql.testing.TestingConnectorSession)10 ConnectorTransactionHandle (io.prestosql.spi.connector.ConnectorTransactionHandle)9 TupleDomain (io.prestosql.spi.predicate.TupleDomain)7 JdbcSplit (io.prestosql.plugin.jdbc.JdbcSplit)6 ConnectorPageSource (io.prestosql.spi.connector.ConnectorPageSource)6 PrestoException (io.prestosql.spi.PrestoException)5 ColumnMetadata (io.prestosql.spi.connector.ColumnMetadata)5 ImmutableList (com.google.common.collect.ImmutableList)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 HiveTransaction (io.prestosql.plugin.hive.AbstractTestHive.HiveTransaction)4 Transaction (io.prestosql.plugin.hive.AbstractTestHive.Transaction)4