Skip to content

Commit

Permalink
TEIID-5479 correcting aggregate pushdown metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Sep 18, 2018
1 parent 283c773 commit a4fd289
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1290,8 +1290,8 @@ public void testGeometryInsertQueryExpression() throws Exception {
@Test public void testListAgg() throws Exception {
TRANSLATOR.setDatabaseVersion("12.0");
TRANSLATOR.initCapabilities(null);
String input = "SELECT listagg(stringkey), listagg(stringkey, ';' order by intkey) FROM BQT1.SmallA";
String output = "SELECT listagg(SmallA.StringKey), listagg(SmallA.StringKey, ';') WITHIN GROUP (ORDER BY SmallA.IntKey) FROM SmallA"; //$NON-NLS-1$
String input = "SELECT listagg(stringkey), oracle.listagg(stringkey, ';' order by intkey) FROM BQT1.SmallA";
String output = "SELECT LISTAGG(SmallA.StringKey), LISTAGG(SmallA.StringKey, ';') WITHIN GROUP (ORDER BY SmallA.IntKey) FROM SmallA"; //$NON-NLS-1$
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,16 +880,21 @@ AggregateFunction translate(AggregateSymbol symbol) {
params.add(translate(expression));
}
String name = symbol.getAggregateFunction().name();
if (symbol.getAggregateFunction() == AggregateSymbol.Type.USER_DEFINED) {
name = symbol.getName();
}

AggregateFunction af = new AggregateFunction(name,
if (symbol.getFunctionDescriptor() != null) {
name = Symbol.getShortName(symbol.getFunctionDescriptor().getName());
} else if (symbol.getAggregateFunction() == AggregateSymbol.Type.USER_DEFINED) {
name = symbol.getName();
}

AggregateFunction af = new AggregateFunction(name,
symbol.isDistinct(),
params,
symbol.getType());
af.setCondition(translate(symbol.getCondition()));
af.setOrderBy(translate(symbol.getOrderBy(), false));
af.setCondition(translate(symbol.getCondition()));
af.setOrderBy(translate(symbol.getOrderBy(), false));
if (symbol.getFunctionDescriptor() != null) {
af.setMetadataObject(symbol.getFunctionDescriptor().getMethod());
}
return af;
}

Expand Down

0 comments on commit a4fd289

Please sign in to comment.