Search in sources :

Example 1 with ExtractFunctionModifier

use of org.teiid.translator.jdbc.ExtractFunctionModifier in project teiid by teiid.

the class PostgreSQLExecutionFactory method start.

public void start() throws TranslatorException {
    // TODO: all of the functions (except for convert) can be handled through just the escape syntax
    super.start();
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.LOG10, new AliasModifier("log"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITAND, new AliasModifier("&"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITNOT, new AliasModifier("~"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITOR, new AliasModifier("|"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITXOR, new AliasModifier("#"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("||"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower"));
    registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            List<Object> parts = new ArrayList<Object>();
            // $NON-NLS-1$
            parts.add("substring(");
            parts.add(function.getParameters().get(0));
            // $NON-NLS-1$
            parts.add(" from ");
            Expression index = function.getParameters().get(1);
            if (!(index instanceof Literal)) {
                // $NON-NLS-1$
                parts.add("case sign(");
                parts.add(index);
                // $NON-NLS-1$
                parts.add(") when -1 then length(");
                parts.add(function.getParameters().get(0));
                // $NON-NLS-1$
                parts.add(") + 1 + ");
                parts.add(index);
                // $NON-NLS-1$
                parts.add(" when 0 then 1 else ");
                parts.add(index);
                // $NON-NLS-1$
                parts.add(" end");
            } else {
                parts.add(index);
            }
            if (function.getParameters().size() > 2) {
                // $NON-NLS-1$
                parts.add(" for ");
                parts.add(function.getParameters().get(2));
            }
            // $NON-NLS-1$
            parts.add(")");
            return parts;
        }
    });
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));
    registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.HOUR, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier(INTEGER_TYPE));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));
    registerFunctionModifier(SourceSystemFunctions.QUARTER, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.WEEK, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier(INTEGER_TYPE));
    registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce"));
    registerFunctionModifier(SourceSystemFunctions.PARSETIMESTAMP, parseModifier);
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.FORMATTIMESTAMP, new PostgreSQLFormatFunctionModifier("TO_CHAR(", false));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier("%", getLanguageFactory(), Arrays.asList(TypeFacility.RUNTIME_TYPES.BIG_INTEGER, TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)));
    // specific to 8.2 client or later
    registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier());
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.RAND, new AliasModifier("random"));
    registerFunctionModifier(SourceSystemFunctions.ARRAY_GET, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            return Arrays.asList(function.getParameters().get(0), '[', function.getParameters().get(1), ']');
        }
    });
    registerFunctionModifier(SourceSystemFunctions.ARRAY_LENGTH, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            if (function.getParameters().size() == 1) {
                function.getParameters().add(new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER));
            }
            return null;
        }
    });
    registerFunctionModifier(SourceSystemFunctions.ROUND, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            if (function.getParameters().size() > 1) {
                Expression ex = function.getParameters().get(0);
                if (ex.getType() == TypeFacility.RUNTIME_TYPES.DOUBLE || ex.getType() == TypeFacility.RUNTIME_TYPES.FLOAT) {
                    if (function.getParameters().get(1) instanceof Literal && Integer.valueOf(0).equals(((Literal) function.getParameters().get(1)).getValue())) {
                        function.getParameters().remove(1);
                    } else {
                        // $NON-NLS-1$
                        function.getParameters().set(0, new Function(SourceSystemFunctions.CONVERT, Arrays.asList(ex, new Literal("bigdecimal", TypeFacility.RUNTIME_TYPES.STRING)), TypeFacility.RUNTIME_TYPES.BIG_DECIMAL));
                    }
                }
            }
            return null;
        }
    });
    // add in type conversion
    ConvertModifier convertModifier = new ConvertModifier();
    // $NON-NLS-1$
    convertModifier.addTypeMapping("boolean", FunctionModifier.BOOLEAN);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("smallint", FunctionModifier.BYTE, FunctionModifier.SHORT);
    convertModifier.addTypeMapping(INTEGER_TYPE, FunctionModifier.INTEGER);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("bigint", FunctionModifier.LONG);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("real", FunctionModifier.FLOAT);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("float8", FunctionModifier.DOUBLE);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("numeric(38)", FunctionModifier.BIGINTEGER);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("decimal", FunctionModifier.BIGDECIMAL);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("varchar(4000)", FunctionModifier.STRING);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("date", FunctionModifier.DATE);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("time", FunctionModifier.TIME);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP);
    convertModifier.addConvert(FunctionModifier.BIGDECIMAL, FunctionModifier.BOOLEAN, new NonIntegralNumberToBoolean());
    convertModifier.addConvert(FunctionModifier.FLOAT, FunctionModifier.BOOLEAN, new NonIntegralNumberToBoolean());
    convertModifier.addConvert(FunctionModifier.BIGDECIMAL, FunctionModifier.BOOLEAN, new NonIntegralNumberToBoolean());
    convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.TIMESTAMP, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            // $NON-NLS-1$
            return Arrays.asList(function.getParameters().get(0), " + TIMESTAMP '1970-01-01'");
        }
    });
    convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            // $NON-NLS-1$ //$NON-NLS-2$
            return Arrays.asList("cast(date_trunc('second', ", function.getParameters().get(0), ") AS time)");
        }
    });
    // $NON-NLS-1$ //$NON-NLS-2$
    convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD"));
    // $NON-NLS-1$ //$NON-NLS-2$
    convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "HH24:MI:SS"));
    // $NON-NLS-1$ //$NON-NLS-2$
    convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD HH24:MI:SS.US"));
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            Expression stringValue = function.getParameters().get(0);
            // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            return Arrays.asList("CASE WHEN ", stringValue, " THEN 'true' WHEN not(", stringValue, ") THEN 'false' END");
        }
    });
    convertModifier.addSourceConversion(new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            ((Literal) function.getParameters().get(1)).setValue(INTEGER_TYPE);
            return null;
        }
    }, FunctionModifier.BOOLEAN);
    registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
    // standard function form of several predicates
    // $NON-NLS-1$ //$NON-NLS-2$
    addPushDownFunction(POSTGRESQL, "ilike", BOOLEAN, STRING, STRING).setProperty(SQLStringVisitor.TEIID_NATIVE_QUERY, "($1 ilike $2)");
    // $NON-NLS-1$ //$NON-NLS-2$
    addPushDownFunction(POSTGRESQL, "rlike", BOOLEAN, STRING, STRING).setProperty(SQLStringVisitor.TEIID_NATIVE_QUERY, "($1 ~ $2)");
    // $NON-NLS-1$ //$NON-NLS-2$
    addPushDownFunction(POSTGRESQL, "iregexp", BOOLEAN, STRING, STRING).setProperty(SQLStringVisitor.TEIID_NATIVE_QUERY, "($1 ~* $2)");
}
Also used : ModFunctionModifier(org.teiid.translator.jdbc.ModFunctionModifier) ExtractFunctionModifier(org.teiid.translator.jdbc.ExtractFunctionModifier) EscapeSyntaxModifier(org.teiid.translator.jdbc.EscapeSyntaxModifier) ConvertModifier(org.teiid.translator.jdbc.ConvertModifier) MonthOrDayNameFunctionModifier(org.teiid.translator.jdbc.oracle.MonthOrDayNameFunctionModifier) MonthOrDayNameFunctionModifier(org.teiid.translator.jdbc.oracle.MonthOrDayNameFunctionModifier) LeftOrRightFunctionModifier(org.teiid.translator.jdbc.oracle.LeftOrRightFunctionModifier) FunctionModifier(org.teiid.translator.jdbc.FunctionModifier) OracleFormatFunctionModifier(org.teiid.translator.jdbc.oracle.OracleFormatFunctionModifier) ExtractFunctionModifier(org.teiid.translator.jdbc.ExtractFunctionModifier) ModFunctionModifier(org.teiid.translator.jdbc.ModFunctionModifier) AliasModifier(org.teiid.translator.jdbc.AliasModifier) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with ExtractFunctionModifier

