Search in sources :

Example 1 with FunctionCallArgsPackage

use of io.prestosql.sql.builder.functioncall.FunctionCallArgsPackage in project hetu-core by openlookeng.

the class TestDefaultConnectorConfigFunctionRewriter method testDefaultConnectorConfigFunctionRewriter.

@Test
public void testDefaultConnectorConfigFunctionRewriter() {
    List<String> functionName = new ArrayList<>();
    functionName.add("CORR");
    List<String> argsList = new ArrayList<>();
    argsList.add("var1");
    argsList.add("var2");
    FunctionCallArgsPackage functionCallArgsPackage = new FunctionCallArgsPackage(new QualifiedName(functionName), false, argsList, Optional.empty(), Optional.empty(), Optional.empty());
    String connectorName = "jdbc_connector";
    DefaultUdfRewriteConfigSupplier defaultUdfRewriteConfigSupplier = new DefaultUdfRewriteConfigSupplier(Test_UDF_REWRITE_PATTERNS);
    DefaultConnectorConfigFunctionRewriter defaultConnectorConfigFunctionRewriter = new DefaultConnectorConfigFunctionRewriter(connectorName, defaultUdfRewriteConfigSupplier);
    assertEquals(defaultConnectorConfigFunctionRewriter.rewriteFunctionCall(functionCallArgsPackage), "CORR(var1, var2)");
}
Also used : QualifiedName(io.prestosql.spi.sql.expression.QualifiedName) ArrayList(java.util.ArrayList) DefaultConnectorConfigFunctionRewriter(io.prestosql.sql.builder.functioncall.functions.config.DefaultConnectorConfigFunctionRewriter) DefaultUdfRewriteConfigSupplier(io.prestosql.configmanager.DefaultUdfRewriteConfigSupplier) FunctionCallArgsPackage(io.prestosql.sql.builder.functioncall.FunctionCallArgsPackage) Test(org.testng.annotations.Test)

Example 2 with FunctionCallArgsPackage

use of io.prestosql.sql.builder.functioncall.FunctionCallArgsPackage in project hetu-core by openlookeng.

the class TestFromBase64CallRewriter method testFromBase64CallRewriter.

@Test
public void testFromBase64CallRewriter() {
    List<String> list = new ArrayList<>();
    list.add("'12A69797965458999E'");
    FunctionCallArgsPackage functionCallArgsPackage = new FunctionCallArgsPackage(new QualifiedName(Collections.emptyList()), false, list, Optional.empty(), Optional.empty(), Optional.empty());
    FromBase64CallRewriter fromBase64CallRewriter = new FromBase64CallRewriter();
    assertEquals(fromBase64CallRewriter.rewriteFunctionCall(functionCallArgsPackage), "D7603AF7BF7BF7AE78E7CF7DF4");
}
Also used : FromBase64CallRewriter(io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter) QualifiedName(io.prestosql.spi.sql.expression.QualifiedName) ArrayList(java.util.ArrayList) FunctionCallArgsPackage(io.prestosql.sql.builder.functioncall.FunctionCallArgsPackage) Test(org.testng.annotations.Test)

Aggregations

QualifiedName (io.prestosql.spi.sql.expression.QualifiedName)2 FunctionCallArgsPackage (io.prestosql.sql.builder.functioncall.FunctionCallArgsPackage)2 ArrayList (java.util.ArrayList)2 Test (org.testng.annotations.Test)2 DefaultUdfRewriteConfigSupplier (io.prestosql.configmanager.DefaultUdfRewriteConfigSupplier)1 FromBase64CallRewriter (io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter)1 DefaultConnectorConfigFunctionRewriter (io.prestosql.sql.builder.functioncall.functions.config.DefaultConnectorConfigFunctionRewriter)1