Author: shawkins
Date: 2009-07-28 14:30:48 -0400 (Tue, 28 Jul 2009)
New Revision: 1197
Modified:
trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java
Log:
TEIID-726 updating the fix and adding a test to ensure the input type is set correctly
Modified:
trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java 2009-07-28
17:58:26 UTC (rev 1196)
+++
trunk/engine/src/main/java/com/metamatrix/query/function/aggregate/NullFilter.java 2009-07-28
18:30:48 UTC (rev 1197)
@@ -42,6 +42,10 @@
this.proxy = proxy;
}
+
+ public AggregateFunction getProxy() {
+ return proxy;
+ }
/**
* @see com.metamatrix.query.function.aggregate.AggregateFunction#initialize(String,
Class)
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java 2009-07-28
17:58:26 UTC (rev 1196)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DuplicateFilter.java 2009-07-28
18:30:48 UTC (rev 1197)
@@ -69,6 +69,10 @@
this.mgr = mgr;
this.groupName = groupName;
}
+
+ public List getElements() {
+ return elements;
+ }
/**
* @see com.metamatrix.query.function.aggregate.AggregateFunction#initialize(String,
Class)
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java 2009-07-28
17:58:26 UTC (rev 1196)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java 2009-07-28
18:30:48 UTC (rev 1197)
@@ -218,14 +218,18 @@
}
functions[i] = new NullFilter(functions[i]);
- outputType = aggSymbol.getType();
+ inputType = aggSymbol.getExpression().getType();
}
} else {
functions[i] = new ConstantFunction();
}
functions[i].initialize(outputType, inputType);
}
- }
+ }
+
+ AggregateFunction[] getFunctions() {
+ return functions;
+ }
public TupleBatch nextBatchDirect()
throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java 2009-07-28
17:58:26 UTC (rev 1196)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestGroupingNode.java 2009-07-28
18:30:48 UTC (rev 1197)
@@ -42,6 +42,8 @@
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.query.function.FunctionDescriptor;
import com.metamatrix.query.function.FunctionLibraryManager;
+import com.metamatrix.query.function.aggregate.AggregateFunction;
+import com.metamatrix.query.function.aggregate.NullFilter;
import com.metamatrix.query.processor.FakeDataManager;
import com.metamatrix.query.processor.FakeTupleSource;
import com.metamatrix.query.sql.symbol.AggregateSymbol;
@@ -173,6 +175,12 @@
};
helpProcess(mgr, node, context, expected);
+
+ //ensure that the distinct input type is correct
+ AggregateFunction[] functions = node.getFunctions();
+ AggregateFunction countDist = functions[5];
+ DuplicateFilter dup = (DuplicateFilter)((NullFilter)countDist).getProxy();
+ assertEquals(DataTypeManager.DefaultDataClasses.INTEGER,
((ElementSymbol)dup.getElements().get(0)).getType());
}
public void test2() throws Exception {
Show replies by date