teiid SVN: r1469 - in trunk: connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-23 15:07:45 -0400 (Wed, 23 Sep 2009)
New Revision: 1469
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java
trunk/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java
trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
trunk/test-integration/common/
Log:
forward merge of changes from the 6.2 release
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -115,10 +115,14 @@
}
}
for (IParameter parameter : proc.getParameters()) {
- if (parameter.getDirection() == Direction.RETURN || parameter.getDirection() == Direction.RESULT_SET) {
+ switch (parameter.getDirection()) {
+ case IN:
+ paramIndex++;
+ case RETURN:
+ case RESULT_SET:
continue;
- }
- if (parameter.getDirection() == Direction.INOUT || parameter.getDirection() == Direction.OUT) {
+ case INOUT:
+ case OUT:
addParameterValue(result, paramIndex++, parameter);
}
}
Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -58,5 +58,21 @@
assertEquals(Arrays.asList(5), procedureExecution.getOutputParameterValues());
Mockito.verify(cs, Mockito.times(1)).registerOutParameter(1, Types.INTEGER);
}
+
+ @Test public void testProcedureExecution1() throws Exception {
+ ICommand command = MetadataFactory.helpTranslate(MetadataFactory.BQT_VDB, "exec pm2.spTest8(1)"); //$NON-NLS-1$
+ Connection connection = Mockito.mock(Connection.class);
+ CallableStatement cs = Mockito.mock(CallableStatement.class);
+ Mockito.stub(cs.getUpdateCount()).toReturn(-1);
+ Mockito.stub(cs.getInt(2)).toReturn(5);
+ Mockito.stub(connection.prepareCall("{ call spTest8(?,?)}")).toReturn(cs); //$NON-NLS-1$
+ Translator sqlTranslator = new Translator();
+ ExecutionContext context = EnvironmentUtility.createSecurityContext("user"); //$NON-NLS-1$
+ RuntimeMetadataImpl runtimeMetadata = new RuntimeMetadataImpl(FakeMetadataFactory.exampleBQTCached());
+ JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, sqlTranslator, Mockito.mock(ConnectorLogger.class), new Properties(), runtimeMetadata, context, EnvironmentUtility.createEnvironment(new Properties()) );
+ procedureExecution.execute();
+ assertEquals(Arrays.asList(5), procedureExecution.getOutputParameterValues());
+ Mockito.verify(cs, Mockito.times(1)).registerOutParameter(2, Types.INTEGER);
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/BatchedUpdateNode.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -90,7 +90,7 @@
for (int i = 0; i < updateCommands.size(); i++) {
Command updateCommand = (Command)updateCommands.get(i).clone();
CommandContext context = this.getContext();
- if (this.contexts != null) {
+ if (this.contexts != null && !this.contexts.isEmpty()) {
context = (CommandContext)context.clone();
context.setVariableContext(this.contexts.get(i));
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/engine/src/main/java/com/metamatrix/query/resolver/util/ResolverUtil.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -240,7 +240,7 @@
Constant reverse = getProperlyTypedConstant(result.getValue(), constant.getType());
- if (constant.equals(reverse)) {
+ if (((Comparable)constant.getValue()).compareTo(reverse.getValue()) == 0) {
return result;
}
} catch (QueryResolverException e) {
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -1543,7 +1543,7 @@
* @throws QueryValidatorException
* @since 4.2
*/
- private Criteria simplifyConvertFunction(SetCriteria crit) throws QueryValidatorException {
+ private Criteria simplifyConvertFunction(SetCriteria crit) throws QueryValidatorException {
Function leftFunction = (Function) crit.getExpression();
Expression leftExpr = leftFunction.getArgs()[0];
String leftExprTypeName = DataTypeManager.getDataTypeName(leftExpr.getType());
@@ -1570,11 +1570,13 @@
}
}
- if (result != null) {
+ if (result == null) {
+ removedSome = true;
+ i.remove();
+ } else if (DataTypeManager.isImplicitConversion(leftExprTypeName, DataTypeManager.getDataTypeName(rightConstant.getType()))) {
newValues.add(result);
} else {
- removedSome = true;
- i.remove();
+ convertedAll = false;
}
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestBatchedUpdateNode.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.junit.Test;
@@ -57,7 +58,7 @@
for (Command command : commands) {
shouldEvaluate.add(EvaluatableVisitor.needsProcessingEvaluation(command));
}
- BatchedUpdateNode node = new BatchedUpdateNode(1, commands, null, shouldEvaluate, "myModelName"); //$NON-NLS-1$
+ BatchedUpdateNode node = new BatchedUpdateNode(1, commands, Collections.EMPTY_LIST, shouldEvaluate, "myModelName"); //$NON-NLS-1$
CommandContext context = new CommandContext();
context.setProcessorID("myProcessorID"); //$NON-NLS-1$
node.initialize(context, Mockito.mock(BufferManager.class), pdm);
Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-09-23 18:51:09 UTC (rev 1468)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-09-23 19:07:45 UTC (rev 1469)
@@ -2269,4 +2269,21 @@
helpTestRewriteCriteria(original, expected);
}
+ /**
+ * Test ensures that '22.0' is a valid long via bigdecimal
+ */
+ @Test public void testRewriteBigDecimal() {
+ String original = "convert(BQT1.SmallA.LongNum, bigdecimal) = '22.0'"; //$NON-NLS-1$
+ CompareCriteria crit = new CompareCriteria(new ElementSymbol("BQT1.SmallA.LongNum"), CompareCriteria.EQ, new Constant(new Long(22))); //$NON-NLS-1$
+ helpTestRewriteCriteria(original, crit, FakeMetadataFactory.exampleBQTCached());
+ }
+
+ /**
+ * Test ensures that we will not attempt to invert the widening conversion
+ */
+ @Test public void testRewriteWideningIn() {
+ String original = "convert(BQT1.SmallA.TimestampValue, time) in ({t'10:00:00'}, {t'11:00:00'})"; //$NON-NLS-1$
+ helpTestRewriteCriteria(original, parseCriteria("convert(BQT1.SmallA.TimestampValue, time) in ({t'10:00:00'}, {t'11:00:00'})", FakeMetadataFactory.exampleBQTCached()), FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
+ }
+
}
Property changes on: trunk/test-integration/common
___________________________________________________________________
Name: svn:ignore
- target
.settings
.classpath
.project
+ target
.settings
.classpath
.project
derby.log
15 years, 3 months
teiid SVN: r1468 - trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-23 14:51:09 -0400 (Wed, 23 Sep 2009)
New Revision: 1468
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
Log:
Teiid 773 - cleanup
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2009-09-23 18:49:30 UTC (rev 1467)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2009-09-23 18:51:09 UTC (rev 1468)
@@ -31,26 +31,7 @@
public abstract class ConnectionStrategy {
-
-// public static final String DS_USER = "user"; //$NON-NLS-1$
-//
-// // need both user variables because Teiid uses 'user' and connectors use 'username'
-// public static final String DS_USERNAME = JDBCPropertyNames.USERNAME; //$NON-NLS-1$
-// public static final String DS_PASSWORD = JDBCPropertyNames.PASSWORD; //$NON-NLS-1$
-//
-// // the driver is only used for making direct connections to the source, the
-// // connector type will provide the JDBCPropertyNames.CONNECTION_SOURCE driver class
-// public static final String DS_DRIVER = "driver"; //$NON-NLS-1$
-// public static final String DS_DATASOURCE = "datasource"; //$NON-NLS-1$
-//
-// public static final String DS_URL = JDBCPropertyNames.URL; //$NON-NLS-1$
-// public static final String DS_SERVERNAME = "servername"; //$NON-NLS-1$
-// public static final String DS_SERVERPORT = "portnumber"; //$NON-NLS-1$
-//
-// public static final String DS_DATABASENAME = "databasename"; //$NON-NLS-1$
-// public static final String DS_APPLICATION_NAME = "application-name"; //$NON-NLS-1$
-//
- public static final String JNDINAME_USERTXN = "usertxn-jndiname"; //$NON-NLS-1$
+ public static final String JNDINAME_USERTXN = "usertxn-jndiname"; //$NON-NLS-1$
public static final String PROCESS_BATCH = "process-batch"; //$NON-NLS-1$
public static final String CONNECTOR_BATCH = "connector-batch"; //$NON-NLS-1$
@@ -69,8 +50,7 @@
public ConnectionStrategy(Properties props) throws QueryTestFailedException {
this.env = props;
-
-
+
}
/*
@@ -151,23 +131,15 @@
Admin admin = (Admin)c.getAdminAPI();
- // boolean update = false;
- Properties p = new Properties();
- if (this.env.getProperty(PROCESS_BATCH) != null) {
- p.setProperty("metamatrix.buffer.processorBatchSize", this.env.getProperty(PROCESS_BATCH)); //$NON-NLS-1$
- // update = true;
- }
-
- if (this.env.getProperty(CONNECTOR_BATCH) != null) {
- p.setProperty("metamatrix.buffer.connectorBatchSize", this.env.getProperty(CONNECTOR_BATCH)); //$NON-NLS-1$
- // update = true;
- }
-
- // update the system.
-// if (update) {
-// admin.s
-// admin.updateSystemProperties(p);
+// Properties p = new Properties();
+// if (this.env.getProperty(PROCESS_BATCH) != null) {
+// p.setProperty("metamatrix.buffer.processorBatchSize", this.env.getProperty(PROCESS_BATCH)); //$NON-NLS-1$
// }
+//
+// if (this.env.getProperty(CONNECTOR_BATCH) != null) {
+// p.setProperty("metamatrix.buffer.connectorBatchSize", this.env.getProperty(CONNECTOR_BATCH)); //$NON-NLS-1$
+// }
+
setupVDBConnectorBindings(admin);
admin.restart();
@@ -219,7 +191,7 @@
if (ds != null) {
datasources.put(m.getName(), ds);
- System.out.println("Setting up Connector Binding of Type: " + ds.getConnectorType()); //$NON-NLS-1$
+ System.out.println("Set up Connector Binding (model:mapping:type): " + m.getName() + ":" + useName + ":" + ds.getConnectorType()); //$NON-NLS-1$
AdminOptions ao = new AdminOptions(AdminOptions.OnConflict.OVERWRITE);
ao.addOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR);
15 years, 3 months
teiid SVN: r1467 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-23 14:49:30 -0400 (Wed, 23 Sep 2009)
New Revision: 1467
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
Log:
Teiid 773 - fix testcase
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-23 18:22:50 UTC (rev 1466)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-23 18:49:30 UTC (rev 1467)
@@ -188,7 +188,7 @@
test.execute("select * from g1 where e1 >= 100 and e1 < 112");
test.assertRowCount(12);
test.execute("select * from g2 where e1 >= 100 and e1 < 112");
- test.assertRowCount(0);
+ test.assertRowCount(12);
test.closeConnection();
}
15 years, 3 months
teiid SVN: r1466 - in trunk/engine/src: main/java/com/metamatrix/query/optimizer/relational and 17 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-23 14:22:50 -0400 (Wed, 23 Sep 2009)
New Revision: 1466
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java
trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties
trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestTempTables.java
trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java
trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java
trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
Log:
TEIID-848 TEIID-788 TEIID-853 making insert with a query expression the dominant processing abstraction, adding validation of select into in a union, changing dynamic sql projection to positional, fixing insert with query expression
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -167,9 +167,7 @@
analysisRecord.println("\nCANONICAL PLAN: \n" + node.getCanonicalPlan()); //$NON-NLS-1$
}
- Iterator commands = command.getSubCommands().iterator();
- while (commands.hasNext()) {
- Command subcommand = (Command) commands.next();
+ for (Command subcommand : command.getSubCommands()) {
CommandTreeNode child = new CommandTreeNode();
node.addLastChild(child);
child.setParent(node);
@@ -193,11 +191,7 @@
AnalysisRecord analysisRecord,
CommandContext context)
throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
-
-
- Iterator commands = node.getChildren().iterator();
- while (commands.hasNext()) {
- CommandTreeNode child = (CommandTreeNode) commands.next();
+ for (CommandTreeNode child : node.getChildren()) {
recursiveOptimize(child, idGenerator, metadata, capFinder, analysisRecord, context);
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/GenerateCanonical.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -27,6 +27,7 @@
import java.util.List;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.api.exception.query.QueryPlannerException;
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.metadata.QueryMetadataInterface;
@@ -40,11 +41,13 @@
import com.metamatrix.query.sql.lang.From;
import com.metamatrix.query.sql.lang.FromClause;
import com.metamatrix.query.sql.lang.GroupBy;
+import com.metamatrix.query.sql.lang.Insert;
import com.metamatrix.query.sql.lang.JoinPredicate;
import com.metamatrix.query.sql.lang.JoinType;
import com.metamatrix.query.sql.lang.Limit;
import com.metamatrix.query.sql.lang.Option;
import com.metamatrix.query.sql.lang.OrderBy;
+import com.metamatrix.query.sql.lang.ProcedureContainer;
import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.QueryCommand;
import com.metamatrix.query.sql.lang.Select;
@@ -53,6 +56,7 @@
import com.metamatrix.query.sql.lang.SubqueryFromClause;
import com.metamatrix.query.sql.lang.UnaryFromClause;
import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
import com.metamatrix.query.sql.visitor.AggregateSymbolCollectorVisitor;
import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
import com.metamatrix.query.sql.visitor.GroupsUsedByElementsVisitor;
@@ -84,7 +88,7 @@
// update PlanHints to note that it is an update
hints.isUpdate = true;
- return GenerateCanonical.createUpdatePlan(command, hints);
+ return GenerateCanonical.createUpdatePlan(command, hints, metadata);
} else if( command.getType() == Command.TYPE_STORED_PROCEDURE) {
@@ -97,30 +101,43 @@
private GenerateCanonical() { }
- static PlanNode createUpdatePlan(Command command, PlanHints hints) {
+ static PlanNode createUpdatePlan(Command command, PlanHints hints, QueryMetadataInterface metadata) throws QueryPlannerException, MetaMatrixComponentException {
// Create top project node - define output columns for stored query / procedure
PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
- Collection groups = GroupCollectorVisitor.getGroups(command, false);
+ Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(command, false);
projectNode.addGroups(groups);
// Set output columns
- List cols = command.getProjectedSymbols();
+ List<SingleElementSymbol> cols = command.getProjectedSymbols();
projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, cols);
// Define source of data for stored query / procedure
PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
sourceNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, command);
- List subCommands = command.getSubCommands();
- if (subCommands.size() == 1) {
- sourceNode.setProperty(NodeConstants.Info.NESTED_COMMAND, subCommands.iterator().next());
+ if (command instanceof ProcedureContainer) {
+ ProcedureContainer container = (ProcedureContainer)command;
+ if (container.getSubCommand() != null) {
+ sourceNode.setProperty(NodeConstants.Info.NESTED_COMMAND, container.getSubCommand());
+ }
}
sourceNode.addGroups(groups);
GenerateCanonical.attachLast(projectNode, sourceNode);
+ //for INTO query, attach source and project nodes
+ if(command instanceof Insert){
+ Insert insert = (Insert)command;
+ if (insert.getQueryExpression() != null) {
+ PlanNode plan = createQueryPlan(insert.getQueryExpression(), hints, metadata);
+ GenerateCanonical.attachLast(sourceNode, plan);
+ MergeTreeNodeProcessor.mergeTempMetadata(insert.getQueryExpression(), insert);
+ projectNode.setProperty(NodeConstants.Info.INTO_GROUP, insert.getGroup());
+ }
+ }
+
return projectNode;
}
@@ -203,7 +220,7 @@
}
private static PlanNode createQueryPlan(Query query, PlanHints hints, QueryMetadataInterface metadata)
- throws QueryPlannerException, MetaMatrixComponentException {
+ throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
PlanNode plan = null;
@@ -212,7 +229,7 @@
PlanNode dummyRoot = new PlanNode();
- hints.hasOptionalJoin |= buildTree(fromClause, dummyRoot);
+ hints.hasOptionalJoin |= buildTree(fromClause, dummyRoot, metadata, hints);
plan = dummyRoot.getFirstChild();
@@ -255,33 +272,6 @@
plan = attachTupleLimit(plan, query.getLimit(), hints);
}
- //for SELECT INTO, attach source and project nodes
- if(query.getInto() != null){
- // For defect 10976 - find project in current plan and
- // set top columns
- List groups = null;
- PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
-
- GenerateCanonical.attachLast(sourceNode, plan);
- plan = sourceNode;
-
- if (query.getFrom() != null){
- groups = query.getFrom().getGroups();
- sourceNode.addGroups(groups);
- }
-
- PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
- List selectCols = query.getProjectedSymbols();
- projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, selectCols);
- projectNode.setProperty(NodeConstants.Info.INTO_GROUP, query.getInto().getGroup());
-
- if (groups != null){
- projectNode.addGroups(groups);
- }
- GenerateCanonical.attachLast(projectNode, plan);
- plan = projectNode;
- }
-
return plan;
}
@@ -310,9 +300,11 @@
* @param markJoinsInternal Flag saying whether joins built in this method should be marked
* as internal
* @return true if there are optional join nodes
+ * @throws MetaMatrixComponentException
+ * @throws QueryMetadataException
*/
- static boolean buildTree(FromClause clause, PlanNode parent)
- throws QueryPlannerException {
+ static boolean buildTree(FromClause clause, PlanNode parent, QueryMetadataInterface metadata, PlanHints hints)
+ throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
boolean result = false;
@@ -322,6 +314,9 @@
// No join required
UnaryFromClause ufc = (UnaryFromClause)clause;
GroupSymbol group = ufc.getGroup();
+ if (metadata.isVirtualGroup(group.getMetadataID())) {
+ hints.hasVirtualGroups = true;
+ }
Command nestedCommand = ufc.getExpandedCommand();
node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
node.addGroup(group);
@@ -347,7 +342,7 @@
// Handle each child
FromClause[] clauses = new FromClause[] {jp.getLeftClause(), jp.getRightClause()};
for(int i=0; i<2; i++) {
- result |= buildTree(clauses[i], node);
+ result |= buildTree(clauses[i], node, metadata, hints);
// Add groups to joinNode
for (PlanNode child : node.getChildren()) {
@@ -361,7 +356,7 @@
node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
node.addGroup(group);
node.setProperty(NodeConstants.Info.NESTED_COMMAND, nestedCommand);
-
+ hints.hasVirtualGroups = true;
parent.addLastChild(node);
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/MergeTreeNodeProcessor.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -103,9 +103,7 @@
Command childCommand = child.getCommand();
Command parentCommand = parent.getCommand();
- Iterator i = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(parentCommand).iterator();
- while (i.hasNext()) {
- SubqueryContainer crit = (SubqueryContainer) i.next();
+ for (SubqueryContainer crit : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(parentCommand)) {
if (crit.getCommand() == childCommand){
//Don't merge these two nodes
return;
@@ -124,7 +122,7 @@
* @param childCommand
* @param parentCommand
*/
- private static void mergeTempMetadata(
+ static void mergeTempMetadata(
Command childCommand,
Command parentCommand) {
Map childTempMetadata = childCommand.getTemporaryMetadata();
@@ -155,9 +153,7 @@
throws QueryMetadataException, MetaMatrixComponentException {
PlanNode parentPlan = (PlanNode)parent.getCanonicalPlan();
- Iterator sourceNodes = NodeEditor.findAllNodes(parentPlan, NodeConstants.Types.SOURCE).iterator();
- while (sourceNodes.hasNext()){
- PlanNode sourceNode = (PlanNode)sourceNodes.next();
+ for (PlanNode sourceNode : NodeEditor.findAllNodes(parentPlan, NodeConstants.Types.SOURCE)) {
if(sourceNode.getChildCount()>0) {
continue;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -22,7 +22,6 @@
package com.metamatrix.query.optimizer.relational;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -30,8 +29,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.api.exception.query.QueryPlannerException;
-import com.metamatrix.api.exception.query.QueryResolverException;
-import com.metamatrix.api.exception.query.QueryValidatorException;
import com.metamatrix.core.id.IDGenerator;
import com.metamatrix.core.id.IntegerID;
import com.metamatrix.core.id.IntegerIDFactory;
@@ -40,12 +37,12 @@
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.TempMetadataID;
-import com.metamatrix.query.optimizer.QueryOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
import com.metamatrix.query.optimizer.relational.plantree.NodeConstants;
import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
+import com.metamatrix.query.optimizer.relational.plantree.NodeConstants.Info;
import com.metamatrix.query.optimizer.relational.rules.CapabilitiesUtil;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.processor.relational.AccessNode;
@@ -71,9 +68,7 @@
import com.metamatrix.query.processor.relational.JoinNode.JoinStrategyType;
import com.metamatrix.query.processor.relational.MergeJoinStrategy.SortOption;
import com.metamatrix.query.processor.relational.SortUtility.Mode;
-import com.metamatrix.query.resolver.QueryResolver;
import com.metamatrix.query.resolver.util.ResolverUtil;
-import com.metamatrix.query.rewriter.QueryRewriter;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.sql.lang.Insert;
@@ -84,7 +79,6 @@
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.Expression;
import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.sql.symbol.Reference;
import com.metamatrix.query.sql.util.SymbolMap;
import com.metamatrix.query.sql.visitor.EvaluatableVisitor;
import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
@@ -169,28 +163,16 @@
GroupSymbol intoGroup = (GroupSymbol) node.getProperty(NodeConstants.Info.INTO_GROUP);
if(intoGroup != null) {
try {
- // Figure out what elements should be inserted based on what is being projected
- // from child node
- List<ElementSymbol> allIntoElements = ResolverUtil.resolveElementsInGroup(intoGroup, metadata);
+ Insert insert = (Insert)node.getFirstChild().getProperty(Info.VIRTUAL_COMMAND);
+ List<ElementSymbol> allIntoElements = insert.getVariables();
-
Object groupID = intoGroup.getMetadataID();
Object modelID = metadata.getModelID(groupID);
String modelName = metadata.getFullName(modelID);
if (metadata.isVirtualGroup(groupID)) {
- List<Reference> references = new ArrayList<Reference>(allIntoElements.size());
- for (int i = 0; i < allIntoElements.size(); i++) {
- Reference ref = new Reference(i);
- ref.setType(allIntoElements.get(i).getType());
- references.add(ref);
- }
- Insert insert = new Insert(intoGroup, allIntoElements, references);
- QueryResolver.resolveCommand(insert, metadata, analysisRecord);
- QueryRewriter.rewrite(insert, null, metadata, context);
- ProcessorPlan plan = QueryOptimizer.optimizePlan(insert, metadata, idGenerator, capFinder, analysisRecord, context);
InsertPlanExecutionNode ipen = new InsertPlanExecutionNode(getID());
- ipen.setProcessorPlan(plan);
- ipen.setReferences(references);
+ ipen.setProcessorPlan((ProcessorPlan)node.getFirstChild().getProperty(Info.PROCESSOR_PLAN));
+ ipen.setReferences(insert.getValues());
processNode = ipen;
} else {
ProjectIntoNode pinode = new ProjectIntoNode(getID());
@@ -208,10 +190,6 @@
}
} catch(QueryMetadataException e) {
throw new MetaMatrixComponentException(e);
- } catch(QueryResolverException e) {
- throw new MetaMatrixComponentException(e);
- } catch(QueryValidatorException e) {
- throw new MetaMatrixComponentException(e);
}
} else {
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -111,7 +111,6 @@
// Check whether command has virtual groups
Command command = node.getCommand();
PlanHints hints = (PlanHints)node.getProperty(RelationalPlanner.HINTS);
- RelationalPlanner.checkForVirtualGroups(command, hints, metadata);
// Distribute make dependent hints as necessary
if(hints.makeDepGroups != null) {
@@ -211,27 +210,6 @@
}
/**
- * Look for any virtual groups in the user's command. If some exist, then
- * set the hint for virtual groups to true. Otherwise, leave the hint at it's
- * default value which is false. This allows the buildRules() method later to
- * leave out a bunch of rules relating to virtual groups if none were used.
- * @param command Command to check
- * @param hints Hints to update if virtual groups are used in plan
- */
- private static void checkForVirtualGroups(Command command, PlanHints hints, QueryMetadataInterface metadata)
- throws QueryMetadataException, MetaMatrixComponentException {
- Collection groups = GroupCollectorVisitor.getGroups(command, true);
- Iterator groupIter = groups.iterator();
- while (groupIter.hasNext()) {
- GroupSymbol group = (GroupSymbol) groupIter.next();
- if( metadata.isVirtualGroup(group.getMetadataID()) ) {
- hints.hasVirtualGroups = true;
- break;
- }
- }
- }
-
- /**
* Distribute and "make (not) dependent" hints specified in the query into the
* fully resolved query plan. This is done after virtual group resolution so
* that all groups in the plan are known. The hint is attached to all SOURCE
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/QueryUtil.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -126,10 +126,10 @@
* @throws QueryPlannerException
* @since 4.3
*/
- static void rewriteQuery(Command query, QueryMetadataInterface metadata, CommandContext context)
+ static Command rewriteQuery(Command query, QueryMetadataInterface metadata, CommandContext context)
throws QueryPlannerException {
try {
- QueryRewriter.rewrite(query, null, metadata, context);
+ return QueryRewriter.rewrite(query, null, metadata, context);
} catch(QueryValidatorException e) {
throw new QueryPlannerException(e, e.getMessage());
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLQueryPlanner.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -433,7 +433,7 @@
}
}
- QueryUtil.rewriteQuery(query, planEnv.getGlobalMetadata(), planEnv.context);
+ Command cmd = QueryUtil.rewriteQuery(query, planEnv.getGlobalMetadata(), planEnv.context);
ProcessorPlan plan = null;
@@ -445,7 +445,7 @@
try {
// register with env
- plan = optimizePlan(query, planEnv);
+ plan = optimizePlan(cmd, planEnv);
} catch (QueryPlannerException e) {
if (implicit) {
if (debug) {
@@ -488,7 +488,7 @@
}
ResultSetInfo rsInfo = planEnv.getStagingTableResultsInfo(stageGroupName);
- rsInfo.setCommand(query);
+ rsInfo.setCommand(cmd);
rsInfo.setPlan(plan);
//set the carinality on the temp group.
@@ -504,7 +504,7 @@
ResultSetInfo rsUnloadInfo = planEnv.getStagingTableResultsInfo(unloadName);
Command command = wrapStagingTableUnloadQuery(intoGroupSymbol);
QueryUtil.resolveQuery(command, planEnv.getGlobalMetadata());
- QueryUtil.rewriteQuery(command, planEnv.getGlobalMetadata(), planEnv.context);
+ command = QueryUtil.rewriteQuery(command, planEnv.getGlobalMetadata(), planEnv.context);
plan = optimizePlan(command, planEnv);
rsUnloadInfo.setCommand(command);
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -33,7 +33,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.QueryProcessingException;
-import com.metamatrix.api.exception.query.QueryResolverException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.types.DataTypeManager;
@@ -42,7 +41,6 @@
import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.metadata.TempMetadataAdapter;
import com.metamatrix.query.metadata.TempMetadataStore;
import com.metamatrix.query.optimizer.QueryOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
@@ -52,28 +50,19 @@
import com.metamatrix.query.processor.program.ProgramInstruction;
import com.metamatrix.query.resolver.QueryResolver;
import com.metamatrix.query.resolver.util.ResolveVirtualGroupCriteriaVisitor;
-import com.metamatrix.query.resolver.util.ResolverUtil;
import com.metamatrix.query.rewriter.QueryRewriter;
import com.metamatrix.query.sql.ProcedureReservedWords;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.DynamicCommand;
-import com.metamatrix.query.sql.lang.From;
-import com.metamatrix.query.sql.lang.Into;
+import com.metamatrix.query.sql.lang.Insert;
import com.metamatrix.query.sql.lang.Query;
-import com.metamatrix.query.sql.lang.Select;
import com.metamatrix.query.sql.lang.SetClause;
-import com.metamatrix.query.sql.lang.SubqueryFromClause;
-import com.metamatrix.query.sql.lang.UnaryFromClause;
import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
-import com.metamatrix.query.sql.symbol.AliasSymbol;
import com.metamatrix.query.sql.symbol.Constant;
import com.metamatrix.query.sql.symbol.ElementSymbol;
-import com.metamatrix.query.sql.symbol.Expression;
-import com.metamatrix.query.sql.symbol.ExpressionSymbol;
import com.metamatrix.query.sql.symbol.GroupSymbol;
import com.metamatrix.query.sql.symbol.SingleElementSymbol;
import com.metamatrix.query.sql.util.VariableContext;
-import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
import com.metamatrix.query.util.CommandContext;
/**
@@ -189,13 +178,18 @@
nameValueMap.putAll(QueryResolver.getVariableValues(parentProcCommand.getUserCommand(), metadata));
// validation visitor?
- QueryRewriter.rewrite(command, parentProcCommand, metadata,
- procEnv.getContext(), nameValueMap, parentProcCommand.getUserCommand().getType());
-
- if (dynamicCommand.getAsColumns() != null
+ if (dynamicCommand.getAsColumns() != null
&& !dynamicCommand.getAsColumns().isEmpty()) {
- command = wrapCommand(command);
+ command = QueryRewriter.createInlineViewQuery(new GroupSymbol("X"), command, metadata, dynamicCommand.getAsColumns()); //$NON-NLS-1$
+ if (dynamicCommand.getIntoGroup() != null) {
+ Insert insert = new Insert(dynamicCommand.getIntoGroup(), dynamicCommand.getAsColumns(), Collections.emptyList());
+ insert.setQueryExpression((Query)command);
+ command = insert;
+ }
}
+
+ command = QueryRewriter.rewrite(command, parentProcCommand, metadata,
+ procEnv.getContext(), nameValueMap, parentProcCommand.getUserCommand().getType());
ProcessorPlan commandPlan = QueryOptimizer.optimizePlan(command, metadata,
idGenerator, capFinder, AnalysisRecord
@@ -247,92 +241,6 @@
}
/**
- * @param command
- * @return
- * @throws QueryResolverException
- * @throws MetaMatrixComponentException
- */
- private Query wrapCommand(Command command) throws QueryResolverException,
- MetaMatrixComponentException {
- Collection groups = GroupCollectorVisitor.getGroups(command, true);
- int i = 0;
- String subquery_group_name = "X"; //$NON-NLS-1$
- GroupSymbol groupSymbol = new GroupSymbol(subquery_group_name);
- while (groups.contains(groupSymbol)) {
- subquery_group_name = "X" + i; //$NON-NLS-1$
- i++;
- groupSymbol = new GroupSymbol(subquery_group_name);
- }
-
- Select select = new Select();
-
- Map shortNameMap = createShortNameMap(command.getProjectedSymbols());
-
- Iterator columns = dynamicCommand.getAsColumns().iterator();
- while (columns.hasNext()) {
- Class projectedSymbolType = null;
- ElementSymbol expectedSymbol = (ElementSymbol) columns.next();
- String expectedName = expectedSymbol.getShortCanonicalName();
- String actualName = expectedName;
- boolean shouldAlias = false;
-
- if (dynamicCommand.getAsColumns().size() == 1) {
- SingleElementSymbol projectedSymbol = (SingleElementSymbol) command
- .getProjectedSymbols().get(0);
- actualName = projectedSymbol.getShortCanonicalName();
- projectedSymbolType = projectedSymbol.getType();
- shouldAlias = !actualName.equals(expectedName);
- } else {
- projectedSymbolType = (Class)shortNameMap.get(expectedName);
- }
- SingleElementSymbol wrappedSymbol = new ElementSymbol(groupSymbol
- .getCanonicalName()
- + SingleElementSymbol.SEPARATOR
- + actualName);
-
- Expression result = ResolverUtil.convertExpression(wrappedSymbol, DataTypeManager.getDataTypeName(projectedSymbolType), DataTypeManager.getDataTypeName(expectedSymbol.getType()));
-
- if (!(result instanceof SingleElementSymbol)) {
- wrappedSymbol = new ExpressionSymbol(expectedName, result);
- shouldAlias = true;
- }
- if (shouldAlias) {
- wrappedSymbol = new AliasSymbol(expectedName, wrappedSymbol);
- }
-
- select.addSymbol(wrappedSymbol);
- }
- Query query = new Query();
- query.setSelect(select);
- From from = new From();
-
- GroupSymbol inlineGroup = new GroupSymbol(subquery_group_name);
-
- from.addClause(new UnaryFromClause(inlineGroup));
- TempMetadataStore store = new TempMetadataStore();
- TempMetadataAdapter tma = new TempMetadataAdapter(metadata, store);
-
- store.addTempGroup(inlineGroup.getName(), command.getProjectedSymbols());
- inlineGroup.setMetadataID(store.getTempGroupID(inlineGroup.getName()));
- query.setFrom(from);
- QueryResolver.resolveCommand(query, tma);
- query.setOption(command.getOption());
-
- from.getClauses().clear();
- SubqueryFromClause sqfc = new SubqueryFromClause(inlineGroup.getName());
- sqfc.setCommand(command);
- sqfc.getGroupSymbol().setMetadataID(inlineGroup.getMetadataID());
- from.addClause(sqfc);
- //copy the metadata onto the new query so that temp metadata adapters will be used in later calls
- query.getTemporaryMetadata().putAll(store.getData());
-
- if (dynamicCommand.getIntoGroup() != null) {
- query.setInto(new Into(dynamicCommand.getIntoGroup()));
- }
- return query;
- }
-
- /**
* @param localContext
* @return
*/
@@ -361,53 +269,32 @@
QueryProcessingException {
// validate project symbols
List dynamicExpectedColumns = dynamicCommand.getAsColumns();
- List sourceProjectedSymbolList = command.getProjectedSymbols();
+ List<SingleElementSymbol> sourceProjectedSymbolList = command.getProjectedSymbols();
if (dynamicExpectedColumns != null && !dynamicExpectedColumns.isEmpty()) {
- if (dynamicExpectedColumns.size() != sourceProjectedSymbolList
- .size()) {
+ if (dynamicExpectedColumns.size() != sourceProjectedSymbolList.size()) {
throw new QueryProcessingException(QueryExecPlugin.Util
.getString("ExecDynamicSqlInstruction.4")); //$NON-NLS-1$
}
// If there is only one project symbol, we won't validate the name.
Iterator dynamicIter = dynamicExpectedColumns.iterator();
- Map sourceMap = createShortNameMap(sourceProjectedSymbolList);
-
+ Iterator<SingleElementSymbol> sourceIter = sourceProjectedSymbolList.iterator();
// Check for proper element name and datatype definition in the
// dynamic SQL
// If the projected symbol list equal to 1, we won't bother checking
// the name.
while (dynamicIter.hasNext()) {
- SingleElementSymbol dynamicSymbol = (SingleElementSymbol) dynamicIter
- .next();
- Object sourceSymbolDatatype = null;
- // If the project list is greater than one, use the dynamic
- // symbol
- // to get the source project. Otherwise just get the one and
- // only.
- if (dynamicExpectedColumns.size() > 1) {
- sourceSymbolDatatype = sourceMap.get(dynamicSymbol
- .getShortCanonicalName());
+ SingleElementSymbol dynamicSymbol = (SingleElementSymbol) dynamicIter.next();
+ Class<?> sourceSymbolDatatype = sourceIter.next().getType();
- if (sourceSymbolDatatype == null) {
- Object[] params = new Object[] { dynamicSymbol
- .getShortCanonicalName() };
- throw new QueryProcessingException(QueryExecPlugin.Util
- .getString(
- "ExecDynamicSqlInstruction.5", params)); //$NON-NLS-1$
- }
- } else {
- sourceSymbolDatatype = sourceMap.values().iterator().next();
- }
-
// Check if the the dynamic sql element types are equal or
// implicitly convertible to the source types
- Class dynamicType = dynamicSymbol.getType();
+ Class<?> dynamicType = dynamicSymbol.getType();
String dynamicTypeName = DataTypeManager
.getDataTypeName(dynamicType);
String sourceTypeName = DataTypeManager
- .getDataTypeName((Class) sourceSymbolDatatype);
+ .getDataTypeName(sourceSymbolDatatype);
if (!dynamicTypeName.equals(sourceTypeName)
&& // If the types aren't the same, and...
!DataTypeManager.isImplicitConversion(sourceTypeName,
@@ -444,23 +331,6 @@
}
/**
- * @param sourceProjectedSymbolList
- * @return
- */
- private Map createShortNameMap(List sourceProjectedSymbolList) {
- Iterator sourceIter = sourceProjectedSymbolList.iterator();
- Map sourceMap = new HashMap();
-
- // Load source project symbol map
- while (sourceIter.hasNext()) {
- SingleElementSymbol symbol = (SingleElementSymbol) sourceIter
- .next();
- sourceMap.put(symbol.getShortCanonicalName(), symbol.getType());
- }
- return sourceMap;
- }
-
- /**
* Returns a deep clone
*/
public Object clone() {
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -473,7 +473,7 @@
tempTables.addAll(current);
for (Iterator i = tempTables.iterator(); i.hasNext();) {
- removeResults((String)i.next());
+ this.tempTableStore.removeTempTableByName((String)i.next());
}
this.tempContext.removeLast();
@@ -565,7 +565,6 @@
throw new MetaMatrixComponentException(e, ErrorMessageKeys.PROCESSOR_0022, QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0022, (String) null));
}
LogManager.logTrace(LogConstants.CTX_DQP, new Object[]{"removed tuple source", state.tsID, "for result set"}); //$NON-NLS-1$ //$NON-NLS-2$
- this.tempTableStore.removeTempTableByName(rsKey);
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/resolver/command/InsertResolver.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -55,6 +55,7 @@
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.Expression;
import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.symbol.Reference;
import com.metamatrix.query.util.ErrorMessageKeys;
/**
@@ -75,7 +76,7 @@
//variables and values must be resolved separately to account for implicitly defined temp groups
resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
-
+
//resolve subquery if there
if(insert.getQueryExpression() != null) {
QueryResolver.setChildMetadata(insert.getQueryExpression(), command);
@@ -83,7 +84,7 @@
QueryResolver.resolveCommand(insert.getQueryExpression(), Collections.EMPTY_MAP, useMetadataCommands, metadata.getMetadata(), analysis, false);
}
- Set groups = new HashSet();
+ Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(insert.getGroup());
if (insert.getVariables().isEmpty()) {
@@ -114,11 +115,21 @@
//ensure that the types match
resolveTypes(insert);
}
+
+ if (insert.getQueryExpression() != null && metadata.isVirtualGroup(insert.getGroup().getMetadataID())) {
+ List<Reference> references = new ArrayList<Reference>(insert.getVariables().size());
+ for (int i = 0; i < insert.getVariables().size(); i++) {
+ Reference ref = new Reference(i);
+ ref.setType(((ElementSymbol)insert.getVariables().get(i)).getType());
+ references.add(ref);
+ }
+ insert.setValues(references);
+ }
}
private void resolveVariables(TempMetadataAdapter metadata,
Insert insert,
- Set groups) throws MetaMatrixComponentException,
+ Set<GroupSymbol> groups) throws MetaMatrixComponentException,
QueryResolverException {
try {
resolveList(insert.getVariables(), metadata, null, groups);
@@ -128,7 +139,7 @@
}
private void resolveList(Collection elements, TempMetadataAdapter metadata,
- GroupContext externalGroups, Set groups) throws MetaMatrixComponentException,
+ GroupContext externalGroups, Set<GroupSymbol> groups) throws MetaMatrixComponentException,
QueryResolverException {
for (Iterator i = elements.iterator(); i.hasNext();) {
Expression expr = (Expression)i.next();
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -700,7 +700,7 @@
return translatedCriteria;
}
- private Query rewriteQuery(Query query)
+ private Command rewriteQuery(Query query)
throws QueryValidatorException {
// Rewrite from clause
@@ -778,7 +778,7 @@
} catch (QueryResolverException err) {
throw new QueryValidatorException(err, err.getMessage());
} catch (MetaMatrixComponentException err) {
- throw new QueryValidatorException(err, err.getMessage());
+ throw new MetaMatrixRuntimeException(err);
}
Iterator iter = outerQuery.getSelect().getProjectedSymbols().iterator();
HashMap<Expression, SingleElementSymbol> expressionMap = new HashMap<Expression, SingleElementSymbol>();
@@ -818,7 +818,7 @@
}
if (query.getInto() != null) {
- query = rewriteSelectInto(query);
+ return rewriteSelectInto(query);
}
return query;
@@ -911,37 +911,43 @@
* @param query
* @throws QueryValidatorException
*/
- private Query rewriteSelectInto(Query query) throws QueryValidatorException {
+ private Insert rewriteSelectInto(Query query) throws QueryValidatorException {
Into into = query.getInto();
-
try {
- List allIntoElements = ResolverUtil.resolveElementsInGroup(into.getGroup(), metadata);
- boolean needsView = false;
-
- for (int i = 0; !needsView && i < allIntoElements.size(); i++) {
- SingleElementSymbol ses = (SingleElementSymbol)allIntoElements.get(i);
- if (ses.getType() != ((SingleElementSymbol)query.getSelect().getProjectedSymbols().get(i)).getType()) {
- needsView = true;
- }
- }
-
- if (needsView) {
- query.setInto(null);
- query = createInlineViewQuery(into.getGroup(), query);
- query.setInto(into);
- return query;
- }
- return query;
+ List<ElementSymbol> allIntoElements = deepClone(ResolverUtil.resolveElementsInGroup(into.getGroup(), metadata), ElementSymbol.class);
+ Insert insert = new Insert(into.getGroup(), allIntoElements, Collections.emptyList());
+ query.setInto(null);
+ insert.setQueryExpression(query);
+ return correctDatatypes(insert);
} catch (QueryMetadataException err) {
throw new QueryValidatorException(err, err.getMessage());
- } catch (QueryResolverException err) {
- throw new QueryValidatorException(err, err.getMessage());
} catch (MetaMatrixComponentException err) {
throw new QueryValidatorException(err, err.getMessage());
- }
-
+ }
}
+ private Insert correctDatatypes(Insert insert) throws QueryValidatorException {
+ boolean needsView = false;
+ for (int i = 0; !needsView && i < insert.getVariables().size(); i++) {
+ SingleElementSymbol ses = (SingleElementSymbol)insert.getVariables().get(i);
+ if (ses.getType() != insert.getQueryExpression().getProjectedSymbols().get(i).getType()) {
+ needsView = true;
+ }
+ }
+ if (needsView) {
+ try {
+ insert.setQueryExpression(createInlineViewQuery(insert.getGroup(), insert.getQueryExpression(), metadata, insert.getVariables()));
+ } catch (QueryResolverException e) {
+ throw new QueryValidatorException(e, e.getMessage());
+ } catch (QueryMetadataException e) {
+ throw new QueryValidatorException(e, e.getMessage());
+ } catch (MetaMatrixComponentException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+ return insert;
+ }
+
private void correctProjectedTypes(List actualSymbolTypes, Query query) {
List symbols = query.getSelect().getProjectedSymbols();
@@ -1177,7 +1183,7 @@
} catch(CriteriaEvaluationException e) {
throw new QueryValidatorException(e, ErrorMessageKeys.REWRITER_0001, QueryExecPlugin.Util.getString(ErrorMessageKeys.REWRITER_0001, crit));
} catch(MetaMatrixComponentException e) {
- throw new QueryValidatorException(e, ErrorMessageKeys.REWRITER_0001, QueryExecPlugin.Util.getString(ErrorMessageKeys.REWRITER_0001, crit));
+ throw new MetaMatrixRuntimeException(e);
}
}
@@ -2113,7 +2119,7 @@
}
throw new QueryValidatorException(e, e.getMessage());
} catch(MetaMatrixComponentException e) {
- throw new QueryValidatorException(e, ErrorMessageKeys.REWRITER_0005, QueryExecPlugin.Util.getString(ErrorMessageKeys.REWRITER_0005, function));
+ throw new MetaMatrixRuntimeException(e);
}
}
return function;
@@ -2288,30 +2294,12 @@
return storedProcedure;
}
- private Command rewriteInsert(Insert insert) throws QueryValidatorException {
+ private Insert rewriteInsert(Insert insert) throws QueryValidatorException {
if ( insert.getQueryExpression() != null ) {
- Query query = null;
- QueryCommand nested = insert.getQueryExpression();
- rewriteCommand(nested, true);
- if(nested instanceof SetQuery) {
- try {
- query = createInlineViewQuery(insert.getGroup(), nested);
- } catch (QueryMetadataException err) {
- throw new QueryValidatorException(err, err.getMessage());
- } catch (QueryResolverException err) {
- throw new QueryValidatorException(err, err.getMessage());
- } catch (MetaMatrixComponentException err) {
- throw new QueryValidatorException(err, err.getMessage());
- }
- } else {
- query = (Query)nested;
- query.setOption(insert.getOption());
- }
- query.setInto( new Into( insert.getGroup() ) );
- return query;
+ insert.setQueryExpression((QueryCommand)rewriteCommand(insert.getQueryExpression(), true));
+ return correctDatatypes(insert);
}
-
// Evaluate any function / constant trees in the insert values
List expressions = insert.getValues();
List evalExpressions = new ArrayList(expressions.size());
@@ -2322,23 +2310,13 @@
}
insert.setValues(evalExpressions);
-
return insert;
}
- /**
- * Creates an inline view around the target query.
- */
- private Query createInlineViewQuery(GroupSymbol group,
- QueryCommand nested) throws QueryMetadataException, QueryResolverException, MetaMatrixComponentException {
- List actualSymbols = ResolverUtil.resolveElementsInGroup(group, metadata);
- return createInlineViewQuery(group, nested, metadata, actualSymbols);
- }
-
- private static Query createInlineViewQuery(GroupSymbol group,
- QueryCommand nested,
+ public static Query createInlineViewQuery(GroupSymbol group,
+ Command nested,
QueryMetadataInterface metadata,
- List actualSymbols) throws QueryMetadataException,
+ List<SingleElementSymbol> actualSymbols) throws QueryMetadataException,
QueryResolverException,
MetaMatrixComponentException {
Query query = new Query();
@@ -2349,20 +2327,31 @@
from.addClause(new UnaryFromClause(inlineGroup));
TempMetadataStore store = new TempMetadataStore();
TempMetadataAdapter tma = new TempMetadataAdapter(metadata, store);
- Query firstProject = nested.getProjectedQuery();
- makeSelectUnique(firstProject.getSelect(), false);
-
+ if (nested instanceof QueryCommand) {
+ Query firstProject = ((QueryCommand)nested).getProjectedQuery();
+ makeSelectUnique(firstProject.getSelect(), false);
+ }
store.addTempGroup(inlineGroup.getName(), nested.getProjectedSymbols());
inlineGroup.setMetadataID(store.getTempGroupID(inlineGroup.getName()));
- List actualTypes = new ArrayList(nested.getProjectedSymbols().size());
-
- for (Iterator i = actualSymbols.iterator(); i.hasNext();) {
- SingleElementSymbol ses = (SingleElementSymbol)i.next();
+ List<Class<?>> actualTypes = new ArrayList<Class<?>>(nested.getProjectedSymbols().size());
+ for (SingleElementSymbol ses : actualSymbols) {
actualTypes.add(ses.getType());
}
- List selectSymbols = SetQuery.getTypedProjectedSymbols(ResolverUtil.resolveElementsInGroup(inlineGroup, tma), actualTypes);
- select.addSymbols(deepClone(selectSymbols, SingleElementSymbol.class));
+ List<SingleElementSymbol> selectSymbols = SetQuery.getTypedProjectedSymbols(ResolverUtil.resolveElementsInGroup(inlineGroup, tma), actualTypes);
+ Iterator<SingleElementSymbol> iter = actualSymbols.iterator();
+ for (SingleElementSymbol ses : selectSymbols) {
+ ses = (SingleElementSymbol)ses.clone();
+ SingleElementSymbol actual = iter.next();
+ if (!ses.getShortCanonicalName().equals(actual.getShortCanonicalName())) {
+ if (ses instanceof AliasSymbol) {
+ ((AliasSymbol)ses).setName(actual.getShortName());
+ } else {
+ ses = new AliasSymbol(actual.getShortName(), ses);
+ }
+ }
+ select.addSymbol(ses);
+ }
query.setFrom(from);
QueryResolver.resolveCommand(query, tma);
query.setOption(nested.getOption());
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -152,7 +152,7 @@
* is not safe to manipulate (see @link#CommandContainer insead)
* @return
*/
- public List getSubCommands() {
+ public List<Command> getSubCommands() {
return CommandCollectorVisitor.getCommands(this);
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/CommandCollectorVisitor.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -32,6 +32,7 @@
import com.metamatrix.query.sql.lang.BatchedUpdateCommand;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.ExistsCriteria;
+import com.metamatrix.query.sql.lang.Insert;
import com.metamatrix.query.sql.lang.ProcedureContainer;
import com.metamatrix.query.sql.lang.SetQuery;
import com.metamatrix.query.sql.lang.SubqueryCompareCriteria;
@@ -201,7 +202,7 @@
modes.add(Mode.NON_EMBEDDED);
}
CommandCollectorVisitor visitor = new CommandCollectorVisitor(modes);
- final boolean visitCommands = command instanceof SetQuery;
+ final boolean visitCommands = command instanceof SetQuery || command instanceof Insert;
PreOrderNavigator navigator = new PreOrderNavigator(visitor) {
@Override
Modified: trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -663,6 +663,9 @@
if(isXMLCommand(subQuery)) {
handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0034), query);
}
+ if (subQuery instanceof Query && ((Query)subQuery).getInto() != null) {
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.union_insert"), query); //$NON-NLS-1$
+ }
}
if (!query.isAll() || query.getOperation() == Operation.EXCEPT || query.getOperation() == Operation.INTERSECT) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -614,7 +614,7 @@
copy.pushCall(recursionGroup);
}
- QueryRewriter.rewrite(newCommand, null, metadata, copy);
+ newCommand = QueryRewriter.rewrite(newCommand, null, metadata, copy);
ProcessorPlan plan = QueryOptimizer.optimizePlan(newCommand, metadata, idGenerator, capabilitiesFinder, analysisRecord, copy);
return new QueryProcessor(plan, copy, bufferManager, processorDataManager);
}
Modified: trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/main/resources/com/metamatrix/query/i18n.properties 2009-09-23 18:22:50 UTC (rev 1466)
@@ -282,6 +282,7 @@
ValidationVisitor.limit_not_valid_for_xml=The limit clause cannot be used on an XML document query.
ValidationVisitor.translated_or=Translated user criteria must not contain OR criteria
ValidateCriteriaVistitor.element_not_comparable = The following data elements are not supported in comparison criteria: {0}.
+ValidationVisitor.union_insert = Select into is not allowed under a set operation: {0}.
ERR.015.012.0028 = The following data elements are not supported in match criteria: {0}.
ERR.015.012.0029 = INSERT, UPDATE, and DELETE not allowed on XML documents
ERR.015.012.0030 = Commands used in stored procedure language not allowed on XML documents
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -71,7 +71,7 @@
QueryMetadataException {
QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
- QueryParser parser = new QueryParser();
+ QueryParser parser = QueryParser.getQueryParser();
Command userCommand = userQuery != null ? parser.parseCommand(userQuery) : parser.parseCommand(procedure);
QueryResolver.resolveCommand(userCommand, metadata);
ValidatorReport report = Validator.validate(userCommand, metadata);
@@ -80,7 +80,7 @@
ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
throw new QueryValidatorException(firstFailure.getMessage());
}
- QueryRewriter.rewrite(userCommand, null, metadata, null);
+ userCommand = QueryRewriter.rewrite(userCommand, null, metadata, null);
AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestAliasGenerator.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -45,7 +45,7 @@
boolean aliasGroups,
QueryMetadataInterface metadata) throws QueryValidatorException {
Command command = TestResolver.helpResolve(sql, metadata, null);
- QueryRewriter.rewrite(command, null, metadata, null);
+ command = QueryRewriter.rewrite(command, null, metadata, null);
command.acceptVisitor(new AliasGenerator(aliasGroups));
assertEquals(expected, command.toString());
return command;
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -142,58 +142,39 @@
static ProcessorPlan helpGetPlan(Command command, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context) {
if(DEBUG) System.out.println("\n####################################\n" + command); //$NON-NLS-1$
-
- // resolve
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
try {
QueryResolver.resolveCommand(command, metadata);
- } catch(Throwable e) {
- throw new MetaMatrixRuntimeException(e);
- }
- ValidatorReport repo = null;
- try {
- repo = Validator.validate(command, metadata);
- } catch (MetaMatrixComponentException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- Collection failures = new ArrayList();
- repo.collectInvalidObjects(failures);
- if (failures.size() > 0){
- fail("Exception during validation (" + repo); //$NON-NLS-1$
- }
-
- // rewrite
- try {
+ ValidatorReport repo = Validator.validate(command, metadata);
+ Collection failures = new ArrayList();
+ repo.collectInvalidObjects(failures);
+ if (failures.size() > 0){
+ fail("Exception during validation (" + repo); //$NON-NLS-1$
+ }
command = QueryRewriter.rewrite(command, null, metadata, createCommandContext());
- } catch(Throwable e) {
- throw new MetaMatrixRuntimeException(e);
- }
+ ProcessorPlan process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context);
+ if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
+ //per defect 10022, clone this plan before processing, just to make sure
+ //a cloned plan with correlated subquery references (or any cloned plan) can be processed
+ ProcessorPlan cloned = (ProcessorPlan)process.clone();
+ process = cloned;
+
+ assertNotNull("Output elements of process plan are null", process.getOutputElements()); //$NON-NLS-1$
-// // plan
- ProcessorPlan process = null;
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
- try {
- process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context);
- } catch(Throwable e) {
- throw new MetaMatrixRuntimeException(e);
+ // verify we can get child plans for any plan with no problem
+ process.getChildPlans();
+
+ return process;
+ } catch (MetaMatrixComponentException e) {
+ throw new RuntimeException(e);
+ } catch (MetaMatrixProcessingException e) {
+ throw new RuntimeException(e);
} finally {
if(DEBUG) {
System.out.println(analysisRecord.getDebugLog());
}
}
- if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
-
- //per defect 10022, clone this plan before processing, just to make sure
- //a cloned plan with correlated subquery references (or any cloned plan) can be processed
- ProcessorPlan cloned = (ProcessorPlan)process.clone();
- process = cloned;
-
- assertNotNull("Output elements of process plan are null", process.getOutputElements()); //$NON-NLS-1$
-
- // verify we can get child plans for any plan with no problem
- process.getChildPlans();
-
- return process;
}
public static void helpProcess(ProcessorPlan plan, ProcessorDataManager dataManager, List[] expectedResults) {
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestTempTables.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestTempTables.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestTempTables.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -26,7 +26,6 @@
import java.util.List;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -52,11 +51,10 @@
dataManager = new TempTableDataManager(fdm, tempStore);
}
- @Ignore("need to correct select into query formation")
@Test public void testInsertWithQueryExpression() throws Exception {
execute("create local temporary table x (e1 string, e2 integer)", new List[] {Arrays.asList(0)}); //$NON-NLS-1$
execute("insert into x (e2, e1) select e2, e1 from pm1.g1", new List[] {Arrays.asList(6)}); //$NON-NLS-1$
- execute("update x set e1 = e2 where e2 > 1", new List[] {Arrays.asList(6)}); //$NON-NLS-1$
+ execute("update x set e1 = e2 where e2 > 1", new List[] {Arrays.asList(2)}); //$NON-NLS-1$
}
@Test public void testOutofOrderInsert() throws Exception {
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/SimpleQueryProcessorFactory.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -63,7 +63,7 @@
throws MetaMatrixProcessingException, MetaMatrixComponentException {
Command command = QueryParser.getQueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
- QueryRewriter.rewrite(command, null, metadata, commandContext);
+ command = QueryRewriter.rewrite(command, null, metadata, commandContext);
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata,
idGenerator, finder, AnalysisRecord.createNonRecordingRecord(),
commandContext);
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -1603,7 +1603,7 @@
helpTestProcessFailure(false, plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'EXEC pm1.sq1(''First'')' AS e1 string, e2 integer\" with the SQL statement \"'EXEC pm1.sq1(''First'')'\" due to: The dynamic sql string contains an incorrect number of elements."); //$NON-NLS-1$
}
- @Test public void testDynamicCommandIncorrectProjectSymbolNames() throws Exception {
+ @Test public void testDynamicCommandPositional() throws Exception {
//Tests dynamic query with incorrect number of elements
FakeMetadataFacade metadata = FakeMetadataFactory.example1();
@@ -1625,7 +1625,9 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(false, plan, dataMgr, "Couldn't execute the dynamic SQL command \"EXECUTE STRING 'select e1 as x, e2 from pm1.g1'\" with the SQL statement \"'select e1 as x, e2 from pm1.g1'\" due to: No match found for expected symbol 'E1' in the dynamic SQL."); //$NON-NLS-1$
+ helpTestProcess(plan, new List[] {Arrays.asList("First", "5"), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList("Second", "15"), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList("Third", "51")}, dataMgr); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testDynamicCommandIncorrectProjectSymbolDatatypes() throws Exception {
Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestOrderByRewrite.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -55,9 +55,7 @@
QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
- QueryRewriter.rewrite(command, null, FakeMetadataFactory.example1Cached(), null);
-
- return command;
+ return QueryRewriter.rewrite(command, null, FakeMetadataFactory.example1Cached(), null);
}
private void helpCheckElements(OrderBy langObj,
Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -1945,7 +1945,7 @@
@Test public void testRewriteSelectInto() {
String sql = "select distinct pm1.g1.e1 into #temp from pm1.g1"; //$NON-NLS-1$
- String expected = "SELECT DISTINCT pm1.g1.e1 INTO #temp FROM pm1.g1"; //$NON-NLS-1$
+ String expected = "INSERT INTO #temp (#TEMP.E1) SELECT DISTINCT pm1.g1.e1 FROM pm1.g1"; //$NON-NLS-1$
helpTestRewriteCommand(sql, expected);
}
@@ -1955,7 +1955,7 @@
*/
@Test public void testRewriteSelectInto1() {
String sql = "select distinct e2, e2, e3, e4 into pm1.g1 from pm1.g2"; //$NON-NLS-1$
- String expected = "SELECT PM1_G1_1.E2 AS E2, PM1_G1_1.E2_0, PM1_G1_1.E3, PM1_G1_1.E4 INTO pm1.g1 FROM (SELECT DISTINCT e2, e2 AS E2_0, e3, e4 FROM pm1.g2) AS pm1_g1_1"; //$NON-NLS-1$
+ String expected = "INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4) SELECT PM1_G1_1.E2 AS e1, PM1_G1_1.E2_0 AS e2, PM1_G1_1.E3, PM1_G1_1.E4 FROM (SELECT DISTINCT e2, e2 AS E2_0, e3, e4 FROM pm1.g2) AS pm1_g1_1"; //$NON-NLS-1$
helpTestRewriteCommand(sql, expected);
}
@@ -2020,16 +2020,9 @@
procedure += "Select x from temp;\n"; //$NON-NLS-1$
procedure += "END\n"; //$NON-NLS-1$
- helpTestRewriteCommand(procedure, "CREATE VIRTUAL PROCEDURE\nBEGIN\nCREATE LOCAL TEMPORARY TABLE temp (x string, y integer, z integer);\nSELECT TEMP_1.E2 AS E2, TEMP_1.X, TEMP_1.X_0 INTO temp FROM (SELECT pm1.g1.e2, 1 AS x, 2 AS X_0 FROM pm1.g1 ORDER BY pm1.g1.e2 LIMIT 1) AS temp_1;\nSELECT x FROM temp;\nEND"); //$NON-NLS-1$
+ helpTestRewriteCommand(procedure, "CREATE VIRTUAL PROCEDURE\nBEGIN\nCREATE LOCAL TEMPORARY TABLE temp (x string, y integer, z integer);\nINSERT INTO temp (TEMP.X, TEMP.Y, TEMP.Z) SELECT TEMP_1.E2 AS X, TEMP_1.X AS Y, TEMP_1.X_0 AS Z FROM (SELECT pm1.g1.e2, 1 AS x, 2 AS X_0 FROM pm1.g1 ORDER BY pm1.g1.e2 LIMIT 1) AS temp_1;\nSELECT x FROM temp;\nEND"); //$NON-NLS-1$
}
-
- @Test public void testInsertWithQuery() throws Exception {
- String sql = "insert into pm1.g1 select e1, e2, e3, e4 from pm1.g2 union select e1, e2, e3, e4 from pm1.g2"; //$NON-NLS-1$
-
- helpTestRewriteCommand(sql, "SELECT PM1_G1_1.E1, PM1_G1_1.E2, PM1_G1_1.E3, PM1_G1_1.E4 INTO pm1.g1 FROM (SELECT e1, e2, e3, e4 FROM pm1.g2 UNION SELECT e1, e2, e3, e4 FROM pm1.g2) AS pm1_g1_1"); //$NON-NLS-1$
- }
-
@Test public void testRewriteNot() {
helpTestRewriteCriteria("not(not(pm1.g1.e1 = 1 + 1))", "pm1.g1.e1 = '2'"); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -48,8 +48,6 @@
import com.metamatrix.query.mapping.xml.MappingElement;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.StoredProcedureInfo;
-import com.metamatrix.query.metadata.TempMetadataAdapter;
-import com.metamatrix.query.metadata.TempMetadataStore;
import com.metamatrix.query.parser.QueryParser;
import com.metamatrix.query.resolver.QueryResolver;
import com.metamatrix.query.sql.LanguageObject;
@@ -583,6 +581,10 @@
helpValidate("SELECT e3 FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
+ public void testValidateSetSelectInto() {
+ helpValidate("SELECT e3 into #temp FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 INTO #temp FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public void testInsert1() {
helpValidate("INSERT INTO test.group (e0) VALUES (null)", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2009-09-23 15:39:01 UTC (rev 1465)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2009-09-23 18:22:50 UTC (rev 1466)
@@ -112,7 +112,7 @@
Command command = TestResolver.helpResolve(userSql, wrapper, analysis);
// Plan
- QueryRewriter.rewrite(command, null, wrapper, null);
+ command = QueryRewriter.rewrite(command, null, wrapper, null);
FakeCapabilitiesFinder fakeFinder = new FakeCapabilitiesFinder();
fakeFinder.addCapabilities(multiModel, TestOptimizer.getTypicalCapabilities());
15 years, 3 months
teiid SVN: r1465 - in trunk/connectors/connector-jdbc/src: test/java/org/teiid/connector/jdbc/oracle and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-23 11:39:01 -0400 (Wed, 23 Sep 2009)
New Revision: 1465
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
Log:
TEIID-852 fix to account for concat null in timestamp to time conversion.
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java 2009-09-23 14:35:41 UTC (rev 1464)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java 2009-09-23 15:39:01 UTC (rev 1465)
@@ -119,7 +119,7 @@
convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new FunctionModifier() {
@Override
public List<?> translate(IFunction function) {
- return Arrays.asList("to_date('1970-01-01 ' || to_char(",function.getParameters().get(0),", 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
+ return Arrays.asList("case when ", function.getParameters().get(0), " is null then null else to_date('1970-01-01 ' || to_char(",function.getParameters().get(0),", 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS') end"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
});
convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.DATE, new FunctionModifier() {
Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java 2009-09-23 14:35:41 UTC (rev 1464)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java 2009-09-23 15:39:01 UTC (rev 1465)
@@ -511,7 +511,7 @@
@Test public void testTimestampToTime() throws Exception {
Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
- helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "to_date('1970-01-01 ' || to_char({ts'2003-11-01 12:05:02.0'}, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "case when {ts'2003-11-01 12:05:02.0'} is null then null else to_date('1970-01-01 ' || to_char({ts'2003-11-01 12:05:02.0'}, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS') end"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java 2009-09-23 14:35:41 UTC (rev 1464)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java 2009-09-23 15:39:01 UTC (rev 1465)
@@ -150,14 +150,6 @@
input, output,
TRANSLATOR);
}
- @Test public void testConversion5() throws Exception {
- String input = "SELECT convert(convert(TIMESTAMPVALUE, time), string) FROM BQT1.SMALLA"; //$NON-NLS-1$
- String output = "SELECT to_char(to_date('1970-01-01 ' || to_char(SmallA.TimestampValue, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS'), 'HH24:MI:SS') FROM SmallA"; //$NON-NLS-1$
-
- MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
- input, output,
- TRANSLATOR);
- }
@Test public void testConversion6() throws Exception {
String input = "SELECT convert(convert(TIMEVALUE, timestamp), string) FROM BQT1.SMALLA"; //$NON-NLS-1$
String output = "SELECT to_char(cast(SmallA.TimeValue AS timestamp), 'YYYY-MM-DD HH24:MI:SS.FF') FROM SmallA"; //$NON-NLS-1$
15 years, 3 months
teiid SVN: r1464 - trunk/test-integration/db.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-23 10:35:41 -0400 (Wed, 23 Sep 2009)
New Revision: 1464
Modified:
trunk/test-integration/db/howto
Log:
Teiid 773 - update howto
Modified: trunk/test-integration/db/howto
===================================================================
--- trunk/test-integration/db/howto 2009-09-23 14:08:07 UTC (rev 1463)
+++ trunk/test-integration/db/howto 2009-09-23 14:35:41 UTC (rev 1464)
@@ -38,21 +38,30 @@
2. CREATE TABLES
To create the tables on the defined datasource, run the maven profile to execute the process to create the required tables:
- a. to setup all sources at one time, run: mvn pre-integration-test -P setupdatasources -Dmaven.test.skip=true
- b. to setup a specific source, run: mvn pre-integration-test -Ddatasource=<datasourcedir> -Psingledatasource -Dmaven.test.skip=true
+ a. to setup all sources at one time, run:
+ mvn pre-integration-test -P setupdatasources -Dmaven.test.skip=true
+ b. to setup a specific source,
+ run: mvn pre-integration-test -Ddatasource=<datasourcedir> -Psingledatasource -Dmaven.test.skip=true
where <datasourcedir> is the name of the directory for the datasource
-
-
+
+
+ Example:
+ mvn pre-integration-test -Ddatasource=oracle -Psingledatasource -Dmaven.test.skip=true
==========================================
Executing the db integration tests
==========================================
-The default profile in the pom.xml is set to compile and run the test. So running: mvn install
-will run the test.
-It will not setup a datasource. See above "Setting up a Datasource to be used during Testing".
+The default profile in the pom.xml is set to compile and run the test. The following are options for running tests:
+ a. Run with no regard to which specific datasource to use (only those with connections.properties file are considered):
+ run: mvn install
+ b. To run the tests, but specify which datasource(s) to use:
+ run: mvn clean install -Dusedatasources=<comma seperated datasource names>
+ Example: mvn clean install -Dusedatasources=oracle,sqlserver
+
+
\ No newline at end of file
15 years, 3 months
teiid SVN: r1463 - in trunk/console/src/test/java/org/teiid/rhq: comm/impl and 1 other directory.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-09-23 10:08:07 -0400 (Wed, 23 Sep 2009)
New Revision: 1463
Removed:
trunk/console/src/test/java/org/teiid/rhq/AllTests.java
Modified:
trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java
trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java
trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnectionFactory.java
trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeInvalidConnectionFactory.java
trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java
Log:
Updated copyright and removed AllTests class
Deleted: trunk/console/src/test/java/org/teiid/rhq/AllTests.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/AllTests.java 2009-09-23 14:00:44 UTC (rev 1462)
+++ trunk/console/src/test/java/org/teiid/rhq/AllTests.java 2009-09-23 14:08:07 UTC (rev 1463)
@@ -1,34 +0,0 @@
-/*
- * Copyright 2000-2008 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.rhq;
-
-import org.teiid.rhq.comm.impl.TestConnectionPool;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-
-/**
- * @since 1.0
- */
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.runAndWait(AllTests.suite());
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for com.metamatrix.rhq"); //$NON-NLS-1$
- //$JUnit-BEGIN$
- suite.addTest(TestConnectionPool.suite());
-
- //$JUnit-END$
- return suite;
- }
-
-
-
-}
Modified: trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java 2009-09-23 14:00:44 UTC (rev 1462)
+++ trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java 2009-09-23 14:08:07 UTC (rev 1463)
@@ -1,6 +1,23 @@
/*
- * Copyright 2000-2008 MetaMatrix, Inc.
- * All rights reserved.
+ * 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.rhq;
Modified: trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java 2009-09-23 14:00:44 UTC (rev 1462)
+++ trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java 2009-09-23 14:08:07 UTC (rev 1463)
@@ -1,6 +1,23 @@
/*
- * Copyright 2000-2008 MetaMatrix, Inc.
- * All rights reserved.
+ * 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.rhq.comm.impl;
Modified: trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnectionFactory.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnectionFactory.java 2009-09-23 14:00:44 UTC (rev 1462)
+++ trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnectionFactory.java 2009-09-23 14:08:07 UTC (rev 1463)
@@ -1,3 +1,24 @@
+/*
+ * 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.rhq.comm.impl;
Modified: trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeInvalidConnectionFactory.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeInvalidConnectionFactory.java 2009-09-23 14:00:44 UTC (rev 1462)
+++ trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeInvalidConnectionFactory.java 2009-09-23 14:08:07 UTC (rev 1463)
@@ -1,3 +1,24 @@
+/*
+ * 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.rhq.comm.impl;
Modified: trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java 2009-09-23 14:00:44 UTC (rev 1462)
+++ trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java 2009-09-23 14:08:07 UTC (rev 1463)
@@ -1,6 +1,23 @@
/*
- * Copyright 2000-2008 MetaMatrix, Inc.
- * All rights reserved.
+ * 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.rhq.comm.impl;
15 years, 3 months
teiid SVN: r1462 - in trunk/console/src/test/java/org/teiid/rhq: comm/impl and 1 other directory.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-09-23 10:00:44 -0400 (Wed, 23 Sep 2009)
New Revision: 1462
Modified:
trunk/console/src/test/java/org/teiid/rhq/AllTests.java
trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java
trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java
trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java
Log:
Fix UTF-8 issue in test classes
Modified: trunk/console/src/test/java/org/teiid/rhq/AllTests.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/AllTests.java 2009-09-22 22:05:47 UTC (rev 1461)
+++ trunk/console/src/test/java/org/teiid/rhq/AllTests.java 2009-09-23 14:00:44 UTC (rev 1462)
@@ -1,5 +1,5 @@
/*
- * Copyright � 2000-2008 MetaMatrix, Inc.
+ * Copyright 2000-2008 MetaMatrix, Inc.
* All rights reserved.
*/
package org.teiid.rhq;
Modified: trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java 2009-09-22 22:05:47 UTC (rev 1461)
+++ trunk/console/src/test/java/org/teiid/rhq/StartingEnvironmentConstants.java 2009-09-23 14:00:44 UTC (rev 1462)
@@ -1,5 +1,5 @@
/*
- * Copyright � 2000-2008 MetaMatrix, Inc.
+ * Copyright 2000-2008 MetaMatrix, Inc.
* All rights reserved.
*/
package org.teiid.rhq;
Modified: trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java 2009-09-22 22:05:47 UTC (rev 1461)
+++ trunk/console/src/test/java/org/teiid/rhq/comm/impl/FakeConnection.java 2009-09-23 14:00:44 UTC (rev 1462)
@@ -1,5 +1,5 @@
/*
- * Copyright � 2000-2008 MetaMatrix, Inc.
+ * Copyright 2000-2008 MetaMatrix, Inc.
* All rights reserved.
*/
package org.teiid.rhq.comm.impl;
Modified: trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java 2009-09-22 22:05:47 UTC (rev 1461)
+++ trunk/console/src/test/java/org/teiid/rhq/comm/impl/TestConnectionPool.java 2009-09-23 14:00:44 UTC (rev 1462)
@@ -1,5 +1,5 @@
/*
- * Copyright � 2000-2008 MetaMatrix, Inc.
+ * Copyright 2000-2008 MetaMatrix, Inc.
* All rights reserved.
*/
package org.teiid.rhq.comm.impl;
15 years, 3 months
teiid SVN: r1461 - trunk/test-integration/db/src/main/java/org/teiid/test/framework.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 18:05:47 -0400 (Tue, 22 Sep 2009)
New Revision: 1461
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
Log:
Teiid 773 - reorganized how datasources are referenced at all stages of a test
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-09-22 22:01:35 UTC (rev 1460)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-09-22 22:05:47 UTC (rev 1461)
@@ -9,8 +9,6 @@
import java.util.Set;
import org.teiid.test.framework.connection.ConnectionStrategy;
-import org.teiid.test.framework.datasource.DataSourceMgr;
-import org.teiid.test.framework.datasource.DataSourceSetupFactory;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
15 years, 3 months