Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

TEIID-2459 correcting oracl with pushdown

  • Loading branch information...
commit 4c3b4c3c3a1c73fdc921eff48b97af4b4115fb85 1 parent 186a1cd
@shawkins shawkins authored
View
14 ...ranslator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
@@ -605,6 +605,20 @@ public void visit(Like obj) {
}
}
+ @Override
+ public void visit(WithItem obj) {
+ if (obj.getColumns() != null) {
+ List<ColumnReference> cols = obj.getColumns();
+ obj.setColumns(null);
+ Select select = obj.getSubquery().getProjectedQuery();
+ List<DerivedColumn> selectClause = select.getDerivedColumns();
+ for (int i = 0; i < cols.size(); i++) {
+ selectClause.get(i).setAlias(cols.get(i).getName());
+ }
+ }
+ super.visit(obj);
+ }
+
};
}
View
9 .../translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
@@ -1014,5 +1014,14 @@ public void helpTestVisitor(String vdb, String input, String expectedOutput) thr
comp.setRightExpression(new Array(comp.getLeftExpression().getType(), Arrays.asList(comp.getRightExpression(), new Literal(2, TypeFacility.RUNTIME_TYPES.INTEGER))));
TranslationHelper.helpTestVisitor(output, TRANSLATOR, obj);
}
+
+ @Test public void testWith() throws Exception {
+ String input = "with a (col) as (select intkey from bqt1.smallb) select intkey, col from bqt1.smalla, a where intkey = 5"; //$NON-NLS-1$
+ String output = "WITH a AS (SELECT SmallB.IntKey AS col FROM SmallB) SELECT SmallA.IntKey, a.col FROM SmallA, a WHERE SmallA.IntKey = 5"; //$NON-NLS-1$
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null,
+ input, output,
+ TRANSLATOR);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.