teiid SVN: r4597 - in branches/7.7.x/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2013-09-26 15:07:45 -0400 (Thu, 26 Sep 2013)
New Revision: 4597
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
Log:
TEIID-1560: (partial) modified instanceof check in FrameUtil
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java 2013-09-23 20:26:19 UTC (rev 4596)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/FrameUtil.java 2013-09-26 19:07:45 UTC (rev 4597)
@@ -311,7 +311,7 @@
return expression;
}
- if(expression instanceof SingleElementSymbol) {
+ if(expression instanceof Expression) {
Expression mappedSymbol = (Expression) symbolMap.get(expression);
if (mappedSymbol != null) {
return mappedSymbol;
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2013-09-23 20:26:19 UTC (rev 4596)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2013-09-26 19:07:45 UTC (rev 4597)
@@ -37,6 +37,7 @@
import org.teiid.query.optimizer.TestAggregatePushdown;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.unittest.RealMetadataFactory;
@@ -469,5 +470,26 @@
ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
+
+
+ @Test public void testAggregatePushdownWithFunction() throws Exception {
+ String sql = "select count(x.e2), nvl(x.e1, '') from pm1.g1 x makedep, pm2.g2 where x.e3 = pm2.g2.e3 group by nvl(x.e1, '')"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList(1, "a"),
+ };
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("SELECT g_0.e3 AS c_0 FROM pm2.g2 AS g_0 ORDER BY c_0", new List[] {
+ Arrays.asList(1.0),
+ });
+ dataManager.addData("SELECT v_0.c_2, v_0.c_1, COUNT(v_0.c_0) FROM (SELECT g_0.e2 AS c_0, ifnull(g_0.e1, '') AS c_1, g_0.e3 AS c_2 FROM pm1.g1 AS g_0 WHERE g_0.e3 IN (<dependent values>)) AS v_0 GROUP BY v_0.c_2, v_0.c_1", new List[] {
+ Arrays.asList(1.0, "a", 1)
+ });
+ BasicSourceCapabilities capabilities = TestAggregatePushdown.getAggregateCapabilities();
+ capabilities.setFunctionSupport("ifnull", true);
+ CommandContext cc = createCommandContext();
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(capabilities), cc);
+ helpProcess(plan, cc, dataManager, expected);
+ }
}