Author: shawkins
Date: 2011-02-23 10:30:32 -0500 (Wed, 23 Feb 2011)
New Revision: 2926
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
Log:
TEIID-247 adding h2 and postgres pushdown support for array functions
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java
===================================================================
---
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java 2011-02-23
01:53:08 UTC (rev 2925)
+++
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/h2/H2ExecutionFactory.java 2011-02-23
15:30:32 UTC (rev 2926)
@@ -165,6 +165,8 @@
supportedFunctions.add(SourceSystemFunctions.CONVERT);
supportedFunctions.add(SourceSystemFunctions.IFNULL);
supportedFunctions.add(SourceSystemFunctions.COALESCE);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_GET);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_LENGTH);
return supportedFunctions;
}
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
===================================================================
---
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2011-02-23
01:53:08 UTC (rev 2925)
+++
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2011-02-23
15:30:32 UTC (rev 2926)
@@ -110,6 +110,24 @@
//specific to 8.2 client or later
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new
EscapeSyntaxModifier());
registerFunctionModifier(SourceSystemFunctions.TIMESTAMPDIFF, new
EscapeSyntaxModifier());
+
+ 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;
+ }
+ });
//add in type conversion
ConvertModifier convertModifier = new ConvertModifier();
@@ -427,6 +445,8 @@
// supportedFunctions.add("USER"); //$NON-NLS-1$ // no
()
// supportedFunctions.add("VERSION"); //$NON-NLS-1$
//
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_GET);
+ supportedFunctions.add(SourceSystemFunctions.ARRAY_LENGTH);
return supportedFunctions;
}
Show replies by date