Search in sources :

Example 1 with FromBase64CallRewriter

use of io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter in project hetu-core by openlookeng.

the class HanaRowExpressionConverter method getInjectFunctionCallRewritersDefault.

private Map<String, FunctionCallRewriter> getInjectFunctionCallRewritersDefault(HanaConfig hanaConfig) {
    // add the user define function re-writer
    Map<String, FunctionCallRewriter> functionCallRewriters = new HashMap<>(Collections.emptyMap());
    // 1. the base function re-writers all connector can use
    FromBase64CallRewriter fromBase64CallRewriter = new FromBase64CallRewriter();
    functionCallRewriters.put(FromBase64CallRewriter.INNER_FUNC_FROM_BASE64, fromBase64CallRewriter);
    // 2. the specific user define function re-writers
    FunctionCallRewriter varbinaryLiteralFunctionCallRewriter = new VarbinaryLiteralFunctionCallRewriter();
    functionCallRewriters.put(VarbinaryLiteralFunctionCallRewriter.INNER_FUNC_VARBINARY_LITERAL, varbinaryLiteralFunctionCallRewriter);
    FunctionCallRewriter unSupportedFunctionCallRewriter = new HanaUnsupportedFunctionCallRewriter(HanaConstants.CONNECTOR_NAME);
    functionCallRewriters.put(HanaUnsupportedFunctionCallRewriter.INNER_FUNC_INTERVAL_LITERAL_DAY2SEC, unSupportedFunctionCallRewriter);
    functionCallRewriters.put(HanaUnsupportedFunctionCallRewriter.INNER_FUNC_INTERVAL_LITERAL_YEAR2MONTH, unSupportedFunctionCallRewriter);
    functionCallRewriters.put(HanaUnsupportedFunctionCallRewriter.INNER_FUNC_TIME_WITH_TZ_LITERAL, unSupportedFunctionCallRewriter);
    FunctionCallRewriter dateTimeFunctionCallRewriter = new DateTimeFunctionCallRewriter(hanaConfig);
    functionCallRewriters.put(DateTimeFunctionCallRewriter.INNER_FUNC_TIME_LITERAL, dateTimeFunctionCallRewriter);
    functionCallRewriters.put(DateTimeFunctionCallRewriter.INNER_FUNC_TIMESTAMP_LITERAL, dateTimeFunctionCallRewriter);
    FunctionCallRewriter dateAddFunctionCallRewrite = new DateAddFunctionCallRewrite();
    functionCallRewriters.put(DateAddFunctionCallRewrite.BUILD_IN_FUNC_DATE_ADD, dateAddFunctionCallRewrite);
    FunctionCallRewriter buildInDirectMapFunctionCallRewriter = new BuildInDirectMapFunctionCallRewriter();
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUIDLIN_AGGR_FUNC_SUM, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_AVG, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_COUNT, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_MAX, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_MIN, buildInDirectMapFunctionCallRewriter);
    FunctionCallRewriter arrayConstructorCallRewriter = new ArrayConstructorCallRewriter();
    functionCallRewriters.put(ArrayConstructorCallRewriter.INNER_FUNC_ARRAY_CONSTRUCTOR, arrayConstructorCallRewriter);
    return functionCallRewriters;
}
Also used : DateTimeFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.DateTimeFunctionCallRewriter) FunctionCallRewriter(io.prestosql.sql.builder.functioncall.functions.FunctionCallRewriter) BuildInDirectMapFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.BuildInDirectMapFunctionCallRewriter) VarbinaryLiteralFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.VarbinaryLiteralFunctionCallRewriter) HanaUnsupportedFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.HanaUnsupportedFunctionCallRewriter) ArrayConstructorCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.ArrayConstructorCallRewriter) DateTimeFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.DateTimeFunctionCallRewriter) DateAddFunctionCallRewrite(io.hetu.core.plugin.hana.rewrite.functioncall.DateAddFunctionCallRewrite) VarbinaryLiteralFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.VarbinaryLiteralFunctionCallRewriter) HashMap(java.util.HashMap) FromBase64CallRewriter(io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter) HanaUnsupportedFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.HanaUnsupportedFunctionCallRewriter) BuildInDirectMapFunctionCallRewriter(io.hetu.core.plugin.hana.rewrite.functioncall.BuildInDirectMapFunctionCallRewriter)

Example 2 with FromBase64CallRewriter

use of io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter 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)

Example 3 with FromBase64CallRewriter

use of io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter in project hetu-core by openlookeng.

the class ClickHouseRowExpressionConverter method getInjectFunctionCallRewritersDefault.

