use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.
the class TestMySqlRegisterRemoteUdf method testDefaults.
@Test
public void testDefaults() {
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("lower")).collect(Collectors.toList());
assertEquals(functionList.size(), 1);
ExternalFunctionInfo functionInfo = functionList.get(0);
assertEquals(functionInfo.getInputArgs().get(0), StandardTypes.VARCHAR);
assertEquals(functionInfo.getReturnType().get(), StandardTypes.VARCHAR);
assertTrue(functionInfo.isDeterministic());
assertFalse(functionInfo.isCalledOnNullInput());
}
use of io.prestosql.plugin.jdbc.BaseJdbcConfig in project hetu-core by openlookeng.
the class TestJdbcPlanOptimizer method getOptimizedPlan.
private PlanNode getOptimizedPlan(PlanBuilder planBuilder, PlanNode originalPlan) {
BaseJdbcConfig config = new BaseJdbcConfig();
JdbcClient client = new TestPushwonClient();
TesterParameter testerParameter = TesterParameter.getTesterParameter();
JdbcPlanOptimizer optimizer = new JdbcPlanOptimizer(client, new TestTypeManager(), config, testerParameter.getRowExpressionService(), testerParameter.getDeterminismEvaluator(), testerParameter.getMetadata().getFunctionAndTypeManager(), testerParameter.getFunctionResolution());
return optimizer.optimize(originalPlan, defaultSessionHolder.getConnectorSession(), ImmutableMap.<String, Type>builder().put("regionid", INTEGER).put("city", VARCHAR).put("fare", DOUBLE).put("amount", BIGINT).build(), new PlanSymbolAllocator(), planBuilder.getIdAllocator());
}
use of io.prestosql.plugin.jdbc.BaseJdbcConfig 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.plugin.jdbc.BaseJdbcConfig 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.plugin.jdbc.BaseJdbcConfig 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);
}
Aggregations