Author: shawkins
Date: 2009-10-26 21:18:06 -0400 (Mon, 26 Oct 2009)
New Revision: 1543
Added:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
Removed:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/capabilities/
Modified:
trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
trunk/engine/src/test/java/com/metamatrix/common/buffer/impl/TestBufferManagerImpl.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestExpressionsInGroupBy.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestJoinOptimization.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleMergeVirtual.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleRaiseNull.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/capabilities/FakeCapabilitiesFinder.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCapabilitiesUtil.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestSetProcessing.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
Log:
TEIID-203 correctly implementing the check for supportsSelectExpression. also merging
Connector and Shared capabilities finders, and removing TypeRetrievalUtil
Modified: trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties 2009-10-27 01:16:42
UTC (rev 1542)
+++ trunk/engine/src/main/resources/com/metamatrix/dqp/i18n.properties 2009-10-27 01:18:06
UTC (rev 1543)
@@ -502,4 +502,35 @@
TransformationMetadata.No_metadata_info_available_for_the_index_with_UUID_{0}._1=No
metadata info available for the index with UUID {0}.
TransformationMetadata.Ambigous_index_with_UUID_{0},_found_multiple_indexes_with_the_given_UUID._2=Ambigous
index with UUID {0}, found multiple indexes with the given UUID.
TransformationMetadata.Invalid_type=Invalid type: {0}.
+TransformationMetadata.Unable_to_determine_fullname_for_element__1=Unable to determine
fullname for element
+TransformationMetadata.does_not_exist._1=does not exist.
+TransformationMetadata.0={0} ambiguous, more than one entity matching the same name
+TransformationMetadata.Group(0}_does_not_have_elements=Group ''{0}'' does
not have any elements.
+TransformationMetadata.Error_trying_to_read_virtual_document_{0},_with_body__n{1}_1=Error
trying to read virtual document {0}, with body \n{1}
+TransformationMetadata.Unknown_support_constant___12=Unknown support constant:
+TransformationMetadata.error_intialize_selector=Error trying to initialize the index
selector.
+TransformationMetadata.Error_trying_to_obtain_index_file_using_IndexSelector_1=Error
trying to obtain index file using IndexSelector {0}
+TransformationMetadata.Model_name_ambiguous,more_than_one_model_exist_with_the_name__2=Model
name ambiguous, more than one model exists with the name
+TransformationMetadata.The_metadataID_passed_does_not_match_a_index_record._1=The
metadataID passed does not match an index record
+TransformationMetadata.Expected_id_of_the_type_key_record_as_the_argument_2=Expected ID
of the type key record as the argument
+TransformationMetadata.Expected_id_of_the_type_accesspattern_record_as_the_argument_3=Expected
ID of the type accesspattern record as the argument
+TransformationMetadata.No_known_index_file_type_associated_with_the_recordType_1=No known
index file type associated with the recordType
+TransformationMetadata.GroupID_ambiguous_there_are_multiple_virtual_plans_available_for_this_groupID__1=GroupID
ambiguous, there are multiple virtual plans available for this groupID
+TransformationMetadata.GroupID_ambiguous_there_are_multiple_insert_plans_available_for_this_groupID__2=GroupID
ambiguous, there are multiple insert plans available for this groupID
+TransformationMetadata.GroupID_ambiguous_there_are_multiple_update_plans_available_for_this_groupID__3=GroupID
ambiguous, there are multiple update plans available for this groupID
+TransformationMetadata.GroupID_ambiguous_there_are_multiple_delete_plans_available_for_this_groupID__4=GroupID
ambiguous, there are multiple delete plans available for this groupID
+TransformationMetadata.Failed_to_create_index_files_for_non-indexed_model_resources__1=Failed
to create index files for non-indexed model resources :
+TransformationMetadata.Procedure_ambiguous_there_are_multiple_procedure_plans_available_for_this_name___4=Procedure
ambiguous, there are multiple procedure plans available for this name:
+TransformationMetadata.Could_not_find_query_plan_for_the_group__5=Could not find query
plan for the group
+TransformationMetadata.QueryPlan_could_not_be_found_for_physical_group__6=QueryPlan could
not be found for physical group
+TransformationMetadata.InsertPlan_could_not_be_found_for_physical_group__8=InsertPlan
could not be found for physical group
+TransformationMetadata.InsertPlan_could_not_be_found_for_physical_group__10=InsertPlan
could not be found for physical group
+TransformationMetadata.DeletePlan_could_not_be_found_for_physical_group__12=DeletePlan
could not be found for physical group
+TransformationMetadata.Could_not_find_transformation_record_for_the_group__1=Could not
find transformation record for the group
+TransformationMetadata.Error_trying_to_read_schemas_for_the_document/table____1=Error
trying to read schemas for the document/table :
+TransformationMetadata.Multiple_transformation_records_found_for_the_group___1=Multiple
transformation records found for the group:
+TransformationMetadata.Multiple_annotation_records_found_for_the_entity_{0}_1=Multiple
annotation records found for the entity {0}
+TransformationMetadata.No_metadata_info_available_for_the_index_with_UUID_{0}._1=No
metadata info available for the index with UUID {0}.
+TransformationMetadata.Ambigous_index_with_UUID_{0},_found_multiple_indexes_with_the_given_UUID._2=Ambigous
index with UUID {0}, found multiple indexes with the given UUID.
+TransformationMetadata.Invalid_type=Invalid type: {0}.
TransformationMetadata.Unable_to_determine_fullname_for_element__1=Unable to determine
fullname for element
\ No newline at end of file
Modified:
trunk/engine/src/test/java/com/metamatrix/common/buffer/impl/TestBufferManagerImpl.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/common/buffer/impl/TestBufferManagerImpl.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/common/buffer/impl/TestBufferManagerImpl.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -30,6 +30,7 @@
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.Random;
@@ -58,6 +59,7 @@
import com.metamatrix.common.types.SQLXMLImpl;
import com.metamatrix.common.types.XMLType;
import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
/**
*/
@@ -87,11 +89,10 @@
List expectedRows = new ArrayList();
- List schema = new ArrayList();
- schema.add("col"); //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.STRING};
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("col")); //$NON-NLS-1$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.STRING);
- TupleSourceID tsID = mgr.createTupleSource(schema, schemaTypes, null,
TupleSourceType.PROCESSOR);
+ TupleSourceID tsID = mgr.createTupleSource(schema, null,
TupleSourceType.PROCESSOR);
long batchSize = -1;
for(int b=0; b<numBatches; b++) {
@@ -211,9 +212,10 @@
XMLType xml1 = new XMLType(new SQLXMLImpl("<foo/>"));
//$NON-NLS-1$
XMLType xml2 = new XMLType(new SQLXMLImpl("<bar/>"));
//$NON-NLS-1$
- List schema = new ArrayList();
- schema.add("xml"); //$NON-NLS-1$
- final TupleSourceID id = mgr.createTupleSource(schema, new String[]
{DataTypeManager.DefaultDataTypes.XML}, "GROUP1", TupleSourceType.PROCESSOR);
//$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("col")); //$NON-NLS-1$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.XML);
+
+ final TupleSourceID id = mgr.createTupleSource(schema, "GROUP1",
TupleSourceType.PROCESSOR); //$NON-NLS-1$
List xmlList1 = new ArrayList();
xmlList1.add(xml1);
@@ -232,7 +234,7 @@
assertNotNull(mgr.getStreamable(id, xml1.getReferenceStreamId()));
- final TupleSourceID id1 = mgr.createTupleSource(schema, new String[]
{DataTypeManager.DefaultDataTypes.XML}, "GROUP1", TupleSourceType.PROCESSOR);
//$NON-NLS-1$
+ final TupleSourceID id1 = mgr.createTupleSource(schema, "GROUP1",
TupleSourceType.PROCESSOR); //$NON-NLS-1$
TupleBatch batch1 = new TupleBatch(1, new List[] {xmlList1, xmlList2});
mgr.addTupleBatch(id1, batch1);
@@ -246,9 +248,10 @@
final BufferManager mgr = getTestBufferManager(1,
createFakeDatabaseStorageManager());
// save the lob
- List schema = new ArrayList();
- schema.add("xml"); //$NON-NLS-1$
- final TupleSourceID id = mgr.createTupleSource(schema, new String[]
{DataTypeManager.DefaultDataTypes.XML}, "GROUP1", TupleSourceType.PROCESSOR);
//$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("col")); //$NON-NLS-1$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.XML);
+
+ final TupleSourceID id = mgr.createTupleSource(schema, "GROUP1",
TupleSourceType.PROCESSOR); //$NON-NLS-1$
ByteLobChunkStream stream = new ByteLobChunkStream(new
FileInputStream(UnitTestUtil.getTestDataPath()+"/LicenseMappingExample.xml"),
11); //$NON-NLS-1$
int i = 1;
@@ -306,12 +309,11 @@
@Test public void testPinning1() throws Exception {
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
String group = "test"; //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.STRING};
- TupleSourceID tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ TupleSourceID tsID = mgr.createTupleSource(schema, group,
TupleSourceType.PROCESSOR);
// Add some batches, 1000 at a time
int maxRows = 4000;
@@ -337,12 +339,12 @@
@Test public void testUnpinOfUnpinnedBatch() throws Exception {
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test"; //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.STRING};
- TupleSourceID tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ TupleSourceID tsID = mgr.createTupleSource(schema, group,
TupleSourceType.PROCESSOR);
// Add some batches, 1000 at a time
int maxRows = 4000;
@@ -399,9 +401,9 @@
@Test public void testDeadlockOnMultiThreadClean() throws Exception {
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.STRING};
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("col")); //$NON-NLS-1$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test"; //$NON-NLS-1$
int count = 20;
int pins = 50;
@@ -414,7 +416,7 @@
// Setup
for(int t=0; t<count; t++) {
- ids[t] = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ ids[t] = mgr.createTupleSource(schema, group, TupleSourceType.PROCESSOR);
for(int i=1; i<(batches*rowsPerBatch); i=i+rowsPerBatch) {
mgr.addTupleBatch(ids[t], exampleBigBatch(i, i+rowsPerBatch-1,
rowSize));
}
@@ -437,12 +439,12 @@
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
TupleSourceID tsID = null;
try {
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test"; //$NON-NLS-1$
- String[] schemaTypes = new String[]
{DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING};
- tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ tsID = mgr.createTupleSource(schema, group, TupleSourceType.PROCESSOR);
// Add some batches, 1000 at a time
int maxRows = 10000;
@@ -476,11 +478,10 @@
*/
@Test public void testDefect_18499() throws Exception {
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
- List schema = new ArrayList();
- schema.add("col"); //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.STRING};
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("col")); //$NON-NLS-1$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.STRING);
- TupleSourceID tsID = mgr.createTupleSource(schema, schemaTypes, null,
TupleSourceType.PROCESSOR);
+ TupleSourceID tsID = mgr.createTupleSource(schema, null,
TupleSourceType.PROCESSOR);
mgr.addTupleBatch(tsID, exampleBigBatch(1, 1000, 512));
mgr.setStatus(tsID, TupleSourceStatus.FULL);
TupleSource ts = mgr.getTupleSource(tsID);
@@ -499,12 +500,12 @@
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
TupleSourceID tsID = null;
try {
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test"; //$NON-NLS-1$
- String[] schemaTypes = new String[]
{DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING};
- tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ tsID = mgr.createTupleSource(schema, group, TupleSourceType.PROCESSOR);
// Add some batches, 1000 at a time
int maxRows = 10000;
@@ -527,20 +528,16 @@
@Test public void testDefect19325() throws Exception{
BufferManagerImpl mgr = (BufferManagerImpl)getTestBufferManager(1,
createFakeDatabaseStorageManager());
TupleSourceID tsID = null;
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test1"; //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.STRING};
- tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ tsID = mgr.createTupleSource(schema, group, TupleSourceType.PROCESSOR);
TupleSourceID tsID2 = null;
- schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
group = "test2"; //$NON-NLS-1$
- schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.STRING};
- tsID2 = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ tsID2 = mgr.createTupleSource(schema, group, TupleSourceType.PROCESSOR);
// Add some batches, 1000 at a time
int maxRows = 50000;
@@ -564,12 +561,12 @@
BufferManager mgr = getTestBufferManager(50,
createFakeDatabaseStorageManager());
TupleSourceID tsID = null;
try {
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test"; //$NON-NLS-1$
- String[] schemaTypes = new String[]
{DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING};
- tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ tsID = mgr.createTupleSource(schema, group, TupleSourceType.PROCESSOR);
// Add some batches
int maxRows = 10000;
@@ -597,12 +594,12 @@
@Test public void testPinning2() throws Exception {
BufferManager mgr = getTestBufferManager(1, createFakeDatabaseStorageManager());
- List schema = new ArrayList();
- schema.add("val"); //$NON-NLS-1$
- schema.add("col"); //$NON-NLS-1$
+ List<ElementSymbol> schema = Arrays.asList(new
ElementSymbol("val"), new ElementSymbol("col")); //$NON-NLS-1$
//$NON-NLS-2$
+ schema.get(0).setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ schema.get(1).setType(DataTypeManager.DefaultDataClasses.STRING);
+
String group = "test"; //$NON-NLS-1$
- String[] schemaTypes = new String[] {DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.STRING};
- TupleSourceID tsID = mgr.createTupleSource(schema, schemaTypes, group,
TupleSourceType.PROCESSOR);
+ TupleSourceID tsID = mgr.createTupleSource(schema, group,
TupleSourceType.PROCESSOR);
// Add some batches, 1000 at a time
int maxRows = 4000;
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -28,6 +28,8 @@
import com.metamatrix.query.optimizer.TestOptimizer.ComparisonMode;
import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
+import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
import com.metamatrix.query.processor.ProcessorPlan;
@@ -50,13 +52,8 @@
return caps;
}
- private FakeCapabilitiesFinder getAggregatesFinder() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = getAggregateCapabilities();
- capFinder.addCapabilities("m1", caps); //$NON-NLS-1$
- capFinder.addCapabilities("m2", caps); //$NON-NLS-1$
-
- return capFinder;
+ public static CapabilitiesFinder getAggregatesFinder() {
+ return new DefaultCapabilitiesFinder(getAggregateCapabilities());
}
@Test public void testCase6327() {
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestExpressionsInGroupBy.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestExpressionsInGroupBy.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestExpressionsInGroupBy.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -46,10 +46,10 @@
// Create capabilities
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
- caps.setCapabilitySupport(Capability.QUERY_FUNCTIONS_IN_GROUP_BY, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
@@ -70,10 +70,10 @@
// Create capabilities
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
- caps.setCapabilitySupport(Capability.QUERY_FUNCTIONS_IN_GROUP_BY, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
@@ -222,6 +222,7 @@
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_CASE, true);
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestJoinOptimization.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestJoinOptimization.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestJoinOptimization.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -407,24 +407,9 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla
left outer join bqt2.smalla on (bqt1.smalla.stringkey = bqt2.smalla.intkey and
bqt2.smalla.intkey = null)"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM
bqt1.smalla"}); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey,
null FROM bqt1.smalla"}); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // Join
- 0, // MergeJoin
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testPushMultiGroupJoinCriteria() throws Exception {
@@ -884,6 +869,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -49,7 +49,6 @@
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
-import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
import com.metamatrix.query.optimizer.relational.AliasGenerator;
import com.metamatrix.query.optimizer.relational.rules.CapabilitiesUtil;
@@ -130,6 +129,7 @@
public static BasicSourceCapabilities getTypicalCapabilities() {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER_FULL, true);
@@ -157,12 +157,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, false);
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, false);
}
- CapabilitiesFinder finder = new CapabilitiesFinder() {
- public SourceCapabilities findCapabilities(String modelName) throws
MetaMatrixComponentException {
- return caps;
- }
- };
- return finder;
+ return new DefaultCapabilitiesFinder(caps);
}
public static CapabilitiesFinder getGenericFinder() {
@@ -953,16 +948,16 @@
public void testPushCriteriaThroughUnion11() {
helpPlan("select * from vm1.u8 where const = 's3' or e1 is
null", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM pm1.g3", //$NON-NLS-1$
- "SELECT e1 FROM pm1.g2 WHERE e1 IS NULL",
//$NON-NLS-1$
- "SELECT e1 FROM pm1.g1 WHERE e1 IS NULL" } );
//$NON-NLS-1$
+ new String[] { "SELECT 's3', e1 FROM pm1.g3",
//$NON-NLS-1$
+ "SELECT 's2', e1 FROM pm1.g2 WHERE e1 IS
NULL", //$NON-NLS-1$
+ "SELECT 's1', e1 FROM pm1.g1 WHERE e1 IS
NULL" } ); //$NON-NLS-1$
}
public void testPushCriteriaThroughUnion12() {
helpPlan("select * from vm1.u8 where const = 's1' or e1 is
null", example1(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM pm1.g3 WHERE e1 IS NULL",
//$NON-NLS-1$
- "SELECT e1 FROM pm1.g2 WHERE e1 IS NULL",
//$NON-NLS-1$
- "SELECT e1 FROM pm1.g1" } ); //$NON-NLS-1$
+ new String[] { "SELECT 's3', e1 FROM pm1.g3 WHERE e1 IS
NULL", //$NON-NLS-1$
+ "SELECT 's2', e1 FROM pm1.g2 WHERE e1 IS
NULL", //$NON-NLS-1$
+ "SELECT 's1', e1 FROM pm1.g1" } );
//$NON-NLS-1$
}
/** defect #4997 */
@@ -2382,7 +2377,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2401,9 +2396,10 @@
public void testPushFunctionInSelect1() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2422,9 +2418,10 @@
public void testPushFunctionInSelect2() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2444,8 +2441,8 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, false); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2479,9 +2476,10 @@
public void testPushFunctionInSelect4() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2500,9 +2498,10 @@
public void testPushFunctionInSelect5() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2556,10 +2555,11 @@
public void testPushFunctionInSelectWithOrderBy1() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2579,10 +2579,11 @@
public void testPushFunctionInSelectWithOrderBy1a() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2602,10 +2603,11 @@
public void testPushFunctionInSelectWithOrderBy2() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
- caps.setFunctionSupport(SourceSystemFunctions.LCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.LCASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
@@ -2626,7 +2628,7 @@
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -2648,7 +2650,7 @@
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -2686,7 +2688,7 @@
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
- caps.setFunctionSupport(SourceSystemFunctions.UCASE, true); //$NON-NLS-1$
+ caps.setFunctionSupport(SourceSystemFunctions.UCASE, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -2722,6 +2724,7 @@
public void testUnionOverFunctions() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
@@ -2966,6 +2969,7 @@
public void testPushSubqueryInWhereClause3() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
caps.setFunctionSupport("ltrim", true); //$NON-NLS-1$
@@ -2984,6 +2988,7 @@
public void testPushSubqueryInWhereClause4() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
caps.setFunctionSupport("ltrim", true); //$NON-NLS-1$
@@ -3279,8 +3284,6 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject model = metadata.getStore().findObject("pm1",
FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject model2 = metadata.getStore().findObject("pm2",
FakeMetadataObject.MODEL); //$NON-NLS-1$
FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1",
FakeMetadataObject.GROUP); //$NON-NLS-1$
g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new
Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
FakeMetadataObject g2 = metadata.getStore().findObject("pm2.g2",
FakeMetadataObject.GROUP); //$NON-NLS-1$
@@ -3322,7 +3325,6 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject model = metadata.getStore().findObject("pm1",
FakeMetadataObject.MODEL); //$NON-NLS-1$
FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1",
FakeMetadataObject.GROUP); //$NON-NLS-1$
g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new
Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2",
FakeMetadataObject.GROUP); //$NON-NLS-1$
@@ -3595,25 +3597,9 @@
/** defect 21965 */
public void testLookupFunctionInSelect() {
ProcessorPlan plan = helpPlan("SELECT e1,
LOOKUP('pm1.g1','e1', 'e2', 1) FROM pm1.g2",
FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM pm1.g2" }); //$NON-NLS-1$
+ new String[] { "SELECT e1, LOOKUP('pm1.g1','e1',
'e2', 1) FROM pm1.g2" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
-
+ checkNodeTypes(plan, FULL_PUSHDOWN);
}
// SELECT * FROM (SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT DISTINCT IntNum
FROM BQT1.SmallA) AS x WHERE IntKey = 0
@@ -4075,6 +4061,7 @@
public void testUnionPushdownWithFunctionsAndAliases() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -4133,6 +4120,7 @@
public void testUnionNoAllPushdownInInlineView() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -4184,6 +4172,7 @@
public void testUnionAllPushdownVirtualGroup() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -4272,6 +4261,7 @@
public void testPushCaseInSelect() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_CASE, true);
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
@@ -4328,6 +4318,7 @@
public void testPushSearchedCaseInSelect() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -4885,6 +4876,7 @@
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
caps.setFunctionSupport("+", true); //$NON-NLS-1$
@@ -5604,6 +5596,7 @@
public void testCase2507() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -5633,6 +5626,7 @@
public void testCase2507A() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -5661,6 +5655,7 @@
public void testCase2507B() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -5986,12 +5981,12 @@
/*
* Select literals created by runtime evaluation should not be pushed down.
*/
- public void testCase4017() {
+ public void testCase4017() throws Exception {
String sql = "SELECT env('soap_host') AS HOST, intkey from
bqt2.smalla"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
- new String[] {"SELECT intkey FROM
bqt2.smalla"}); //$NON-NLS-1$
+ helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, new
DefaultCapabilitiesFinder(),
+ new String[] {"SELECT bqt2.smalla.intkey FROM
bqt2.smalla"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
/**
@@ -6216,6 +6211,7 @@
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER_FULL, true);
@@ -6241,6 +6237,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -6307,6 +6304,7 @@
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleMergeVirtual.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleMergeVirtual.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleMergeVirtual.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -22,8 +22,10 @@
package com.metamatrix.query.optimizer;
-import junit.framework.TestCase;
+import org.junit.Test;
+import static junit.framework.Assert.*;
+
import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -33,174 +35,90 @@
import com.metamatrix.query.unittest.FakeMetadataFacade;
import com.metamatrix.query.unittest.FakeMetadataFactory;
-public class TestRuleMergeVirtual extends TestCase {
+public class TestRuleMergeVirtual {
- public void testSimpleMergeGroupBy() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ @Test public void testSimpleMergeGroupBy() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT e1,
max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null,
capFinder,
+ FakeMetadataFactory.example1Cached(), null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY
e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeGroupBy1() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ @Test public void testSimpleMergeGroupBy1() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT distinct
e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null,
capFinder,
+ FakeMetadataFactory.example1Cached(), null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
- "SELECT DISTINCT e1, MAX(e2) AS x FROM
pm1.g1 GROUP BY e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
+ "SELECT v_0.c_1 FROM (SELECT DISTINCT
g_0.e1 AS c_0, MAX(g_0.e2) AS c_1 FROM pm1.g1 AS g_0 GROUP BY g_0.e1) AS v_0"},
TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
/**
* Same as above but all required symbols are selected
*/
- public void testSimpleMergeGroupBy2() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ @Test public void testSimpleMergeGroupBy2() {
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x, e1 FROM (SELECT
distinct e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- metadata, null, capFinder,
+ metadata, null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT DISTINCT MAX(e2) AS x, e1 FROM
pm1.g1 GROUP BY e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeGroupBy3() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ @Test public void testSimpleMergeGroupBy3() {
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT distinct x, e1 FROM
(SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- metadata, null, capFinder,
+ metadata, null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT DISTINCT MAX(e2) AS x, e1 FROM
pm1.g1 GROUP BY e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeGroupBy4() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ @Test public void testSimpleMergeGroupBy4() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x, x FROM (SELECT e1,
max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null,
capFinder,
+ FakeMetadataFactory.example1Cached(), null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
- "SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY
e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
+ "SELECT v_0.c_0, v_0.c_0 FROM (SELECT
MAX(g_0.e2) AS c_0 FROM pm1.g1 AS g_0 GROUP BY g_0.e1) AS v_0"},
TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeGroupBy5() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ @Test public void testSimpleMergeGroupBy5() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT e1,
max(e2) as x FROM pm1.g1 GROUP BY e1) AS z where z.x = 1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null,
capFinder,
+ FakeMetadataFactory.example1Cached(), null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY
e1 HAVING MAX(e2) = 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeGroupBy6() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ @Test public void testSimpleMergeGroupBy6() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT e1,
max(e2) as x FROM pm1.g1 GROUP BY e1) AS z where z.x = 1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null,
capFinder,
+ FakeMetadataFactory.example1Cached(), null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY
e1 HAVING MAX(e2) = 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeGroupBy7() {
- FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
- caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
- caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ @Test public void testSimpleMergeGroupBy7() {
FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT distinct x, e1 FROM
(SELECT distinct e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- metadata, null, capFinder,
+ metadata, null,
TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT DISTINCT MAX(e2) AS x, e1 FROM
pm1.g1 GROUP BY e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeUnion() {
+ @Test public void testSimpleMergeUnion() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -215,7 +133,7 @@
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeUnion1() {
+ @Test public void testSimpleMergeUnion1() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -233,7 +151,7 @@
/**
* Same as above, but the expression will prevent the source removal
*/
- public void testSimpleMergeUnion2() {
+ @Test public void testSimpleMergeUnion2() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -263,7 +181,7 @@
});
}
- public void testSimpleMergeUnion3() {
+ @Test public void testSimpleMergeUnion3() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
@@ -293,7 +211,7 @@
});
}
- public void testSimpleMergeWithLimit() {
+ @Test public void testSimpleMergeWithLimit() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.ROW_LIMIT, true);
@@ -307,7 +225,7 @@
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSimpleMergeWithLimit1() {
+ @Test public void testSimpleMergeWithLimit1() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.ROW_LIMIT, true);
@@ -341,7 +259,7 @@
/**
* Note that the merge is not performed since it would create an expression in the
group by clause
*/
- public void testViewPreservationWithGroupByExpression() throws Exception {
+ @Test public void testViewPreservationWithGroupByExpression() throws Exception {
String sql = "SELECT gbl_date " + //$NON-NLS-1$
"FROM " + //$NON-NLS-1$
"(SELECT a.intkey as x, convert(a.TimestampValue, date) AS gbl_date,
b.intkey as y " + //$NON-NLS-1$
@@ -351,6 +269,7 @@
// Create capabilities
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
@@ -370,7 +289,7 @@
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
- public void testSortAliasWithSameName() throws Exception {
+ @Test public void testSortAliasWithSameName() throws Exception {
String sql = "select e1 from (select distinct pm1.g1.e1 as e1 from pm1.g1) x
order by e1"; //$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleRaiseNull.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleRaiseNull.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestRuleRaiseNull.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -68,24 +68,9 @@
String sql = "select * from ( select intkey as cola, null as colb, intnum as
colc from bqt1.smalla union all select null, intkey, intnum from bqt2.smalla) as X where
X.cola = 1"; //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQT(),
- new String[] {"SELECT intkey, intnum FROM
bqt1.smalla WHERE intkey = 1"} ); //$NON-NLS-1$
+ new String[] {"SELECT intkey, null, intnum
FROM bqt1.smalla WHERE intkey = 1"} ); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -101,46 +86,16 @@
String sql = "select b.intkey from (select intkey from bqt1.smalla) a full
outer join (select intkey from bqt1.smallb where 1 = 0) b on (a.intkey = b.intkey)";
//$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQTCached(),
- new String[]{"SELECT
BQT1.SmallA.IntKey FROM bqt1.smalla"}); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ new String[]{"SELECT null FROM
bqt1.smalla"}); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
public void testRaiseNullWithOuterJoin() {
String sql = "select b.intkey from (select intkey from bqt1.smalla) a left
outer join (select intkey from bqt1.smallb where 1 = 0) b on (a.intkey = b.intkey)";
//$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQTCached(),
- new String[]{"SELECT
BQT1.SmallA.IntKey FROM bqt1.smalla"}); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ new String[]{"SELECT null FROM
bqt1.smalla"}); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
public void testRaiseNullWithOuterJoin1() {
@@ -178,7 +133,7 @@
String sql = "select b.intkey, b.x from (select intkey, intnum as x from
bqt1.smalla where 1 = 0 union all select intnum as a, null from bqt1.smalla union all
select 1 as z, intkey as b from bqt1.smallb) b"; //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQTCached(),
- new String[]{"SELECT intkey FROM
bqt1.smallb", "SELECT IntNum FROM bqt1.smalla"}); //$NON-NLS-1$
//$NON-NLS-2$
+ new String[]{"SELECT 1, intkey
FROM bqt1.smallb", "SELECT IntNum, null FROM bqt1.smalla"}); //$NON-NLS-1$
//$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
0, // DependentAccess
@@ -190,7 +145,7 @@
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
- 2, // Project
+ 0, // Project
0, // Select
0, // Sort
1 // UnionAll
@@ -209,23 +164,8 @@
String sql = "select b.intkey, b.x from (select intkey, intnum as x from
bqt1.smalla where 1 = 0 union all select 1 as z, intkey as b from bqt1.smallb) b inner
join bqt1.smalla on b.intkey = bqt1.smalla.intkey"; //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.exampleBQTCached(),
- new String[]{"SELECT g_0.intkey
FROM bqt1.smallb AS g_0, bqt1.smalla AS g_1 WHERE g_1.IntKey = 1"},
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- TestOptimizer.checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 0, // Select
- 0, // Sort
- 0 // UnionAll
- });
+ new String[]{"SELECT 1,
g_0.intkey FROM bqt1.smallb AS g_0, bqt1.smalla AS g_1 WHERE g_1.IntKey = 1"},
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
public void testRaiseNullWithUnion5() {
@@ -261,12 +201,12 @@
public void testPushCriteriaThroughUnion9() {
TestOptimizer.helpPlan("select * from vm1.u8 where const =
's1'", TestOptimizer.example1(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM pm1.g1" } ); //$NON-NLS-1$
+ new String[] { "SELECT 's1', e1 FROM pm1.g1" } );
//$NON-NLS-1$
}
public void testPushCriteriaThroughUnion10() {
TestOptimizer.helpPlan("select * from vm1.u8 where const =
's3'", TestOptimizer.example1(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM pm1.g3" } ); //$NON-NLS-1$
+ new String[] { "SELECT 's3', e1 FROM pm1.g3" } );
//$NON-NLS-1$
}
public void testRaiseNullWithOuterJoinAndHaving() {
@@ -411,7 +351,7 @@
String sql = "select pm1.g1.e1 from pm1.g1, (select e1 from pm1.g1 where (1
= 0) union all select e1 as x from pm1.g2) x where pm1.g1.e1 <> x.e1";
//$NON-NLS-1$
RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(),
- new String[]{"SELECT g_0.e1 FROM
pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 <> g_1.e1"}); //$NON-NLS-1$
//$NON-NLS-2$
+ new String[]{"SELECT g_0.e1 FROM
pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 <> g_1.e1"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestSubqueryPushdown.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -121,6 +121,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
@@ -144,6 +145,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -184,6 +186,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
@@ -679,6 +682,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MIN, true);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
import junit.framework.TestCase;
@@ -39,6 +38,8 @@
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.optimizer.QueryOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
import com.metamatrix.query.parser.QueryParser;
import com.metamatrix.query.processor.ProcessorPlan;
@@ -126,13 +127,7 @@
}
public static CapabilitiesFinder getGenericFinder() {
- CapabilitiesFinder finder = new CapabilitiesFinder() {
- private SourceCapabilities caps = new FakeCapabilities(true);
- public SourceCapabilities findCapabilities(String modelName) throws
MetaMatrixComponentException {
- return caps;
- }
- };
- return finder;
+ return new DefaultCapabilitiesFinder(new FakeCapabilities(true));
}
private BatchedUpdatePlan helpPlan(String[] sql, QueryMetadataInterface md) throws
QueryParserException, QueryResolverException, QueryValidatorException,
MetaMatrixComponentException, QueryPlannerException, QueryMetadataException {
@@ -195,8 +190,8 @@
"DELETE FROM pm1.g1 WHERE e2 > 5000", //$NON-NLS-1$
"UPDATE pm1.g1 set e2 = -1 WHERE e2 = 4999"
//$NON-NLS-1$
};
- FakeFinder finder = new FakeFinder();
- finder.setCapabilities("pm1", new FakeCapabilities(false));
//$NON-NLS-1$
+ FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
+ finder.addCapabilities("pm1", new FakeCapabilities(false));
//$NON-NLS-1$
boolean[] expectedBatching = {false, false, false, false};
helpTestPlanner(sql, expectedBatching, finder);
}
@@ -209,9 +204,9 @@
"UPDATE pm2.g1 set e2 = -1 WHERE e2 = 4999",
//$NON-NLS-1$
"DELETE FROM pm1.g2 WHERE e2 = 50" //$NON-NLS-1$
};
- FakeFinder finder = new FakeFinder();
- finder.setCapabilities("pm1", new FakeCapabilities(false));
//$NON-NLS-1$
- finder.setCapabilities("pm2", new FakeCapabilities(true));
//$NON-NLS-1$
+ FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
+ finder.addCapabilities("pm1", new FakeCapabilities(false));
//$NON-NLS-1$
+ finder.addCapabilities("pm2", new FakeCapabilities(true));
//$NON-NLS-1$
boolean[] expectedBatching = {false, false, true, false};
helpTestPlanner(sql, expectedBatching, finder);
}
@@ -230,15 +225,7 @@
public Object getSourceProperty(Capability propertyName) {return null;}
}
- private static final class FakeFinder implements CapabilitiesFinder {
- private HashMap caps = new HashMap();
- private void setCapabilities(String modelName, SourceCapabilities cap) {
- caps.put(modelName, cap);
- }
- public SourceCapabilities findCapabilities(String modelName) throws
MetaMatrixComponentException {
- return (SourceCapabilities)caps.get(modelName);
- }
-}
+
private static final boolean DEBUG = false;
}
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/capabilities/FakeCapabilitiesFinder.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/capabilities/FakeCapabilitiesFinder.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/capabilities/FakeCapabilitiesFinder.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -31,7 +31,7 @@
*/
public class FakeCapabilitiesFinder implements CapabilitiesFinder {
- private Map caps = new HashMap();
+ private Map<String, SourceCapabilities> caps = new HashMap<String,
SourceCapabilities>();
/**
*
@@ -47,7 +47,7 @@
* @see
com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder#findCapabilities(java.lang.String)
*/
public SourceCapabilities findCapabilities(String connectorBindingID) throws
MetaMatrixComponentException {
- return (SourceCapabilities) caps.get(connectorBindingID);
+ return caps.get(connectorBindingID);
}
public String toString() {
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCapabilitiesUtil.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCapabilitiesUtil.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestCapabilitiesUtil.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -513,7 +513,7 @@
finder.addCapabilities("pm1", sourceCaps); //$NON-NLS-1$
// Test capabilities util
- boolean actual = CapabilitiesUtil.supportsSelectLiterals(modelID, metadata,
finder);
+ boolean actual = CapabilitiesUtil.supportsSelectExpression(modelID, metadata,
finder);
assertEquals("Got wrong answer for supports", supports, actual);
//$NON-NLS-1$
}
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -34,7 +34,7 @@
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.optimizer.TestOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
-import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
+import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import com.metamatrix.query.optimizer.relational.GenerateCanonical;
import com.metamatrix.query.optimizer.relational.OptimizerRule;
import com.metamatrix.query.optimizer.relational.PlanHints;
@@ -130,12 +130,7 @@
System.out.println("EXECUTING " + rule); //$NON-NLS-1$
}
- CapabilitiesFinder finder = new CapabilitiesFinder() {
- private SourceCapabilities caps =
TestOptimizer.getTypicalCapabilities();
- public SourceCapabilities findCapabilities(String modelName) throws
MetaMatrixComponentException {
- return caps;
- }
- };
+ CapabilitiesFinder finder = new
DefaultCapabilitiesFinder(TestOptimizer.getTypicalCapabilities());
plan = rule.execute(plan, metadata, finder, rules, new AnalysisRecord(false,
false, debug), null);
if(debug) {
System.out.println("\nAFTER: \n" + plan); //$NON-NLS-1$
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcedureRelational.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -195,6 +195,15 @@
TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null,
TestOptimizer.getGenericFinder(), null, false);
}
+ /**
+ * Will fail missing param2 assignment
+ */
+ @Test public void testProcAsTable5(){
+ String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1=e2
and param2 = 'a'"; //$NON-NLS-1$
+
+ TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null,
TestOptimizer.getGenericFinder(), null, false);
+ }
+
@Test public void testProcAsTableInJoin(){
String sql = "select param1, param2, pm1.vsp26.e2 from pm1.vsp26, pm1.g1
where param1 = pm1.g1.e2 and param2 = pm1.g1.e1 order by param1, param2, e2";
//$NON-NLS-1$
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -5567,6 +5567,7 @@
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/TestSetProcessing.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/TestSetProcessing.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/TestSetProcessing.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -25,17 +25,19 @@
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Test;
import com.metamatrix.query.optimizer.TestOptimizer;
+import com.metamatrix.query.optimizer.TestOptimizer.ComparisonMode;
+import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import com.metamatrix.query.unittest.FakeMetadataFactory;
-public class TestSetProcessing extends TestCase {
+public class TestSetProcessing {
- public void testExcept() {
+ @Test public void testExcept() throws Exception {
String sql = "select e1, e2 from pm1.g2 except select e1, 1 from
pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 FROM pm1.g2 AS
g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0"}); //$NON-NLS-1$
//$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[]
{"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2 FROM
pm1.g2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
List<?>[] expected = new List[] {
Arrays.asList(new Object[] {"a", 0}), //$NON-NLS-1$
@@ -48,10 +50,10 @@
TestProcessor.helpProcess(plan, manager, expected);
}
- public void testIntersect() {
+ @Test public void testIntersect() throws Exception {
String sql = "select e1, e2 from pm1.g2 intersect select e1, 1 from
pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 FROM pm1.g2 AS
g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0"}); //$NON-NLS-1$
//$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[]
{"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2 FROM
pm1.g2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
List<?>[] expected = new List[] {
Arrays.asList(new Object[] {null, 1}),
@@ -63,10 +65,10 @@
TestProcessor.helpProcess(plan, manager, expected);
}
- public void testIntersectExcept() {
+ @Test public void testIntersectExcept() {
String sql = "select e1, e2 from pm1.g2 except select e1, 1 from pm1.g2
intersect select 'a', e2 from pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 FROM pm1.g2 AS
g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM
pm1.g2 AS g_0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql,
FakeMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1, 1 FROM pm1.g2 AS
g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0", "SELECT 'a',
g_0.e2 FROM pm1.g2 AS g_0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
List<?>[] expected = new List[] {
Arrays.asList(new Object[] {null, 1}),
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -322,7 +322,7 @@
ElementSymbol es1 = new ElementSymbol("e1"); //$NON-NLS-1$
es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
- TupleSourceID tsid = bm.createTupleSource(Arrays.asList(es1), new String[]
{DataTypeManager.DefaultDataTypes.INTEGER}, "test", TupleSourceType.PROCESSOR);
//$NON-NLS-1$
+ TupleSourceID tsid = bm.createTupleSource(Arrays.asList(es1), "test",
TupleSourceType.PROCESSOR); //$NON-NLS-1$
bm.addTupleBatch(tsid, new TupleBatch(1, new List[] {Arrays.asList(1)}));
SortUtility su = new SortUtility(tsid, Arrays.asList(es1),
Arrays.asList(Boolean.TRUE), Mode.DUP_REMOVE, bm, "test", true); //$NON-NLS-1$
TupleSourceID out = su.sort();
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2009-10-27
01:16:42 UTC (rev 1542)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -65,7 +65,6 @@
import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
-import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
import com.metamatrix.query.optimizer.xml.TestXMLPlanner;
import com.metamatrix.query.parser.ParseInfo;
@@ -10064,7 +10063,7 @@
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
- CapabilitiesFinder capFinder = new SimpleCapabilitiesFinder(caps);
+ CapabilitiesFinder capFinder = new DefaultCapabilitiesFinder(caps);
helpTestProcess("SELECT * FROM xmltest.doc12260", expectedDoc,
metadata, dataMgr, true, MetaMatrixComponentException.class, null, capFinder);
//$NON-NLS-1$
}
@@ -11914,13 +11913,4 @@
}
}
- private static final class SimpleCapabilitiesFinder implements CapabilitiesFinder{
- private SourceCapabilities caps;
- SimpleCapabilitiesFinder(SourceCapabilities caps){
- this.caps = caps;
- }
- public SourceCapabilities findCapabilities(String modelName) {
- return caps;
- }
- }
}
Added:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
(rev 0)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java 2009-10-27
01:18:06 UTC (rev 1543)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.dqp.internal.process;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.mockito.Mockito;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.dqp.internal.process.SharedCachedFinder;
+
+import com.metamatrix.dqp.internal.datamgr.ConnectorID;
+import com.metamatrix.dqp.message.RequestMessage;
+import com.metamatrix.dqp.service.DataService;
+import com.metamatrix.dqp.service.VDBService;
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
+import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
+
+/**
+ */
+public class TestConnectorCapabilitiesFinder extends TestCase {
+
+ /**
+ * Constructor for TestConnectorCapabilitiesFinder.
+ * @param name
+ */
+ public TestConnectorCapabilitiesFinder(String name) {
+ super(name);
+ }
+
+ public void testFind() throws Exception {
+ String vdbName = "myvdb"; //$NON-NLS-1$
+ String vdbVersion = "1"; //$NON-NLS-1$
+ String modelName = "model"; //$NON-NLS-1$
+ String functionName = "fakeFunction"; //$NON-NLS-1$
+
+ BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ caps.setFunctionSupport("fakeFunction", true); //$NON-NLS-1$
+ RequestMessage request = new RequestMessage(null);
+ DQPWorkContext workContext = new DQPWorkContext();
+ workContext.setVdbName(vdbName);
+ workContext.setVdbVersion(vdbVersion);
+
+ VDBService vdbService = Mockito.mock(VDBService.class);
+ Mockito.stub(vdbService.getConnectorBindingNames(vdbName, vdbVersion,
modelName)).toReturn(Arrays.asList(modelName));
+ DataService dataService = Mockito.mock(DataService.class);
+ ConnectorID id = new ConnectorID("foo"); //$NON-NLS-1$
+ Mockito.stub(dataService.selectConnector(modelName)).toReturn(id);
+ BasicSourceCapabilities basicSourceCapabilities = new BasicSourceCapabilities();
+ basicSourceCapabilities.setFunctionSupport(functionName, true);
+ Mockito.stub(dataService.getCapabilities(request, workContext,
id)).toReturn(basicSourceCapabilities);
+
+ SharedCachedFinder finder = new SharedCachedFinder(vdbService, dataService,
request, workContext, new HashMap<String, SourceCapabilities>());
+
+ // Test
+ SourceCapabilities actual = finder.findCapabilities(modelName);
+ assertEquals("Did not get expected capabilities", true,
actual.supportsFunction(functionName)); //$NON-NLS-1$
+ }
+
+}
Property changes on:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain