use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class PIExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// $NON-NLS-1$
convert.addTypeMapping("Int8", FunctionModifier.BYTE);
// $NON-NLS-1$
convert.addTypeMapping("Int16", FunctionModifier.SHORT);
// $NON-NLS-1$
convert.addTypeMapping("Int32", FunctionModifier.INTEGER);
// $NON-NLS-1$
convert.addTypeMapping("Int64", FunctionModifier.LONG);
// $NON-NLS-1$
convert.addTypeMapping("Single", FunctionModifier.FLOAT);
// $NON-NLS-1$
convert.addTypeMapping("Double", FunctionModifier.DOUBLE);
// $NON-NLS-1$
convert.addTypeMapping("Boolean", FunctionModifier.BOOLEAN);
// $NON-NLS-1$
convert.addTypeMapping("String", FunctionModifier.STRING);
// $NON-NLS-1$
convert.addTypeMapping("DateTime", FunctionModifier.TIMESTAMP);
// $NON-NLS-1$
convert.addTypeMapping("Time", FunctionModifier.TIME);
// $NON-NLS-1$
convert.addTypeMapping("Variant", FunctionModifier.OBJECT);
convert.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$ //$NON-NLS-2$
return Arrays.asList("cast(format(", function.getParameters().get(0), ", 'hh:mm:ss.fff') as Time)");
}
});
convert.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.FLOAT, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$ //$NON-NLS-2$
return Arrays.asList("cast(cast(", function.getParameters().get(0), " as int8) as single)");
}
});
convert.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.DOUBLE, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$ //$NON-NLS-2$
return Arrays.asList("cast(cast(", function.getParameters().get(0), " as int8) as double)");
}
});
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
registerFunctionModifier(SourceSystemFunctions.MOD, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
return // $NON-NLS-1$ //$NON-NLS-2$
Arrays.asList(// $NON-NLS-1$ //$NON-NLS-2$
"cast(", // $NON-NLS-1$ //$NON-NLS-2$
function.getParameters().get(0), // $NON-NLS-1$ //$NON-NLS-2$
" as int64)", // $NON-NLS-1$ //$NON-NLS-2$
"%", "cast(", function.getParameters().get(1), " as int64)");
}
});
// $NON-NLS-1$
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("DAY"));
registerFunctionModifier(SourceSystemFunctions.LOCATE, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
if (function.getParameters().size() <= 2) {
return Arrays.asList("INSTR(", function.getParameters().get(1), ",", function.getParameters().get(0), ")");
}
return Arrays.asList("INSTR(", function.getParameters().get(1), ",", function.getParameters().get(0), ",", function.getParameters().get(2), ")");
}
});
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("LOWER"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("UPPER"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("SUBSTR"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LENGTH, new AliasModifier("LEN"));
// $NON-NLS-1$
addPushDownFunction(PI, "COSH", FLOAT, FLOAT);
// $NON-NLS-1$
addPushDownFunction(PI, "TANH", FLOAT, FLOAT);
// $NON-NLS-1$
addPushDownFunction(PI, "SINH", FLOAT, FLOAT);
// $NON-NLS-1$
addPushDownFunction(PI, "FORMAT", STRING, FLOAT, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "FORMAT", STRING, INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "ParentName", STRING, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(PI, "List", STRING, STRING).setVarArgs(true);
// $NON-NLS-1$
addPushDownFunction(PI, "DIGCODE", INTEGER, STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "DIGSTRING", STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(PI, "PE", STRING, OBJECT);
// $NON-NLS-1$
addPushDownFunction(PI, "ParentName", STRING, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(PI, "VarType", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "UOMID", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "UOMName", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "UOMAbbreviation", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "UOMClassName", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "UOMCanonicallD", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(PI, "UOMConvert", DOUBLE, DOUBLE, STRING, STRING);
// $NON-NLS-1$
FunctionMethod f = addPushDownFunction(PI, "interval", TIMESTAMP, STRING);
// $NON-NLS-1$
f.setProperty(SQLConversionVisitor.TEIID_NATIVE_QUERY, "$1");
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class SAPIQExecutionFactory method start.
public void start() throws TranslatorException {
super.start();
registerFunctionModifier(SourceSystemFunctions.CONCAT, new ConcatFunctionModifier(getLanguageFactory()) {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$
function.setName("||");
return super.translate(function);
}
});
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.CONCAT2, new AliasModifier("STRING"));
registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new EscapeSyntaxModifier());
// $NON-NLS-1$ //$NON-NLS-2$
registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new TemplateFunctionModifier("DATEPART(dy,", 0, ")"));
registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.WEEK, new EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new AddDiffModifier(true, this.getLanguageFactory()).supportsQuarter(true));
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new AddDiffModifier(false, this.getLanguageFactory()).supportsQuarter(true));
registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier(SourceSystemFunctions.COALESCE));
registerFunctionModifier(SourceSystemFunctions.LOCATE, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
List<Expression> params = function.getParameters();
Expression param1 = params.get(0);
Expression param2 = params.set(1, param1);
params.set(0, param2);
return null;
}
});
// add in type conversion
ConvertModifier convertModifier = new ConvertModifier();
convertModifier.setBooleanNullable(booleanNullable());
convertModifier.addNumericBooleanConversions();
// boolean isn't treated as bit, since it doesn't support null
// byte is treated as smallint, since tinyint is unsigned
// $NON-NLS-1$
convertModifier.addTypeMapping("smallint", FunctionModifier.BYTE, FunctionModifier.SHORT);
// $NON-NLS-1$
convertModifier.addTypeMapping("bigint", FunctionModifier.LONG);
// $NON-NLS-1$
convertModifier.addTypeMapping("int", FunctionModifier.INTEGER);
// $NON-NLS-1$
convertModifier.addTypeMapping("double", FunctionModifier.DOUBLE);
// $NON-NLS-1$
convertModifier.addTypeMapping("real", FunctionModifier.FLOAT);
// $NON-NLS-1$
convertModifier.addTypeMapping("numeric(38, 0)", FunctionModifier.BIGINTEGER);
// $NON-NLS-1$
convertModifier.addTypeMapping("numeric(38, 19)", 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("varbinary", FunctionModifier.VARBINARY);
// $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.TIME, FunctionModifier.STRING, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
return convertTimeToString(function);
}
});
convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
return convertDateToString(function);
}
});
convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
return convertTimestampToString(function);
}
});
registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class SQLServerExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
registerFunctionModifier(SourceSystemFunctions.WEEK, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$ //$NON-NLS-2$
return Arrays.asList("DATEPART(ISO_WEEK, ", function.getParameters().get(0), ")");
}
});
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LOCATE, new AliasModifier("CHARINDEX"));
// $NON-NLS-1$ //$NON-NLS-2$
registerFunctionModifier(SourceSystemFunctions.MD5, new TemplateFunctionModifier("HASHBYTES('MD5', ", 0, ")"));
// $NON-NLS-1$ //$NON-NLS-2$
registerFunctionModifier(SourceSystemFunctions.SHA1, new TemplateFunctionModifier("HASHBYTES('SHA1', ", 0, ")"));
// $NON-NLS-1$ //$NON-NLS-2$
registerFunctionModifier(SourceSystemFunctions.SHA2_256, new TemplateFunctionModifier("HASHBYTES('SHA2_256', ", 0, ")"));
// $NON-NLS-1$ //$NON-NLS-2$
registerFunctionModifier(SourceSystemFunctions.SHA2_512, new TemplateFunctionModifier("HASHBYTES('SHA2_512', ", 0, ")"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.UCASE, new UpperLowerFunctionModifier("upper"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LCASE, new UpperLowerFunctionModifier("lower"));
}
use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class MySQLExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITAND, new BitFunctionModifier("&", getLanguageFactory()));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITNOT, new BitFunctionModifier("~", getLanguageFactory()));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITOR, new BitFunctionModifier("|", getLanguageFactory()));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.BITXOR, new BitFunctionModifier("^", getLanguageFactory()));
registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
registerFunctionModifier(SourceSystemFunctions.LPAD, new PadFunctionModifier());
registerFunctionModifier(SourceSystemFunctions.RPAD, new PadFunctionModifier());
// WEEKINYEAR assumes 4.1.1
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.WEEK, new AliasModifier("WEEKOFYEAR"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.ST_ASBINARY, new AliasModifier("AsWKB"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.ST_ASTEXT, new AliasModifier("AsWKT"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.ST_GEOMFROMWKB, new AliasModifier("GeomFromWKB"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.ST_GEOMFROMTEXT, new AliasModifier("GeomFromText"));
// add in type conversion
ConvertModifier convertModifier = new ConvertModifier();
// $NON-NLS-1$
convertModifier.addTypeMapping("signed", FunctionModifier.BOOLEAN, FunctionModifier.BYTE, FunctionModifier.SHORT, FunctionModifier.INTEGER, FunctionModifier.LONG);
// char(n) assume 4.1 or later
// $NON-NLS-1$
convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR);
// $NON-NLS-1$
convertModifier.addTypeMapping("char", FunctionModifier.STRING);
// $NON-NLS-1$
convertModifier.addTypeMapping("date", FunctionModifier.DATE);
// $NON-NLS-1$
convertModifier.addTypeMapping("time", FunctionModifier.TIME);
// $NON-NLS-1$
convertModifier.addTypeMapping("datetime", FunctionModifier.TIMESTAMP);
// $NON-NLS-1$
convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DATE, new ConvertModifier.FormatModifier("DATE"));
// $NON-NLS-1$
convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIME, new ConvertModifier.FormatModifier("TIME"));
// $NON-NLS-1$
convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier("TIMESTAMP"));
// $NON-NLS-1$ //$NON-NLS-2$
convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("date_format", "%Y-%m-%d"));
// $NON-NLS-1$ //$NON-NLS-2$
convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("date_format", "%H:%i:%S"));
// $NON-NLS-1$ //$NON-NLS-2$
convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("date_format", "%Y-%m-%d %H:%i:%S.%f"));
convertModifier.addTypeConversion(new FunctionModifier() {
@Override
public List<?> translate(Function function) {
// $NON-NLS-1$ //$NON-NLS-2$
return Arrays.asList("(", function.getParameters().get(0), " + 0.0)");
}
}, FunctionModifier.BIGDECIMAL, FunctionModifier.BIGINTEGER, FunctionModifier.FLOAT, FunctionModifier.DOUBLE);
convertModifier.addNumericBooleanConversions();
convertModifier.setWideningNumericImplicit(true);
registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
// $NON-NLS-1$ //$NON-NLS-2$
addPushDownFunction("mysql", "SUBSTRING_INDEX", TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.INTEGER);
}
use of org.teiid.translator.jdbc.AliasModifier 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);
}
}
Aggregations