use of io.prestosql.configmanager.DefaultUdfRewriteConfigSupplier in project hetu-core by openlookeng.
the class TestFunctionWriterManagerGroup method setUp.
@BeforeTest
public void setUp() {
String connectorName = "jdbc_connector";
String versionName = "default";
Map<String, FunctionCallRewriter> functionCallRewriterMap = new HashMap<>();
functionCallRewriterMap.put(VarbinaryLiteralFunctionCallRewriterForUt.INNER_FUNC_VARBINARY_LITERAL, new VarbinaryLiteralFunctionCallRewriterForUt());
functionCallRewriterMap.put(UnsupportedFunctionCallRewriterForUt.UNSUPPORTED_FUNCTION_NAME_TEST, new UnsupportedFunctionCallRewriterForUt(connectorName));
DefaultUdfRewriteConfigSupplier defaultUdfRewriteConfigSupplier = new DefaultUdfRewriteConfigSupplier(Test_UDF_REWRITE_PATTERNS);
DefaultConnectorConfigFunctionRewriter defaultConnectorConfigFunctionRewriter = new DefaultConnectorConfigFunctionRewriter(connectorName, defaultUdfRewriteConfigSupplier);
setFunctionWriterManager(connectorName, versionName, functionCallRewriterMap, defaultConnectorConfigFunctionRewriter);
FunctionWriterManager functionWriterManager2 = FunctionWriterManagerGroup.newFunctionWriterManagerInstance(connectorName, versionName, functionCallRewriterMap, defaultConnectorConfigFunctionRewriter);
assertEquals(functionWriterManager1.toString(), functionWriterManager2.toString());
}
use of io.prestosql.configmanager.DefaultUdfRewriteConfigSupplier 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.configmanager.DefaultUdfRewriteConfigSupplier in project hetu-core by openlookeng.
the class ClickHouseRowExpressionConverter method initFunctionManager.
private FunctionWriterManager initFunctionManager(ClickHouseConfig clickHouseConfig) {
ConfigSupplier configSupplier = new DefaultUdfRewriteConfigSupplier(UdfFunctionRewriteConstants.DEFAULT_VERSION_UDF_REWRITE_PATTERNS);
DefaultConnectorConfigFunctionRewriter connectorConfigFunctionRewriter = new DefaultConnectorConfigFunctionRewriter(ClickHouseConstants.CONNECTOR_NAME, configSupplier);
return FunctionWriterManagerGroup.newFunctionWriterManagerInstance(ClickHouseConstants.CONNECTOR_NAME, clickHouseConfig.getClickHouseSqlVersion(), getInjectFunctionCallRewritersDefault(clickHouseConfig), connectorConfigFunctionRewriter);
}
use of io.prestosql.configmanager.DefaultUdfRewriteConfigSupplier in project hetu-core by openlookeng.
the class HanaRowExpressionConverter method initFunctionManager.
private FunctionWriterManager initFunctionManager(HanaConfig hanaConfig) {
// add inner config udf, use the default function result string builder in the HanaConfigUdfRewriter
ConfigSupplier configSupplier = new DefaultUdfRewriteConfigSupplier(UdfFunctionRewriteConstants.DEFAULT_VERSION_UDF_REWRITE_PATTERNS);
DefaultConnectorConfigFunctionRewriter connectorConfigFunctionRewriter = new DefaultConnectorConfigFunctionRewriter(HanaConstants.CONNECTOR_NAME, configSupplier);
// use the default function Signature Builder in the HanaFunctionRewriterManager
return FunctionWriterManagerGroup.newFunctionWriterManagerInstance(HanaConstants.CONNECTOR_NAME, hanaConfig.getHanaSqlVersion(), getInjectFunctionCallRewritersDefault(hanaConfig), connectorConfigFunctionRewriter);
}
Aggregations