use of io.prestosql.spi.sql.expression.QualifiedName 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)");
}
use of io.prestosql.spi.sql.expression.QualifiedName 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");
}
use of io.prestosql.spi.sql.expression.QualifiedName in project hetu-core by openlookeng.
the class TestBaseFunctionUtil method testFormatQualifiedName.
@Test
public void testFormatQualifiedName() {
List<String> argsList = new ArrayList<>();
argsList.add("var1");
argsList.add("var2");
QualifiedName qualifiedName = new QualifiedName(argsList);
assertEquals(BaseFunctionUtil.formatQualifiedName(qualifiedName), "var1.var2");
}
use of io.prestosql.spi.sql.expression.QualifiedName in project hetu-core by openlookeng.
the class TestConfigFunctionParser method testConfigFunctionParser.
@Test
public void testConfigFunctionParser() {
String functionName = "LOG10";
List<String> functionList = new ArrayList<>();
functionList.add(functionName);
List<String> argsList = new ArrayList<>();
argsList.add("var1");
FunctionCallArgsPackage functionCallArgsPackage = new FunctionCallArgsPackage(new QualifiedName(functionList), false, argsList, Optional.empty(), Optional.empty(), Optional.empty());
String configPropertyName = ConfigFunctionParser.baseFunctionArgsToConfigPropertyName(functionCallArgsPackage);
assertEquals(ConfigFunctionParser.baseConfigPropertyValueToFunctionPushDownString(functionCallArgsPackage, UdfPropertiesConstants.Test_UDF_REWRITE_PATTERNS.get(configPropertyName)), "LOG(10, var1)");
}
use of io.prestosql.spi.sql.expression.QualifiedName in project hetu-core by openlookeng.
the class TestFunctionWriterManagerGroup method testFunctionWriterManagerUnsupportedFunctions.
@Test
public void testFunctionWriterManagerUnsupportedFunctions() {
String functionName = "LO10";
List<String> functionList = new ArrayList<>();
functionList.add(functionName);
List<String> argsList = new ArrayList<>();
argsList.add("var1");
try {
functionWriterManager1.getFunctionRewriteResult(new QualifiedName(functionList), false, argsList, Optional.empty(), Optional.empty(), Optional.empty());
} catch (UnsupportedOperationException exception) {
assertEquals(exception.getMessage(), "jdbc_connector Connector does not support function call of LO10");
}
}
Aggregations