Search in sources :

Example 16 with BaseJdbcConfig

use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.

the class TestDataSourceTableSplitManager method testGetTableSplits14.

// splitField is not number type
@Test
public void testGetTableSplits14() {
    BaseJdbcConfig config = new BaseJdbcConfig();
    config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"splitField\":\"text_short\",\"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);
}
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 17 with BaseJdbcConfig

use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.

the class TestDataSourceTableSplitManager method testGetTableSplits09.

// splitField is not exist.
@Test
public void testGetTableSplits09() {
    BaseJdbcConfig config = new BaseJdbcConfig();
    config.setPushDownEnable(true).setTableSplitEnable(true).setTableSplitFields("[{\"catalogName\":\"" + catalogName + "\",\"schemaName\":\"EXAMPLE\",\"tableName\":\"NUMBERS\"," + "\"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.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 18 with BaseJdbcConfig

use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.

the class TestApplyRemoteFunctionPushDown method setup.

@BeforeTest
public void setup() {
    BaseJdbcConfig baseJdbcConfig = new BaseJdbcConfig();
    baseJdbcConfig.setPushDownExternalFunctionNamespace("jdbc.v1");
    TesterParameter testerParameter = TesterParameter.getTesterParameter();
    this.baseJdbcRowExpressionConverter = new BaseJdbcRowExpressionConverter(testerParameter.getMetadata().getFunctionAndTypeManager(), testerParameter.getFunctionResolution(), testerParameter.getRowExpressionService(), testerParameter.getDeterminismEvaluator());
    this.applyRemoteFunctionPushDown = new TestingApplyRemoteFunctionPushDown(baseJdbcConfig, "foo");
    columnA = planSymbolAllocator.newSymbol("a", BIGINT);
}
Also used : TesterParameter(io.prestosql.plugin.jdbc.optimization.TesterParameter) BaseJdbcRowExpressionConverter(io.prestosql.plugin.jdbc.optimization.BaseJdbcRowExpressionConverter) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) BeforeTest(org.testng.annotations.BeforeTest)

Example 19 with BaseJdbcConfig

use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.

the class TestMySqlRegisterRemoteUdf method testMultiParamsFunctions.

// test func defination with more than one params
@Test
public void testMultiParamsFunctions() {
    MysqlExternalFunctionHub externalFunctionHub = new MysqlExternalFunctionHub(new BaseJdbcConfig());
    Set<ExternalFunctionInfo> externalFunctionInfo = externalFunctionHub.getExternalFunctions();
    assertTrue(externalFunctionInfo.size() > 0);
    List<ExternalFunctionInfo> functionList = externalFunctionInfo.stream().filter(x -> x.getFunctionName().get().equals("abs")).collect(Collectors.toList());
    assertEquals(functionList.size(), 2);
}
Also used : List(java.util.List) StandardTypes(io.prestosql.spi.type.StandardTypes) MysqlExternalFunctionHub(io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Set(java.util.Set) Assert.assertEquals(org.testng.Assert.assertEquals) Assert.assertTrue(org.testng.Assert.assertTrue) Test(org.testng.annotations.Test) ExternalFunctionInfo(io.prestosql.spi.function.ExternalFunctionInfo) Collectors(java.util.stream.Collectors) Assert.assertFalse(org.testng.Assert.assertFalse) MysqlExternalFunctionHub(io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub) ExternalFunctionInfo(io.prestosql.spi.function.ExternalFunctionInfo) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Test(org.testng.annotations.Test)

Example 20 with BaseJdbcConfig

use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.

the class TestMySqlRegisterRemoteUdf method testOverloadFunctions.

// test over load function register
@Test
public void testOverloadFunctions() {
    MysqlExternalFunctionHub externalFunctionHub = new MysqlExternalFunctionHub(new BaseJdbcConfig());
    Set<ExternalFunctionInfo> externalFunctionInfo = externalFunctionHub.getExternalFunctions();
    assertTrue(externalFunctionInfo.size() > 0);
    List<ExternalFunctionInfo> functionList = externalFunctionInfo.stream().filter(x -> x.getFunctionName().get().equals("timestamp")).collect(Collectors.toList());
    assertEquals(functionList.size(), 1);
    ExternalFunctionInfo functionInfo = functionList.get(0);
    List<String> inputArgs = functionInfo.getInputArgs();
    assertEquals(inputArgs.size(), 2);
    assertEquals(inputArgs.get(0), StandardTypes.TIMESTAMP);
    assertEquals(inputArgs.get(1), StandardTypes.TIME);
    assertEquals(functionInfo.getReturnType().get(), StandardTypes.TIMESTAMP);
    assertTrue(functionInfo.isDeterministic());
    assertFalse(functionInfo.isCalledOnNullInput());
}
Also used : List(java.util.List) StandardTypes(io.prestosql.spi.type.StandardTypes) MysqlExternalFunctionHub(io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Set(java.util.Set) Assert.assertEquals(org.testng.Assert.assertEquals) Assert.assertTrue(org.testng.Assert.assertTrue) Test(org.testng.annotations.Test) ExternalFunctionInfo(io.prestosql.spi.function.ExternalFunctionInfo) Collectors(java.util.stream.Collectors) Assert.assertFalse(org.testng.Assert.assertFalse) MysqlExternalFunctionHub(io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub) ExternalFunctionInfo(io.prestosql.spi.function.ExternalFunctionInfo) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) Test(org.testng.annotations.Test)

Aggregations

BaseJdbcConfig (io.prestosql.plugin.jdbc.BaseJdbcConfig)20 Test (org.testng.annotations.Test)17 ConnectorSplitSource (io.prestosql.spi.connector.ConnectorSplitSource)14 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)14 JdbcSplit (io.prestosql.plugin.jdbc.JdbcSplit)6 ConnectorSplit (io.prestosql.spi.connector.ConnectorSplit)6 MysqlExternalFunctionHub (io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub)3 ExternalFunctionInfo (io.prestosql.spi.function.ExternalFunctionInfo)3 StandardTypes (io.prestosql.spi.type.StandardTypes)3 List (java.util.List)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 Assert.assertEquals (org.testng.Assert.assertEquals)3 Assert.assertFalse (org.testng.Assert.assertFalse)3 Assert.assertTrue (org.testng.Assert.assertTrue)3 BaseJdbcClient (io.prestosql.plugin.jdbc.BaseJdbcClient)1 DriverConnectionFactory (io.prestosql.plugin.jdbc.DriverConnectionFactory)1 JdbcClient (io.prestosql.plugin.jdbc.JdbcClient)1 BaseJdbcRowExpressionConverter (io.prestosql.plugin.jdbc.optimization.BaseJdbcRowExpressionConverter)1 TesterParameter (io.prestosql.plugin.jdbc.optimization.TesterParameter)1