use of org.teiid.translator.jdbc.AliasModifier in project teiid by teiid.
the class HiveExecutionFactory method start.
@Override
public void start() throws TranslatorException {
super.start();
// $NON-NLS-1$
convert.addTypeMapping("tinyint", FunctionModifier.BYTE);
// $NON-NLS-1$
convert.addTypeMapping("smallint", FunctionModifier.SHORT);
// $NON-NLS-1$
convert.addTypeMapping("int", FunctionModifier.INTEGER);
// $NON-NLS-1$
convert.addTypeMapping("bigint", FunctionModifier.BIGINTEGER, FunctionModifier.LONG);
// $NON-NLS-1$
convert.addTypeMapping("boolean", FunctionModifier.BOOLEAN);
// $NON-NLS-1$
convert.addTypeMapping("double", FunctionModifier.DOUBLE);
// $NON-NLS-1$
convert.addTypeMapping("float", FunctionModifier.FLOAT);
// $NON-NLS-1$
convert.addTypeMapping("string", FunctionModifier.STRING);
// $NON-NLS-1$
convert.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP);
// $NON-NLS-1$
convert.addTypeMapping("binary", FunctionModifier.BLOB, FunctionModifier.VARBINARY);
// $NON-NLS-1$
convert.addTypeMapping("decimal", FunctionModifier.BIGDECIMAL);
// $NON-NLS-1$
convert.addTypeMapping("date", FunctionModifier.DATE);
// unsupported types
// FunctionModifier.TIME,
// FunctionModifier.CHAR,
// FunctionModifier.CLOB,
// FunctionModifier.XML
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
// $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.CURDATE, new AliasModifier("unix_timestamp"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce"));
// $NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier("%", getLanguageFactory(), Arrays.asList(TypeFacility.RUNTIME_TYPES.BIG_INTEGER, TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)));
registerFunctionModifier(SourceSystemFunctions.ARRAY_GET, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
return Arrays.asList(function.getParameters().get(0), '[', function.getParameters().get(1), ']');
}
});
// $NON-NLS-1$
addPushDownFunction(HIVE, "lower", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "upper", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "positive", INTEGER, DOUBLE);
// $NON-NLS-1$
addPushDownFunction(HIVE, "positive", DOUBLE, DOUBLE);
// $NON-NLS-1$
addPushDownFunction(HIVE, "negitive", INTEGER, DOUBLE);
// $NON-NLS-1$
addPushDownFunction(HIVE, "negitive", DOUBLE, DOUBLE);
// $NON-NLS-1$
addPushDownFunction(HIVE, "ln", DOUBLE, DOUBLE);
// $NON-NLS-1$
addPushDownFunction(HIVE, "reverse", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "space", INTEGER, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "split", OBJECT, STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "hex", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "unhex", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "bin", STRING, LONG);
// $NON-NLS-1$
addPushDownFunction(HIVE, "day", INTEGER, DATE);
// $NON-NLS-1$
addPushDownFunction(HIVE, "datediff", INTEGER, STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "date_add", INTEGER, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(HIVE, "date_sub", INTEGER, STRING, INTEGER);
// $NON-NLS-1$
addPushDownFunction(HIVE, "from_unixtime", STRING, LONG);
// $NON-NLS-1$
addPushDownFunction(HIVE, "from_unixtime", STRING, LONG, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "unix_timestamp", LONG, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "unix_timestamp", LONG, STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "to_date", STRING, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "from_utc_timestamp", TIMESTAMP, TIMESTAMP, STRING);
// $NON-NLS-1$
addPushDownFunction(HIVE, "to_utc_timestamp", TIMESTAMP, TIMESTAMP, STRING);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LEAD", OBJECT, OBJECT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LEAD", OBJECT, OBJECT, INTEGER);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LEAD", OBJECT, OBJECT, INTEGER, OBJECT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LAG", OBJECT, OBJECT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LAG", OBJECT, OBJECT, INTEGER);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LAG", OBJECT, OBJECT, INTEGER, OBJECT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "FIRST_VALUE", OBJECT, OBJECT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "LAST_VALUE", OBJECT, OBJECT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "PERCENT_RANK", FLOAT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "CUME_DIST", FLOAT);
// $NON-NLS-1$
addAggregatePushDownFunction(HIVE, "NTILE", LONG, INTEGER);
}
Aggregations