use of io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub 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.mysql.optimization.function.MysqlExternalFunctionHub 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);
}
use of io.prestosql.plugin.mysql.optimization.function.MysqlExternalFunctionHub 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());
}
Aggregations