use of org.teiid.translator.jdbc.ExtractFunctionModifier in project teiid by teiid.

the class NetezzaExecutionFactory method start.

public void start() throws TranslatorException {
    super.start();
    // STRING FUNCTION MODIFIERS
    // //////////////////////////////////
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory(), "INSTR", true));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("||"));
    // /NUMERIC FUNCTION MODIFIERS
    // //////////////////////////////////
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CEILING, new AliasModifier("ceil"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.POWER, new AliasModifier("pow"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("LN"));
    // /BIT FUNCTION MODIFIERS
    // //////////////////////////////////
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITAND, new AliasModifier("int4and"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITNOT, new AliasModifier("int4not"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITOR, new AliasModifier("int4or"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.BITXOR, new AliasModifier("int4xor"));
    // DATE FUNCTION MODIFIERS
    // ////////////////////////////////////////
    registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier());
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new ExtractModifier("DOY"));
    registerFunctionModifier(SourceSystemFunctions.QUARTER, new ExtractFunctionModifier());
    registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier());
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractModifier("DAY"));
    registerFunctionModifier(SourceSystemFunctions.WEEK, new ExtractFunctionModifier());
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new ExtractModifier("DOW"));
    registerFunctionModifier(SourceSystemFunctions.HOUR, new ExtractFunctionModifier());
    registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier());
    registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier());
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("CURRENT_DATE"));
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("CURRENT_TIME"));
    // SYSTEM FUNCTIONS
    // //////////////////////////////////
    // $NON-NLS-1$
    registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("NVL"));
    // DATA TYPE CONVERSION
    // /////////////////////////////////////////
    ConvertModifier convertModifier = new ConvertModifier();
    // $NON-NLS-1$
    convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("byteint", FunctionModifier.BYTE);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("smallint", FunctionModifier.SHORT);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("bigint", FunctionModifier.LONG);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("numeric(38)", FunctionModifier.BIGINTEGER);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("numeric(38,18)", FunctionModifier.BIGDECIMAL);
    // $NON-NLS-1$
    convertModifier.addTypeMapping("varchar(4000)", FunctionModifier.STRING);
    // convertModifier.addTypeMapping("nvarchar(5)", FunctionModifier.BOOLEAN);
    // /NO BOOLEAN, INTEGER, FLOAT, DATE, TIME, TIMESTAMP, as they are directly available in netezza
    // /NO NULL, CLOB, BLOB, OBJECT, XML
    // /BOOLEAN--BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, BIGINTEGER, BIGDECIMAL--AS IT DOESN'T WORK IMPLICITLY IN NETEZZA
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.INTEGER, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BYTE, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.SHORT, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.LONG, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.FLOAT, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.DOUBLE, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BIGINTEGER, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BIGDECIMAL, new BooleanToNumericConversionModifier());
    convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new BooleanToStringConversionModifier());
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.BOOLEAN, new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            Expression stringValue = function.getParameters().get(0);
            // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            return Arrays.asList("CASE WHEN ", stringValue, " IN ('false', '0') THEN '0' WHEN ", stringValue, " IS NOT NULL THEN '1' END");
        }
    });
    convertModifier.addTypeConversion(new FunctionModifier() {

        @Override
        public List<?> translate(Function function) {
            Expression stringValue = function.getParameters().get(0);
            // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            return Arrays.asList("CASE WHEN ", stringValue, " = 0 THEN '0' WHEN ", stringValue, " IS NOT NULL THEN '1' END");
        }
    }, FunctionModifier.BOOLEAN);
    // //////STRING TO DATATYPE CONVERSION OTHER THAN DATE/TIME
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.INTEGER, new CastModifier("integer"));
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.FLOAT, new CastModifier("float"));
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DOUBLE, new CastModifier("double"));
    // /// STRING --> CHAR, BYTE, SHORT, LONG, BIGI, BIGD, BOOLEAN is taken care by Type Mapping
    // /// NO conversion support for NULL, CLOB, BLOB, OBJECT, XML
    // //STRING TO DATE/TIME CONVERSION////
    // ////////////////////////////////////
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DATE, new ConvertModifier.FormatModifier("to_date", DATE_FORMAT));
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIME, new ConvertModifier.FormatModifier("to_timestamp", TIME_FORMAT));
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier("to_timestamp", TIMESTAMP_FORMAT));
    // ////DATE/TIME INTERNAL CONVERSION/////////
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new CastModifier("TIME"));
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.DATE, new CastModifier("DATE"));
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP"));
    // convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP")); //TIME --> TIMESTAMP --DOESN't WORK IN NETEZZA-NO FUNCTION SUPPORT
    // //DATE/TIME to STRING CONVERION////
    // ///////////////////////////////////
    // $NON-NLS-1$
    convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", TIMESTAMP_FORMAT));
    // /NO NETEZAA FUNCTION for DATE, TIME to STRING
    convertModifier.setWideningNumericImplicit(true);
    registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
    if (sqlExtensionsInstalled) {
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_extract", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_extract", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_extract", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_extract_all", RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_extract_all", RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_extract_all", RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_extract_all_sp", RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_extract_all_sp", RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_extract_all_sp", RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_extract_sp", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_extract_sp", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_instr", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_instr", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_instr", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_like", RUNTIME_NAMES.BOOLEAN, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_like", RUNTIME_NAMES.BOOLEAN, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_like", RUNTIME_NAMES.BOOLEAN, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_match_count", RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_match_count", RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_match_count", RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_replace", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_replace", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$
        addPushDownFunction("netezza", "regexp_replace", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_replace_sp", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING + "[]");
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_replace_sp", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.INTEGER);
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        addPushDownFunction("netezza", "regexp_replace_sp", RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING, RUNTIME_NAMES.STRING + "[]", RUNTIME_NAMES.INTEGER, RUNTIME_NAMES.STRING);
    }
}
Also used : LocateFunctionModifier(org.teiid.translator.jdbc.LocateFunctionModifier) ExtractFunctionModifier(org.teiid.translator.jdbc.ExtractFunctionModifier) ConvertModifier(org.teiid.translator.jdbc.ConvertModifier) Function(org.teiid.language.Function) Expression(org.teiid.language.Expression) LocateFunctionModifier(org.teiid.translator.jdbc.LocateFunctionModifier) FunctionModifier(org.teiid.translator.jdbc.FunctionModifier) ExtractFunctionModifier(org.teiid.translator.jdbc.ExtractFunctionModifier) AliasModifier(org.teiid.translator.jdbc.AliasModifier) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 AliasModifier (org.teiid.translator.jdbc.AliasModifier)2 ConvertModifier (org.teiid.translator.jdbc.ConvertModifier)2 ExtractFunctionModifier (org.teiid.translator.jdbc.ExtractFunctionModifier)2 FunctionModifier (org.teiid.translator.jdbc.FunctionModifier)2 Expression (org.teiid.language.Expression)1 Function (org.teiid.language.Function)1 EscapeSyntaxModifier (org.teiid.translator.jdbc.EscapeSyntaxModifier)1 LocateFunctionModifier (org.teiid.translator.jdbc.LocateFunctionModifier)1 ModFunctionModifier (org.teiid.translator.jdbc.ModFunctionModifier)1 LeftOrRightFunctionModifier (org.teiid.translator.jdbc.oracle.LeftOrRightFunctionModifier)1 MonthOrDayNameFunctionModifier (org.teiid.translator.jdbc.oracle.MonthOrDayNameFunctionModifier)1 OracleFormatFunctionModifier (org.teiid.translator.jdbc.oracle.OracleFormatFunctionModifier)1