private Map<String, FunctionCallRewriter> getInjectFunctionCallRewritersDefault(ClickHouseConfig clickHouseConfig) {
    // add the user define function re-writer
    Map<String, FunctionCallRewriter> functionCallRewriters = new HashMap<>(Collections.emptyMap());
    // 1. the base function re-writers all connector can use
    FromBase64CallRewriter fromBase64CallRewriter = new FromBase64CallRewriter();
    functionCallRewriters.put(FromBase64CallRewriter.INNER_FUNC_FROM_BASE64, fromBase64CallRewriter);
    // 2. the specific user define function re-writers
    FunctionCallRewriter unSupportedFunctionCallRewriter = new ClickHouseUnsupportedFunctionCallRewriter(ClickHouseConstants.CONNECTOR_NAME);
    functionCallRewriters.put(ClickHouseUnsupportedFunctionCallRewriter.INNER_FUNC_INTERVAL_LITERAL_DAY2SEC, unSupportedFunctionCallRewriter);
    functionCallRewriters.put(ClickHouseUnsupportedFunctionCallRewriter.INNER_FUNC_INTERVAL_LITERAL_YEAR2MONTH, unSupportedFunctionCallRewriter);
    functionCallRewriters.put(ClickHouseUnsupportedFunctionCallRewriter.INNER_FUNC_TIME_WITH_TZ_LITERAL, unSupportedFunctionCallRewriter);
    FunctionCallRewriter buildInDirectMapFunctionCallRewriter = new BuildInDirectMapFunctionCallRewriter();
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUIDLIN_AGGR_FUNC_SUM, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_AVG, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_COUNT, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_MAX, buildInDirectMapFunctionCallRewriter);
    functionCallRewriters.put(BuildInDirectMapFunctionCallRewriter.BUILDIN_AGGR_FUNC_MIN, buildInDirectMapFunctionCallRewriter);
    FunctionCallRewriter dateParseFunctionCallRewriter = new DateParseFunctionCallRewriter();
    functionCallRewriters.put(DateParseFunctionCallRewriter.BUILD_IN_FUNC_DATE_PARSE, dateParseFunctionCallRewriter);
    return functionCallRewriters;
}
Also used : DateParseFunctionCallRewriter(io.hetu.core.plugin.clickhouse.rewrite.functioncall.DateParseFunctionCallRewriter) FunctionCallRewriter(io.prestosql.sql.builder.functioncall.functions.FunctionCallRewriter) ClickHouseUnsupportedFunctionCallRewriter(io.hetu.core.plugin.clickhouse.rewrite.ClickHouseUnsupportedFunctionCallRewriter) BuildInDirectMapFunctionCallRewriter(io.hetu.core.plugin.clickhouse.rewrite.BuildInDirectMapFunctionCallRewriter) DateParseFunctionCallRewriter(io.hetu.core.plugin.clickhouse.rewrite.functioncall.DateParseFunctionCallRewriter) HashMap(java.util.HashMap) FromBase64CallRewriter(io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter) BuildInDirectMapFunctionCallRewriter(io.hetu.core.plugin.clickhouse.rewrite.BuildInDirectMapFunctionCallRewriter) ClickHouseUnsupportedFunctionCallRewriter(io.hetu.core.plugin.clickhouse.rewrite.ClickHouseUnsupportedFunctionCallRewriter)

Aggregations

FromBase64CallRewriter (io.prestosql.sql.builder.functioncall.functions.base.FromBase64CallRewriter)3 FunctionCallRewriter (io.prestosql.sql.builder.functioncall.functions.FunctionCallRewriter)2 HashMap (java.util.HashMap)2 BuildInDirectMapFunctionCallRewriter (io.hetu.core.plugin.clickhouse.rewrite.BuildInDirectMapFunctionCallRewriter)1 ClickHouseUnsupportedFunctionCallRewriter (io.hetu.core.plugin.clickhouse.rewrite.ClickHouseUnsupportedFunctionCallRewriter)1 DateParseFunctionCallRewriter (io.hetu.core.plugin.clickhouse.rewrite.functioncall.DateParseFunctionCallRewriter)1 ArrayConstructorCallRewriter (io.hetu.core.plugin.hana.rewrite.functioncall.ArrayConstructorCallRewriter)1 BuildInDirectMapFunctionCallRewriter (io.hetu.core.plugin.hana.rewrite.functioncall.BuildInDirectMapFunctionCallRewriter)1 DateAddFunctionCallRewrite (io.hetu.core.plugin.hana.rewrite.functioncall.DateAddFunctionCallRewrite)1 DateTimeFunctionCallRewriter (io.hetu.core.plugin.hana.rewrite.functioncall.DateTimeFunctionCallRewriter)1 HanaUnsupportedFunctionCallRewriter (io.hetu.core.plugin.hana.rewrite.functioncall.HanaUnsupportedFunctionCallRewriter)1 VarbinaryLiteralFunctionCallRewriter (io.hetu.core.plugin.hana.rewrite.functioncall.VarbinaryLiteralFunctionCallRewriter)1 QualifiedName (io.prestosql.spi.sql.expression.QualifiedName)1 FunctionCallArgsPackage (io.prestosql.sql.builder.functioncall.FunctionCallArgsPackage)1 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1