Author: shawkins
Date: 2010-04-06 23:29:59 -0400 (Tue, 06 Apr 2010)
New Revision: 2031
Added:
trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java
trunk/documentation/reference/src/main/docbook/en-US/content/other_commands.xml
Removed:
trunk/client/src/main/java/org/teiid/client/plan/DefaultDisplayHelper.java
trunk/client/src/main/java/org/teiid/client/plan/DisplayHelper.java
trunk/client/src/main/java/org/teiid/client/plan/PlanVisitor.java
trunk/client/src/main/java/org/teiid/client/plan/TextOutputVisitor.java
trunk/client/src/main/java/org/teiid/client/plan/XMLOutputVisitor.java
trunk/client/src/test/java/org/teiid/client/plan/TestTextOutputVisitor.java
trunk/client/src/test/java/org/teiid/client/plan/TestXMLOutputVisitor.java
trunk/client/src/test/java/org/teiid/jdbc/TestMMDriver.java
trunk/documentation/reference/src/main/docbook/en-US/content/connectors.xml
trunk/engine/src/main/java/com/metamatrix/query/processor/Describable.java
trunk/engine/src/main/java/com/metamatrix/query/processor/DescribableUtil.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AbstractAssignmentInstruction.java
trunk/engine/src/test/java/org/teiid/adminapi/
Modified:
trunk/client/src/main/java/org/teiid/client/RequestMessage.java
trunk/client/src/main/java/org/teiid/client/ResultsMessage.java
trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java
trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java
trunk/client/src/test/java/org/teiid/client/TestRequestMessage.java
trunk/client/src/test/java/org/teiid/jdbc/TestMMStatement.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java
trunk/documentation/reference/src/main/docbook/en-US/Reference.xml
trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
trunk/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
trunk/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/BreakInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ContinueInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/AccessNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentAccessNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureAccessNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/LimitNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/NullNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectIntoNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SelectNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AbortProcessingInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddCommentInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddNodeInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/BlockInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndBlockInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndDocumentInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecSqlInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecStagingTableInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/IfInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/InitializeDocumentInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/JoinedWhileInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveCursorInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveDocInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ProcessorInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/Program.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/WhileInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPostProcessor.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/SQLStringVisitor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj
trunk/engine/src/test/java/com/metamatrix/dqp/message/TestResultsMessage.java
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java
trunk/engine/src/test/java/com/metamatrix/query/parser/TestOptionsAndHints.java
trunk/engine/src/test/java/com/metamatrix/query/parser/TestParserXQuery.java
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java
trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalNodeStatistics.java
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/NoOpInstruction.java
trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestOption.java
trunk/engine/src/test/java/com/metamatrix/query/sql/visitor/TestSQLStringVisitor.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
Log:
TEIID-908 TEIID-1040 refining the plannode logic and moving option debug, showplan, and
planonly to be set commands
Modified: trunk/client/src/main/java/org/teiid/client/RequestMessage.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/RequestMessage.java 2010-04-06 21:51:32
UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/RequestMessage.java 2010-04-07 03:29:59
UTC (rev 2031)
@@ -55,7 +55,6 @@
*/
public static final String TXN_WRAP_DETECT = "DETECT"; //$NON-NLS-1$
-
public enum StatementType {
PREPARED, CALLABLE, STATEMENT
}
@@ -63,6 +62,10 @@
public enum ResultsMode {
RESULTSET, UPDATECOUNT, EITHER
}
+
+ public enum ShowPlan {
+ ON, DEBUG, OFF
+ }
private String[] commands;
private boolean isBatchedUpdate;
@@ -80,11 +83,12 @@
private boolean useResultSetCache;
// Treat the double quoted strings as variables in the command
private boolean ansiQuotedIdentifiers = true;
- private boolean showPlan;
+ private ShowPlan showPlan = ShowPlan.OFF;
private int rowLimit;
private Serializable executionPayload;
private long executionId;
private int transactionIsolation;
+ private boolean noExec;
public RequestMessage() {
}
@@ -261,26 +265,16 @@
public void setAnsiQuotedIdentifiers(boolean ansiQuotedIdentifiers) {
this.ansiQuotedIdentifiers = ansiQuotedIdentifiers;
}
+
+ public ShowPlan getShowPlan() {
+ return showPlan;
+ }
+
+ public void setShowPlan(ShowPlan showPlan) {
+ this.showPlan = showPlan;
+ }
/**
- * @return Returns the showPlan.
- * @since 4.3
- */
- public boolean getShowPlan() {
- return this.showPlan;
- }
-
-
- /**
- * @param showPlan The showPlan to set.
- * @since 4.3
- */
- public void setShowPlan(boolean showPlan) {
- this.showPlan = showPlan;
- }
-
-
- /**
* @return Returns the rowLimit.
* @since 4.3
*/
@@ -344,6 +338,14 @@
public void setTransactionIsolation(int transactionIsolation) {
this.transactionIsolation = transactionIsolation;
}
+
+ public boolean isNoExec() {
+ return noExec;
+ }
+
+ public void setNoExec(boolean noExec) {
+ this.noExec = noExec;
+ }
@Override
public void readExternal(ObjectInput in) throws IOException,
@@ -362,11 +364,12 @@
this.resultsMode = ResultsMode.values()[in.readByte()];
this.useResultSetCache = in.readBoolean();
this.ansiQuotedIdentifiers = in.readBoolean();
- this.showPlan = in.readBoolean();
+ this.showPlan = ShowPlan.values()[in.readByte()];
this.rowLimit = in.readInt();
this.executionPayload = (Serializable)in.readObject();
this.executionId = in.readLong();
this.transactionIsolation = in.readInt();
+ this.noExec = in.readBoolean();
}
@Override
@@ -385,11 +388,12 @@
out.writeByte(resultsMode.ordinal());
out.writeBoolean(useResultSetCache);
out.writeBoolean(ansiQuotedIdentifiers);
- out.writeBoolean(showPlan);
+ out.writeByte(showPlan.ordinal());
out.writeInt(rowLimit);
out.writeObject(executionPayload);
out.writeLong(executionId);
out.writeInt(transactionIsolation);
+ out.writeBoolean(noExec);
}
}
Modified: trunk/client/src/main/java/org/teiid/client/ResultsMessage.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/ResultsMessage.java 2010-04-06 21:51:32
UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/ResultsMessage.java 2010-04-07 03:29:59
UTC (rev 2031)
@@ -29,9 +29,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.ExceptionHolder;
import com.metamatrix.api.exception.MetaMatrixException;
@@ -49,7 +49,7 @@
private String[] dataTypes = null;
/** A description of planning that occurred as requested in the request. */
- private Map planDescription;
+ private PlanNode planDescription;
/** An exception that occurred. */
private MetaMatrixException exception;
@@ -155,7 +155,7 @@
/**
* @return
*/
- public Map getPlanDescription() {
+ public PlanNode getPlanDescription() {
return planDescription;
}
@@ -201,7 +201,7 @@
/**
* @param object
*/
- public void setPlanDescription(Map object) {
+ public void setPlanDescription(PlanNode object) {
planDescription = object;
}
@@ -249,7 +249,7 @@
results = BatchSerializer.readBatch(in, dataTypes);
// Plan Descriptions
- planDescription = ExternalizeUtil.readMap(in);
+ planDescription = (PlanNode)in.readObject();
ExceptionHolder holder = (ExceptionHolder)in.readObject();
if (holder != null) {
@@ -281,7 +281,7 @@
BatchSerializer.writeBatch(out, dataTypes, results);
// Plan descriptions
- ExternalizeUtil.writeMap(out, planDescription);
+ out.writeObject(this.planDescription);
if (exception != null) {
out.writeObject(new ExceptionHolder(exception));
Deleted: trunk/client/src/main/java/org/teiid/client/plan/DefaultDisplayHelper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/DefaultDisplayHelper.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/plan/DefaultDisplayHelper.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,60 +0,0 @@
-/*
- * 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.client.plan;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Implement a default display helper that can be used with the {@link TextOutputVisitor}
- * and {@link XMLOutputVisitor}.
- */
-public class DefaultDisplayHelper implements DisplayHelper {
-
- public String getName(PlanNode node) {
- return (String)node.getProperties().get(PlanNode.TYPE);
- }
-
- public String getDescription(PlanNode node) {
- return ""; //$NON-NLS-1$
- }
-
- public List<String> getOrderedProperties(PlanNode node) {
- List<String> props = new
ArrayList<String>(node.getProperties().keySet());
- props.remove(PlanNode.TYPE);
- if(props.contains(PlanNode.OUTPUT_COLS)) {
- props.remove(PlanNode.OUTPUT_COLS);
- props.add(0, PlanNode.OUTPUT_COLS);
- }
- return props;
- }
-
- public String getPropertyName(String property) {
- return property;
- }
-
- public void setMaxDescriptionLength(int length) {
-
- }
-
-}
Deleted: trunk/client/src/main/java/org/teiid/client/plan/DisplayHelper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/DisplayHelper.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/plan/DisplayHelper.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,74 +0,0 @@
-/*
- * 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.client.plan;
-
-import java.util.List;
-
-/**
- * This interface is used to plug in display-specific information for the
- * {@link TextOutputVisitor}.
- */
-public interface DisplayHelper {
-
- /**
- * Get the name to use for this plan node. An obvious implementation
- * is to use the node's type.
- * @param node The node
- * @return The name, based on the node's information
- */
- String getName(PlanNode node);
-
- /**
- * Get the description to use for this plan node, which is usually displayed
- * after the name as a short description. The description should pull out
- * the most important information for a particular node type.
- * @param node The node
- * @return The description
- */
- String getDescription(PlanNode node);
-
- /**
- * Determine the proper order to display the properties of the node. The
- * returned List contains the property names as found in the node's
- * properties in the preferred order. If properties are omitted from the list,
- * they will not be displayed. Thus, this method can also filter what properties
- * are shown.
- * @param node The node
- * @return List of property names
- */
- List<String> getOrderedProperties(PlanNode node);
-
- /**
- * Get display name for a particular property name.
- * @param property The property name, as used in the node's properties
- * @return The desired display name for the property
- */
- String getPropertyName(String property);
-
- /**
- * A max description length so that the description can be truncated when necessary.
- * @param length Max string length
- */
- void setMaxDescriptionLength(int length);
-
-}
Modified: trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -22,23 +22,101 @@
package org.teiid.client.plan;
-import java.util.*;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
-public class PlanNode {
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
- //TODO: consolidate these constants with Describable
- public static final String OUTPUT_COLS = "outputCols"; //$NON-NLS-1$
- public static final String TYPE = "type"; //$NON-NLS-1$
- static final String PROP_CHILDREN = "children"; //$NON-NLS-1$
+import com.metamatrix.core.util.ExternalizeUtil;
+
+@XmlType
+@XmlRootElement(name="node")
+public class PlanNode implements Externalizable {
+
+ @XmlType(name = "property")
+ public static class Property implements Externalizable {
+ @XmlAttribute
+ private String name;
+ private List<String> values;
+ private PlanNode planNode;
+
+ public Property() {
+
+ }
+
+ public Property(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlElement(name="value")
+ public List<String> getValues() {
+ return values;
+ }
+
+ public void setValues(List<String> values) {
+ this.values = values;
+ }
+
+ @XmlElement(name="node")
+ public PlanNode getPlanNode() {
+ return planNode;
+ }
+
+ public void setPlanNode(PlanNode planNode) {
+ this.planNode = planNode;
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.name = (String)in.readObject();
+ this.values = ExternalizeUtil.readList(in, String.class);
+ this.planNode = (PlanNode)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(name);
+ ExternalizeUtil.writeCollection(out, values);
+ out.writeObject(planNode);
+ }
+
+ }
+
+ @XmlElement(name="property")
+ private List<Property> properties = new LinkedList<Property>();
+ private PlanNode parent;
+ @XmlAttribute
+ private String name;
- private Map<String, Object> props;
- private PlanNode parent;
- private List<PlanNode> children = new ArrayList<PlanNode>();
+ public PlanNode() {
+
+ }
- PlanNode(Map<String, Object> props) {
- this.props = props;
+ public PlanNode(String name) {
+ this.name = name;
}
-
+
+ public String getName() {
+ return name;
+ }
+
void setParent(PlanNode parent) {
this.parent = parent;
}
@@ -46,49 +124,105 @@
public PlanNode getParent() {
return this.parent;
}
-
- void addChild(PlanNode child) {
- children.add(child);
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public void addProperty(String pname, PlanNode value) {
+ Property p = new Property(pname);
+ p.setPlanNode(value);
+ value.setParent(this);
+ this.properties.add(p);
}
-
- public List<PlanNode> getChildren() {
- return this.children;
+
+ public void addProperty(String pname, List<String> value) {
+ Property p = new Property(pname);
+ p.setValues(value);
+ this.properties.add(p);
}
-
- public Map<String, Object> getProperties() {
- return this.props;
+
+ public void addProperty(String pname, String value) {
+ Property p = new Property(pname);
+ p.setValues(Arrays.asList(value));
+ this.properties.add(p);
}
- public static PlanNode constructFromMap(Map properties) {
- // Construct node without child property
- Map copy = new HashMap(properties);
- List childMaps = (List) copy.remove(PROP_CHILDREN);
+ public String toXml() throws JAXBException {
+ JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {PlanNode.class});
+ Marshaller marshaller = jc.createMarshaller();
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE); //$NON-NLS-1$
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(this, writer);
+ return writer.toString();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ visitNode(this, 0, builder);
+ return builder.toString();
+ }
+
+ /*
+ * @see
com.metamatrix.jdbc.plan.PlanVisitor#visitNode(com.metamatrix.jdbc.plan.PlanNode)
+ */
+ protected void visitNode(PlanNode node, int nodeLevel, StringBuilder text) {
+ for(int i=0; i<nodeLevel; i++) {
+ text.append(" "); //$NON-NLS-1$
+ }
+ text.append(node.getName());
+ text.append("\n"); //$NON-NLS-1$
- // Convert any subplans to PlanNodes as well
- Iterator keyIter = copy.keySet().iterator();
- while(keyIter.hasNext()) {
- Object key = keyIter.next();
- Object value = copy.get(key);
- if(value instanceof Map) {
- copy.put(key, constructFromMap((Map)value));
- }
+ // Print properties appropriately
+ int propTabs = nodeLevel + 1;
+ for (PlanNode.Property property : node.getProperties()) {
+ // Print leading spaces for prop name
+ for(int t=0; t<propTabs; t++) {
+ text.append(" "); //$NON-NLS-1$
+ }
+ printProperty(nodeLevel, property, text);
}
+ }
- // Construct this node
- PlanNode node = new PlanNode(copy);
-
- // Then construct children and connect
- if(childMaps != null) {
- for(int i=0; i<childMaps.size(); i++) {
- Map childMap = (Map) childMaps.get(i);
- PlanNode child = constructFromMap(childMap);
- child.setParent(node);
- node.addChild(child);
- }
+ private void printProperty(int nodeLevel, Property p, StringBuilder text) {
+ text.append("+ "); //$NON-NLS-1$
+ text.append(p.getName());
+
+ if (p.getPlanNode() != null) {
+ text.append(":\n"); //$NON-NLS-1$
+ visitNode(p.getPlanNode(), nodeLevel + 2, text);
+ } else if (p.getValues().size() > 1){
+ text.append(":\n"); //$NON-NLS-1$
+ for (int i = 0; i < p.getValues().size(); i++) {
+ for(int t=0; t<nodeLevel+2; t++) {
+ text.append(" "); //$NON-NLS-1$
+ }
+ text.append(i);
+ text.append(": "); //$NON-NLS-1$
+ text.append(p.getValues().get(i));
+ text.append("\n"); //$NON-NLS-1$
+ }
+ } else {
+ text.append(":"); //$NON-NLS-1$
+ text.append(p.getValues().get(0));
+ text.append("\n"); //$NON-NLS-1$
}
-
- // And return
- return node;
}
-
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.properties = ExternalizeUtil.readList(in, Property.class);
+ this.parent = (PlanNode)in.readObject();
+ this.name = (String)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ ExternalizeUtil.writeCollection(out, properties);
+ out.writeObject(this.parent);
+ out.writeObject(this.name);
+ }
+
}
Deleted: trunk/client/src/main/java/org/teiid/client/plan/PlanVisitor.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/PlanVisitor.java 2010-04-06 21:51:32
UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/plan/PlanVisitor.java 2010-04-07 03:29:59
UTC (rev 2031)
@@ -1,91 +0,0 @@
-/*
- * 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.client.plan;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * A helper class to walk a query plan and execute some action at each node.
- * Subclasses should override the appropriate visit() methods to get
- * notification when a node of each type is visited.
- */
-public abstract class PlanVisitor {
-
- /**
- * Construct the visitor with a reference to the root node.
- */
- public PlanVisitor() {
- }
-
-
- /**
- * <p>This method controls how a tree is visited from the rootNode. This
implementation
- * will walk the tree in pre-order (a node is visited before it's children) and
will
- * visit a particular node in the following order: node itself, each property of the
- * node, and finally the children of the node, in order.</p>
- *
- * <p>Subclasses may override this method to manipulate the visitor order if
desired.</p>
- *
- * @param rootNode The rootNode of the tree
- */
- public void visit(PlanNode rootNode) {
- LinkedList<PlanNode> nodeStack = new LinkedList<PlanNode>();
- nodeStack.add(rootNode);
-
- while(! nodeStack.isEmpty()) {
- // Obtain next node
- PlanNode node = nodeStack.removeFirst();
-
- // Visit node
- visitNode(node);
-
- // Add children to stack
- nodeStack.addAll(node.getChildren());
- }
- }
-
- /**
- * Visit a node.
- * @param node The node being visited
- */
- protected abstract void visitNode(PlanNode node);
-
- /**
- * Visit a property value.
- * @param node The node being visited
- * @param propertyName The property name being visited
- * @param propertyValue The property value being visited
- */
- protected abstract void visitPropertyValue(PlanNode node, String propertyName, Object
propertyValue);
-
- /**
- * Visit a container property - the container property will be visited, then
- * each particular value of the container will be visited.
- * @param node The node being visited
- * @param propertyName The property name being visited
- * @param propertyValue The collection value being visited
- */
- protected abstract void visitContainerProperty(PlanNode node, String propertyName,
Collection propertyValue);
-
-}
Deleted: trunk/client/src/main/java/org/teiid/client/plan/TextOutputVisitor.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/TextOutputVisitor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/plan/TextOutputVisitor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,171 +0,0 @@
-/*
- * 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.client.plan;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This visitor class can be used to output a formatted text representation of the
- * plan.
- */
-public class TextOutputVisitor extends PlanVisitor {
-
- // Initialization state
- private DisplayHelper displayHelper;
- private int tabs = 0;
-
- // Processing state
- private Map nodeLevels = new HashMap();
- private StringBuffer text = new StringBuffer();
-
- /**
- * Construct the visitor.
- * @param displayHelper Helper to help format the display
- * @param initialTabs Number of tabs to put before every line
- */
- public TextOutputVisitor(DisplayHelper displayHelper, int initialTabs) {
- super();
- this.displayHelper = displayHelper;
- this.tabs = initialTabs;
- }
-
- /**
- * Return string representation of the plan
- * @return String representation of the plan
- */
- public String getText() {
- return this.text.toString();
- }
-
- /*
- * @see
com.metamatrix.jdbc.plan.PlanVisitor#visitNode(com.metamatrix.jdbc.plan.PlanNode)
- */
- protected void visitNode(PlanNode node) {
-
- // Determine level and record in nodeLevels
- PlanNode parent = node.getParent();
- Integer nodeLevel;
- if(parent == null) {
- nodeLevel = new Integer(0);
- } else {
- Integer parentLevel = (Integer) nodeLevels.get(parent);
- nodeLevel = new Integer(parentLevel.intValue() + 1);
- }
- nodeLevels.put(node, nodeLevel);
-
- // Start line for this node with indentation
- int numTabs = nodeLevel.intValue() + this.tabs;
- for(int i=0; i<numTabs; i++) {
- text.append(" "); //$NON-NLS-1$
- }
- String name=displayHelper.getName(node);
- text.append(name);
- text.append("\n"); //$NON-NLS-1$
-
- // Print properties appropriately
- int propTabs = numTabs + 1;
- List orderedProps = displayHelper.getOrderedProperties(node);
- for(int i=0; i< orderedProps.size(); i++) {
- String propName = (String) orderedProps.get(i);
- Object propObject=node.getProperties().get(propName);
-
- // Print leading spaces for prop name
- for(int t=0; t<propTabs; t++) {
- text.append(" "); //$NON-NLS-1$
- }
-
- // Print prop name and value
- if (propObject instanceof Collection) {
- printCollectionValue(propTabs, propName, propObject);
- } else if(propObject instanceof PlanNode) {
- printNodeValue(numTabs, propName, propObject);
- } else { // something like String, Integer, Boolean, etc
- printScalarValue(node, propName);
- }
- }
- }
-
- private void printScalarValue(PlanNode node, String propName) {
- text.append("+ "); //$NON-NLS-1$
- text.append(displayHelper.getPropertyName(propName));
- text.append(": "); //$NON-NLS-1$
- text.append(node.getProperties().get(propName));
- text.append("\n"); //$NON-NLS-1$
- }
-
- private void printNodeValue(int numTabs, String propName, Object propObject) {
- text.append("+ "); //$NON-NLS-1$
- text.append(displayHelper.getPropertyName(propName));
- text.append(":\n"); //$NON-NLS-1$
-
- TextOutputVisitor nestedVisitor = new TextOutputVisitor(this.displayHelper,
numTabs+2);
- PlanNode nestedNode = (PlanNode) propObject;
- nestedVisitor.visit(nestedNode);
- text.append(nestedVisitor.getText());
- }
-
- private void printCollectionValue(int propTabs, String propName, Object propObject)
{
- //Get the prop name from the key value
- text.append("+ "); //$NON-NLS-1$
- text.append(displayHelper.getPropertyName(propName));
- text.append(":\n"); //$NON-NLS-1$
- // Visit collection property
- Collection collection = (Collection) propObject;
- Iterator collectionIter = collection.iterator();
- for(int v=1; collectionIter.hasNext(); v++) {
- Object collectionValue = collectionIter.next();
- for(int t=0; t<propTabs+2; t++) {
- text.append(" "); //$NON-NLS-1$
- }
- text.append(v);
- text.append(": "); //$NON-NLS-1$
- text.append(collectionValue);
- text.append("\n"); //$NON-NLS-1$
- }
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.PlanVisitor#visitPropertyValue(java.lang.String,
java.lang.Object)
- */
- protected void visitPropertyValue(PlanNode node, String propertyName, Object
propertyValue) {
-
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.PlanVisitor#visitContainerProperty(java.lang.String,
java.util.Collection)
- */
- protected void visitContainerProperty(PlanNode node, String propertyName, Collection
propertyValue) {
-
- }
-
- public static String convertToText(PlanNode node, int initialTabs) {
- TextOutputVisitor visitor = new TextOutputVisitor(new DefaultDisplayHelper(),
initialTabs);
- visitor.visit(node);
- return visitor.getText();
- }
-
-}
Deleted: trunk/client/src/main/java/org/teiid/client/plan/XMLOutputVisitor.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/XMLOutputVisitor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/client/plan/XMLOutputVisitor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,221 +0,0 @@
-/*
- * 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.client.plan;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.core.util.StringUtil;
-
-/**
- * This visitor class can be used to output an XML representation of the plan.
- */
-public class XMLOutputVisitor {
-
- // Initialization state
- private DisplayHelper displayHelper;
- private int tabs = 0;
-
- // Processing state
- private Map nodeLevels = new HashMap();
- private StringBuffer text;
-
- public XMLOutputVisitor(DisplayHelper displayHelper) {
- this(displayHelper, 0, true);
- }
-
- public XMLOutputVisitor(DisplayHelper displayHelper, int initialTabs, boolean
printXMLHeader) {
- this.displayHelper = displayHelper;
- this.tabs = initialTabs;
-
- text = new StringBuffer();
- if(printXMLHeader) {
- text.append("<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$
- }
- }
-
- /**
- * Return string representation of the plan
- * @return String representation of the plan
- */
- public String getText() {
- return this.text.toString();
- }
-
- /*
- * @see
com.metamatrix.jdbc.plan.PlanVisitor#visitNode(com.metamatrix.jdbc.plan.PlanNode)
- */
- public void visit(PlanNode node) {
- // Determine level and record in nodeLevels
- PlanNode parent = node.getParent();
- Integer nodeLevel;
- if(parent == null) {
- nodeLevel = new Integer(0);
- } else {
- Integer parentLevel = (Integer) nodeLevels.get(parent);
- nodeLevel = new Integer(parentLevel.intValue() + 1);
- }
- nodeLevels.put(node, nodeLevel);
-
- // Start line for this node with indentation
- int numTabs = nodeLevel.intValue() + this.tabs;
- text.append(getTab(numTabs));
-
- String name=displayHelper.getName(node);
- text.append("<node name=\""); //$NON-NLS-1$
- text.append(escapeForXML(name));
- text.append("\">\n"); //$NON-NLS-1$
-
- // Print properties appropriately
- int propTabs = numTabs + 2;
- List orderedProps = displayHelper.getOrderedProperties(node);
- if(orderedProps.size() > 0) {
- text.append(getTab(numTabs+1));
- text.append("<properties>\n"); //$NON-NLS-1$
- for(int i=0; i< orderedProps.size(); i++) {
- String propName = (String) orderedProps.get(i);
- Object propObject=node.getProperties().get(propName);
-
- // Print leading spaces for prop name
- text.append(getTab(propTabs));
-
- // Print prop name and value
- if (propObject instanceof Collection) {
- printCollectionValue(propTabs, propName, propObject);
- } else if(propObject instanceof PlanNode) {
- printNodeValue(propTabs, propName, propObject);
- } else { // something like String, Integer, Boolean, etc
- printScalarValue(node, propName);
- }
- }
- text.append(getTab(numTabs+1));
- text.append("</properties>\n"); //$NON-NLS-1$
- }
-
- // Visit children
- List children = node.getChildren();
- Iterator childIter = children.iterator();
- while(childIter.hasNext()) {
- PlanNode child = (PlanNode) childIter.next();
- visit(child);
- }
-
- text.append(getTab(numTabs));
- text.append("</node>\n"); //$NON-NLS-1$
- }
-
- private void printScalarValue(PlanNode node, String propName) {
- text.append("<property name=\""); //$NON-NLS-1$
- text.append(escapeForXML(displayHelper.getPropertyName(propName)));
- text.append("\" value=\""); //$NON-NLS-1$
- text.append(escapeForXML(node.getProperties().get(propName)));
- text.append("\"/>\n"); //$NON-NLS-1$
- }
-
- private void printNodeValue(int numTabs, String propName, Object propObject) {
- text.append("<property name=\""); //$NON-NLS-1$
- text.append(escapeForXML(displayHelper.getPropertyName(propName)));
- text.append("\">\n"); //$NON-NLS-1$
-
- XMLOutputVisitor nestedVisitor = new XMLOutputVisitor(this.displayHelper,
numTabs+1, false);
- PlanNode nestedNode = (PlanNode) propObject;
- nestedVisitor.visit(nestedNode);
- text.append(nestedVisitor.getText());
-
- text.append(getTab(numTabs));
- text.append("</property>\n"); //$NON-NLS-1$
- }
-
- private void printCollectionValue(int propTabs, String propName, Object propObject)
{
- text.append("<property name=\""); //$NON-NLS-1$
- text.append(escapeForXML(displayHelper.getPropertyName(propName)));
- text.append("\">\n"); //$NON-NLS-1$
-
- text.append(getTab(propTabs+1));
- text.append("<collection>\n"); //$NON-NLS-1$
-
- // Visit collection property
- Collection collection = (Collection) propObject;
- Iterator collectionIter = collection.iterator();
- for(int v=1; collectionIter.hasNext(); v++) {
- Object collectionValue = collectionIter.next();
-
- text.append(getTab(propTabs+2));
- text.append("<value>"); //$NON-NLS-1$
- text.append(escapeForXML(collectionValue));
- text.append("</value>\n"); //$NON-NLS-1$
- }
-
- text.append(getTab(propTabs+1));
- text.append("</collection>\n"); //$NON-NLS-1$
-
- text.append(getTab(propTabs));
- text.append("</property>\n"); //$NON-NLS-1$
- }
-
- private Map tabCache = new HashMap();
- private String getTab(int tab) {
- Integer tabKey = new Integer(tab);
- String tabStr = (String) tabCache.get(tabKey);
- if(tabStr != null) {
- return tabStr;
- }
- StringBuffer tabBuffer = new StringBuffer();
- for(int t=0; t<tab; t++) {
- tabBuffer.append(" "); //$NON-NLS-1$
- }
- tabStr = tabBuffer.toString();
- tabCache.put(tabKey, tabStr);
- return tabStr;
- }
-
- private String escapeForXML(Object obj) {
- if(obj == null) {
- return "null"; //$NON-NLS-1$
- }
-
- String str = obj.toString();
- if(str.indexOf("<") >= 0 || str.indexOf(">") >= 0
|| str.indexOf("\"") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- StringBuffer newStr = new StringBuffer(str);
- StringUtil.replaceAll(newStr, "<", "<");
//$NON-NLS-1$ //$NON-NLS-2$
- StringUtil.replaceAll(newStr, ">", ">");
//$NON-NLS-1$ //$NON-NLS-2$
- StringUtil.replaceAll(newStr, "\"", """);
//$NON-NLS-1$ //$NON-NLS-2$
- return newStr.toString();
- }
- return str;
- }
-
- /**
- * Helper method to perform a conversion using the {@link DefaultDisplayHelper}.
- * @param node The root of the plan tree to convert
- * @return The plan tree converted to XML
- */
- public static String convertToXML(PlanNode node) {
- XMLOutputVisitor visitor = new XMLOutputVisitor(new DefaultDisplayHelper());
- visitor.visit(node);
- return visitor.getText();
- }
-}
Modified: trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -35,9 +35,6 @@
import org.teiid.client.RequestMessage;
import org.teiid.net.TeiidURL;
-
-
-
/**
* The Teiid JDBC DataSource implementation class of {@link javax.sql.DataSource} and
* {@link javax.sql.XADataSource}.
@@ -51,51 +48,6 @@
* The {@link javax.sql.XADataSource} interface is almost identical to the {@link
javax.sql.DataSource}
* interface, but rather than returning {@link java.sql.Connection} instances, there are
methods that
* return {@link javax.sql.XAConnection} instances that can be used with distributed
transactions.
- * <p>
- * The following are the properties for this DataSource:
- * <table cellspacing="0" cellpadding="0" border="1"
width="100%">
- * <tr><td><b>Property
Name</b></td><td><b>Type</b></td><td><b>Description</b></td></tr>
- * <tr><td>applicationName
</td><td><code>String</code></td><td>The
<i>optional</i> name of the application using the
DataSource.</td></tr>
- * <tr><td>clientToken
</td><td><code>Serializable</code></td><td>The
<i>optional</i> client token that will be passed directly
- * through to the
connectors, which may use it and/or pass it
- * down to their
underlying data source.
- * <p>
- * The form and type of
the client token is up to the client but it <i>must</i> implement the
- *
<code>Serializable</code> interface. Teiid does nothing with this token
except to make it
- * available for
authentication/augmentation/replacement upon authentication to the system and to
- * connectors that may
require it at the data source level.
- *
</p></td></tr>
- * <tr><td>databaseName
</td><td><code>String</code></td><td>The name of a
particular virtual database on a
- * Teiid
Server.</td></tr>
- * <tr><td>databaseVersion
</td><td><code>String</code></td><td>The
<i>optional</i> version of a particular
- * virtual database on a
Teiid Server;
- * if not supplied, then
the latest version is assumed.</td></tr>
- * <tr><td>dataSourceName
</td><td><code>String</code></td><td>The
<i>optional</i> logical name for the underlying
- *
<code>XADataSource</code> or
<code>ConnectionPoolDataSource</code>;
- * used only when pooling
connections or distributed transactions
- * are
implemented.</td></tr>
- * <tr><td>description
</td><td><code>String</code></td><td>The
<i>optional</i> description of this data source.</td></tr>
- * <tr><td>logFile
</td><td><code>String</code></td><td>The
<i>optional</i> path and file name to which JDBC Log Statements
- * will be written; if
none is specified, then no
- * Log Statements will be
written.</td></tr>
- * <tr><td>logLevel </td><td><code>int
</code></td><td>The <i>optional</i> level for logging, which
only applies
- * if the
<code>logFile</code> property is set. Value must be
- * one of the following:
- * <ul>
- *
<li>"<code>0</code>" - no JDBC log messages will be written to
the file;
- * this is the
default</li>
- *
<li>"<code>1</code>" - all JDBC log messages will be written
to the file</li>
- *
<li>"<code>2</code>" - all JDBC log messages as well as stack
traces
- * of any
exceptions thrown from this driver will be written
- * to the
file</li>
- * </ul>
- *
<tr><td>password</td><td><code>String</code></td><td>The
user's password.</td></tr>
- *
<tr><td>user</td><td><code>String</code></td><td>The
user name to use for the connection.</td></tr>
- *
<tr><td>partialResultsMode</td><td><code>boolean</code></td><td>Support
partial results mode or not. </td></tr>
- *
<tr><td>fetchSize</td><td><code>int</code></td><td>Set
default fetch size for statements, default=500.</td></tr>
- *
<tr><td>sqlOptions</td><td><code>String</code></td><td>Set
sql options to use on every command. default=null</td></tr>
- * <table>
- * </p>
*/
public abstract class BaseDataSource extends WrapperImpl implements javax.sql.DataSource,
XADataSource, ConnectionPoolDataSource, java.io.Serializable {
public static final String DEFAULT_APP_NAME = "JDBC"; //$NON-NLS-1$
@@ -183,8 +135,10 @@
*/
private int loginTimeout;
- private String sqlOptions;
+ private String showPlan;
+ private boolean noExec;
+
private String disableLocalTxn;
private String transactionAutoWrap;
@@ -264,17 +218,21 @@
}
if(this.getFetchSize() > 0) {
- props.setProperty(ExecutionProperties.PROP_FETCH_SIZE, "" +
this.getFetchSize()); //$NON-NLS-1$
+ props.setProperty(ExecutionProperties.PROP_FETCH_SIZE,
String.valueOf(this.getFetchSize()));
}
if (this.getResultSetCacheMode() != null &&
this.getResultSetCacheMode().trim().length() != 0) {
props.setProperty(ExecutionProperties.RESULT_SET_CACHE_MODE,
this.getResultSetCacheMode());
}
- if (this.getSqlOptions() != null) {
- props.setProperty(ExecutionProperties.PROP_SQL_OPTIONS,
this.getSqlOptions());
+ if (this.getShowPlan() != null) {
+ props.setProperty(ExecutionProperties.SQL_OPTION_SHOWPLAN,
this.getShowPlan());
}
+ if (this.isNoExec()) {
+ props.setProperty(ExecutionProperties.NOEXEC, String.valueOf(this.isNoExec()));
+ }
+
if ( this.getTransactionAutoWrap() != null &&
this.getTransactionAutoWrap().trim().length() != 0 ) {
props.setProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP,
this.getTransactionAutoWrap());
}
@@ -610,24 +568,22 @@
return this.resultSetCacheMode;
}
- /**
- * Get special sqlOptions string, which can currently be set only to SHOWPLAN
- * @return Returns sqlOptions string or null if none
- * @since 4.3
- */
- public String getSqlOptions() {
- return this.sqlOptions;
- }
+ public String getShowPlan() {
+ return showPlan;
+ }
- /**
- * Sets special sqlOptions that should be used with each command.
- * @param sqlOptions SQL options, only "SHOWPLAN" is currently accepted
- * @since 4.3
- */
- public void setSqlOptions(String sqlOptions) {
- this.sqlOptions = sqlOptions;
- }
-
+ public void setShowPlan(String showPlan) {
+ this.showPlan = showPlan;
+ }
+
+ public void setNoExec(boolean noExec) {
+ this.noExec = noExec;
+ }
+
+ public boolean isNoExec() {
+ return noExec;
+ }
+
/**
* @deprecated
* @see #getAutoCommitTxn()
Modified: trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -69,9 +69,9 @@
// constant value giving extra name characters used in Identifiers
private final static String EXTRA_CHARS = ".@"; //$NON-NLS-1$
// constant value giving the key words not in SQL-92
- final static String KEY_WORDS = "OPTION, SHOWPLAN, DEBUG, BIGDECIMAL"+
//$NON-NLS-1$
- ", BIGDECIMAL, BIGINTEGER, BREAK, BYTE, CRITERIA, ERROR, FN, LONG, LOOP, MAKEDEP,
MAKENOTDEP"+ //$NON-NLS-1$
- ", NOCACHE, OJ, PLANONLY, SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH"+ //$NON-NLS-1$
+ final static String KEY_WORDS = "OPTION, BIGDECIMAL"+ //$NON-NLS-1$
+ ", BIGDECIMAL, BIGINTEGER, BREAK, BYTE, CRITERIA, ERROR, FN, LIMIT, LONG, LOOP,
MAKEDEP, MAKENOTDEP"+ //$NON-NLS-1$
+ ", NOCACHE, OJ, SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR,
SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH"+ //$NON-NLS-1$
", SQL_TSI_QUARTER, SQL_TSI_YEAR, STRING, VIRTUAL, WHILE"; //$NON-NLS-1$
// constant value giving preferred name for a procedure
private final static String PROCEDURE_TERM = "StoredProcedure";
//$NON-NLS-1$
Modified: trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2010-04-06 21:51:32
UTC (rev 2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2010-04-07 03:29:59
UTC (rev 2031)
@@ -88,15 +88,14 @@
public static final String ANSI_QUOTED_IDENTIFIERS =
"ansiQuotedIdentifiers"; //$NON-NLS-1$
/**
- * Additional options/hints for executing the command
- * @since 4.3
+ * Can be one of ON|OFF|DEBUG
*/
- public static final String PROP_SQL_OPTIONS = "sqlOptions"; //$NON-NLS-1$
-
- /**
- * Passed as an option to PROP_SQL_OPTIONS
- */
public static final String SQL_OPTION_SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
+ /**
+ * Can be one of ON|OFF
+ */
+ public static final String NOEXEC = "NOEXEC"; //$NON-NLS-1$
+
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2010-04-06 21:51:32 UTC (rev
2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2010-04-07 03:29:59 UTC (rev
2031)
@@ -55,7 +55,8 @@
ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
ExecutionProperties.RESULT_SET_CACHE_MODE,
ExecutionProperties.ANSI_QUOTED_IDENTIFIERS,
- ExecutionProperties.PROP_SQL_OPTIONS,
+ ExecutionProperties.SQL_OPTION_SHOWPLAN,
+ ExecutionProperties.NOEXEC,
ExecutionProperties.PROP_FETCH_SIZE,
ExecutionProperties.PROP_XML_FORMAT,
ExecutionProperties.PROP_XML_VALIDATION,
@@ -252,10 +253,6 @@
return properties.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS);
}
- public String getSQLOptions() {
- return properties.getProperty(ExecutionProperties.PROP_SQL_OPTIONS);
- }
-
public String getFetchSize() {
return properties.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -25,7 +25,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
-import java.io.StringReader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
@@ -54,6 +53,7 @@
import org.teiid.client.ResultsMessage;
import org.teiid.client.lob.LobChunkInputStream;
import org.teiid.client.lob.StreamingLobChunckProducer;
+import org.teiid.client.plan.PlanNode;
import org.teiid.client.util.ResultsFuture;
import org.teiid.jdbc.BatchResults.Batch;
import org.teiid.jdbc.BatchResults.BatchFetcher;
@@ -104,7 +104,7 @@
private int resultColumns;
private int parameters;
private TimeZone serverTimeZone;
- private Map updatedPlanDescription;
+ private PlanNode updatedPlanDescription;
private int maxFieldSize;
private int fetchSize;
@@ -356,12 +356,12 @@
return batchResults.absolute(row, getOffset());
}
- protected Map getUpdatedPlanDescription() {
+ protected PlanNode getUpdatedPlanDescription() {
return updatedPlanDescription;
}
public Batch requestBatch(int beginRow) throws SQLException{
- logger.fine("CursorResultsImpl.requestBatch] thread name: " +
Thread.currentThread().getName() + " requestID: " + requestID + " beginRow:
" + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ logger.fine("CursorResultsImpl.requestBatch] thread name: " +
Thread.currentThread().getName() + " requestID: " + requestID + " beginRow:
" + beginRow ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
checkClosed();
try {
ResultsFuture<ResultsMessage> results =
statement.getDQP().processCursorRequest(requestID, beginRow, fetchSize);
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -51,6 +51,7 @@
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
import org.teiid.client.RequestMessage.ResultsMode;
+import org.teiid.client.RequestMessage.ShowPlan;
import org.teiid.client.metadata.ParameterInfo;
import org.teiid.client.plan.Annotation;
import org.teiid.client.plan.PlanNode;
@@ -106,7 +107,7 @@
protected long currentRequestID = -1;
// the last query plan description
- private Map currentPlanDescription;
+ private PlanNode currentPlanDescription;
// the last query debug log
private String debugLog;
@@ -143,7 +144,7 @@
//Map<out/inout/return param index --> index in results>
protected Map outParamIndexMap = new HashMap();
- private Pattern setStatement =
Pattern.compile("\\s*set\\s*(\\w+)\\s*=\\s*(\\w*)", Pattern.CASE_INSENSITIVE);
//$NON-NLS-1$
+ private static Pattern SET_STATEMENT =
Pattern.compile("\\s*set\\s*(\\w+)\\s*(\\w*)", Pattern.CASE_INSENSITIVE);
//$NON-NLS-1$
/**
* Factory Constructor
@@ -397,7 +398,7 @@
//handle set statement
if (commands.length == 1 && resultsMode != ResultsMode.RESULTSET) {
- Matcher match = setStatement.matcher(commands[0]);
+ Matcher match = SET_STATEMENT.matcher(commands[0]);
if (match.matches()) {
String key = match.group(1);
String value = match.group(2);
@@ -741,11 +742,18 @@
res.setAnsiQuotedIdentifiers(Boolean.valueOf(
getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS))
.booleanValue());
- String sqlOptions = getExecutionProperty(ExecutionProperties.PROP_SQL_OPTIONS);
- if (sqlOptions != null &&
-
sqlOptions.toUpperCase().indexOf(ExecutionProperties.SQL_OPTION_SHOWPLAN.toUpperCase())
>= 0) {
- res.setShowPlan(true);
+ String showPlan = getExecutionProperty(ExecutionProperties.SQL_OPTION_SHOWPLAN);
+ if (showPlan != null) {
+ try {
+ res.setShowPlan(ShowPlan.valueOf(showPlan));
+ } catch (IllegalArgumentException e) {
+
+ }
}
+ String noExec = getExecutionProperty(ExecutionProperties.NOEXEC);
+ if (noExec != null) {
+ res.setNoExec(noExec.equalsIgnoreCase("ON")); //$NON-NLS-1$
+ }
}
/**
@@ -879,7 +887,7 @@
this.styleSheet = null;
}
- void setPlanDescription(Map planDescription) {
+ void setPlanDescription(PlanNode planDescription) {
this.currentPlanDescription = planDescription;
}
@@ -899,13 +907,10 @@
public PlanNode getPlanDescription() {
Map planDescription = null;
if(this.resultSet != null) {
- planDescription = this.resultSet.getUpdatedPlanDescription();
+ return this.resultSet.getUpdatedPlanDescription();
}
- if(planDescription != null) {
- this.currentPlanDescription = planDescription;
- return PlanNode.constructFromMap(this.currentPlanDescription);
- }else if(this.currentPlanDescription != null) {
- return PlanNode.constructFromMap(this.currentPlanDescription);
+ if(currentPlanDescription != null) {
+ return this.currentPlanDescription;
}
return null;
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -42,6 +42,7 @@
* Get the execution property value.
* @param name Execution property name
* @return Execution property value or null if not set
+ * @deprecated
*/
String getExecutionProperty(String name);
@@ -49,6 +50,7 @@
* Set the execution property value.
* @param name Execution property name
* @param value Execution property value
+ * @deprecated use set property value
*/
void setExecutionProperty(String name, String value);
Modified: trunk/client/src/test/java/org/teiid/client/TestRequestMessage.java
===================================================================
--- trunk/client/src/test/java/org/teiid/client/TestRequestMessage.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/test/java/org/teiid/client/TestRequestMessage.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -26,6 +26,7 @@
import java.util.List;
import org.teiid.client.RequestMessage;
+import org.teiid.client.RequestMessage.ShowPlan;
import org.teiid.client.RequestMessage.StatementType;
import junit.framework.TestCase;
@@ -65,7 +66,7 @@
message.setValidationMode(true);
message.setXMLFormat("xMLFormat"); //$NON-NLS-1$
- message.setShowPlan(true);
+ message.setShowPlan(ShowPlan.ON);
message.setRowLimit(1313);
return message;
}
@@ -88,7 +89,7 @@
assertEquals(RequestMessage.TXN_WRAP_ON, copy.getTxnAutoWrapMode());
assertTrue(copy.getValidationMode());
assertEquals("xMLFormat", copy.getXMLFormat()); //$NON-NLS-1$
- assertTrue(copy.getShowPlan());
+ assertEquals(ShowPlan.ON, copy.getShowPlan());
assertEquals(1313, copy.getRowLimit());
}
Copied: trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java (from rev 2021,
trunk/client/src/test/java/org/teiid/client/plan/TestXMLOutputVisitor.java)
===================================================================
--- trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java
(rev 0)
+++ trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java 2010-04-07 03:29:59
UTC (rev 2031)
@@ -0,0 +1,71 @@
+/*
+ * 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.client.plan;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+/**
+ */
+public class TestPlanNode extends TestCase {
+
+ public TestPlanNode(String name) {
+ super(name);
+ }
+
+ public static PlanNode example1() {
+ PlanNode map = new PlanNode("x"); //$NON-NLS-1$
+ map.addProperty("test", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ map.addProperty("string", "string"); //$NON-NLS-1$
//$NON-NLS-2$
+ List<String> list1 = new ArrayList<String>();
+ list1.add("item1"); //$NON-NLS-1$
+ list1.add("item2"); //$NON-NLS-1$
+ list1.add("item3"); //$NON-NLS-1$
+ map.addProperty("list<string>", list1); //$NON-NLS-1$
+
+ PlanNode child = new PlanNode("y"); //$NON-NLS-1$
+ List<String> outputCols = new ArrayList<String>();
+ outputCols.add("Name (string)"); //$NON-NLS-1$
+ outputCols.add("Year (integer)"); //$NON-NLS-1$
+ child.addProperty("outputCols", outputCols); //$NON-NLS-1$
+ child.addProperty("Join Type", "INNER JOIN"); //$NON-NLS-1$
//$NON-NLS-2$
+ List<String> crits = new ArrayList<String>();
+ crits.add("Item.ID = History.ID"); //$NON-NLS-1$
+ child.addProperty("Criteria", crits); //$NON-NLS-1$
+
+ map.addProperty("child", child); //$NON-NLS-1$
+ return map;
+ }
+
+ public void testXml() throws Exception {
+ assertEquals("<?xml version=\"1.0\"
encoding=\"UTF-8\" standalone=\"yes\"?>\n<node
name=\"x\">\n <property name=\"test\">\n
<value></value>\n </property>\n <property
name=\"string\">\n <value>string</value>\n
</property>\n <property name=\"list<string>\">\n
<value>item1</value>\n <value>item2</value>\n
<value>item3</value>\n </property>\n <property
name=\"child\">\n <node name=\"y\">\n
<property name=\"outputCols\">\n <value>Name
(string)</value>\n <value>Year (integer)</value>\n
</property>\n <property name=\"Join Type\">\n
<value>INNER JOIN</value>\n </property>\n
<property name=\"Criteria\">\n <value>Item.ID =
History.ID</value>\n </property>\n </node>\n
</property>\n</node>\n", example1().toXml()); //$NON-NLS-1$
+ }
+
+ public void testText() throws Exception {
+ assertEquals("x\n + test:\n + string:string\n + list<string>:\n
0: item1\n 1: item2\n 2: item3\n + child:\n y\n + outputCols:\n 0:
Name (string)\n 1: Year (integer)\n + Join Type:INNER JOIN\n +
Criteria:Item.ID = History.ID\n", example1().toString()); //$NON-NLS-1$
+ }
+
+}
Deleted: trunk/client/src/test/java/org/teiid/client/plan/TestTextOutputVisitor.java
===================================================================
--- trunk/client/src/test/java/org/teiid/client/plan/TestTextOutputVisitor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/test/java/org/teiid/client/plan/TestTextOutputVisitor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,84 +0,0 @@
-/*
- * 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.client.plan;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-import org.teiid.client.plan.DefaultDisplayHelper;
-import org.teiid.client.plan.PlanNode;
-import org.teiid.client.plan.TextOutputVisitor;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestTextOutputVisitor extends TestCase {
-
- /**
- * Constructor for TestTextOutputVisitor.
- * @param name
- */
- public TestTextOutputVisitor(String name) {
- super(name);
- }
-
- public static PlanNode example1() {
- HashMap<String, Object> map = new HashMap<String, Object>();
- map.put(PlanNode.TYPE, "x"); //$NON-NLS-1$
- map.put("test", ""); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("integer", new Integer(0)); //$NON-NLS-1$
- map.put("boolean", Boolean.TRUE); //$NON-NLS-1$
- List list1 = new ArrayList();
- list1.add("item1"); //$NON-NLS-1$
- list1.add("item2"); //$NON-NLS-1$
- list1.add("item3"); //$NON-NLS-1$
- map.put("list<string>", list1); //$NON-NLS-1$
-
- HashMap<String, Object> child = new HashMap<String, Object>();
- child.put(PlanNode.TYPE, "y"); //$NON-NLS-1$
- List<String> outputCols = new ArrayList<String>();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- child.put(PlanNode.OUTPUT_COLS, outputCols);
- child.put("Join Type", "INNER JOIN"); //$NON-NLS-1$
//$NON-NLS-2$
- List<String> crits = new ArrayList<String>();
- crits.add("Item.ID = History.ID"); //$NON-NLS-1$
- child.put("Criteria", crits); //$NON-NLS-1$
-
- map.put(PlanNode.PROP_CHILDREN, Arrays.asList(child));
-
- return PlanNode.constructFromMap(map);
- }
-
- public void testWithDefaultDisplayHelper() {
- TextOutputVisitor v = new TextOutputVisitor(new DefaultDisplayHelper(), 0);
- v.visit(example1());
- assertEquals("x\n + test: \n + integer: 0\n + string: string\n +
list<string>:\n 1: item1\n 2: item2\n 3: item3\n + boolean: true\n
y\n + outputCols:\n 1: Name (string)\n 2: Year (integer)\n + Join
Type: INNER JOIN\n + Criteria:\n 1: Item.ID = History.ID\n", v.getText());
//$NON-NLS-1$
- }
-
-}
Deleted: trunk/client/src/test/java/org/teiid/client/plan/TestXMLOutputVisitor.java
===================================================================
--- trunk/client/src/test/java/org/teiid/client/plan/TestXMLOutputVisitor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/client/src/test/java/org/teiid/client/plan/TestXMLOutputVisitor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,45 +0,0 @@
-/*
- * 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.client.plan;
-
-import org.teiid.client.plan.DefaultDisplayHelper;
-import org.teiid.client.plan.XMLOutputVisitor;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestXMLOutputVisitor extends TestCase {
-
- public TestXMLOutputVisitor(String name) {
- super(name);
- }
-
- public void testWithDefaultDisplayHelper() {
- XMLOutputVisitor v = new XMLOutputVisitor(new DefaultDisplayHelper());
- v.visit(TestTextOutputVisitor.example1());
- assertEquals("<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n<node name=\"x\">\n
<properties>\n <property name=\"test\" value=\"\"/>\n
<property name=\"integer\" value=\"0\"/>\n <property
name=\"string\" value=\"string\"/>\n <property
name=\"list<string>\">\n <collection>\n
<value>item1</value>\n <value>item2</value>\n
<value>item3</value>\n </collection>\n </property>\n
<property name=\"boolean\" value=\"true\"/>\n
</properties>\n <node name=\"y\">\n <properties>\n
<property name=\"outputCols\">\n <collection>\n
<value>Name (string)</value>\n <value>Year
(integer)</value>\n </collection>\n </property>\n
<property name=\"Join Type\" value=\"INNER JOIN\"/>\n
<property name=\"Criteria\">\n <collection>\n
<value>Item.ID = History.ID</value>\n </collection>\n
</property>\n </properties>\n </node>\n</node>\n",
v.getText()); //$NON-!
NLS-1$
- }
-
-}
Deleted: trunk/client/src/test/java/org/teiid/jdbc/TestMMDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestMMDriver.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestMMDriver.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -1,134 +0,0 @@
-/*
- * 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.jdbc;
-
-import java.sql.DriverPropertyInfo;
-import java.util.Properties;
-
-import org.teiid.net.TeiidURL;
-
-
-
-import junit.framework.TestCase;
-
-
-public class TestMMDriver extends TestCase {
- TeiidDriver drv = new TeiidDriver();
- public String localhost = "localhost"; //$NON-NLS-1$
-
- public TestMMDriver(String name) {
- super(name);
- }
-
- /** Valid format of urls*/
- public void testAcceptsURL1() throws Exception {
- assertNotNull(drv);
- assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:1234"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;version=x"));
//$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mms://localhost:1234"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;version=x"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://127.0.0.1:1234;logLevel=2"));
//$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://127.0.0.1:1234"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234"));
//$NON-NLS-1$
-
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://123.123.123.123:53535,127.0.0.1:1234"));
//$NON-NLS-1$
-
- //DQP type
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@c:/dqp.properties;version=1"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@/foo/dqp.properties;version=1"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@../foo/dqp.properties;version=1"));
//$NON-NLS-1$
-
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:port"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:vdb@localhost:port;version=x"));
//$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;stickyConnections=false;socketsPerVM=4"));
//$NON-NLS-1$
-
assertTrue(!drv.acceptsURL("jdbc:metamatrix:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234"));
//$NON-NLS-1$
- }
-
- /** Invalid format of urls*/
- public void testAcceptsURL2() throws Exception {
- assertNotNull(drv);
- assertTrue(!drv.acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("metamatrix:test")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
- }
-
- public void testParseURL() throws Exception{
- Properties p = new Properties();
- SocketProfile.parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234", p);
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
-
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234"));
//$NON-NLS-1$
- assertEquals(3, p.size());
- }
-
- public void testParseURL2() throws Exception {
- Properties p = new Properties();
-
SocketProfile.parseURL("jdbc:metamatrix:BQT@mms://slwxp157:1234;version=3", p);
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3"));
//$NON-NLS-1$
-
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234"));
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3"));
//$NON-NLS-1$
-
assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals(BaseDataSource.DEFAULT_APP_NAME));
- assertEquals(5, p.size());
- }
-
- public void testParseURL3() throws Exception{
- Properties p = new Properties();
-
SocketProfile.parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client",
p); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4"));
//$NON-NLS-1$
-
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON"));
//$NON-NLS-1$
-
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES"));
//$NON-NLS-1$
-
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302"));
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4"));
//$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals("Client"));
//$NON-NLS-1$
- assertEquals(7, p.size());
- }
-
- public void testGetPropertyInfo1() throws Exception {
- DriverPropertyInfo info[] =
drv.getPropertyInfo("jdbc:metamatrix:vdb@mm://localhost:12345;applicationName=x",
null); //$NON-NLS-1$
-
- assertEquals(17, info.length);
- assertEquals(false, info[0].required);
- assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
- assertEquals("x", info[0].value); //$NON-NLS-1$
- }
-
-}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestMMStatement.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestMMStatement.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestMMStatement.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -68,7 +68,7 @@
Properties p = new Properties();
Mockito.stub(conn.getConnectionProperties()).toReturn(p);
StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
- assertFalse(statement.execute("set foo = bar")); //$NON-NLS-1$
+ assertFalse(statement.execute("set foo bar")); //$NON-NLS-1$
assertEquals("bar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2010-04-06 21:51:32
UTC (rev 2030)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2010-04-07 03:29:59
UTC (rev 2031)
@@ -27,6 +27,7 @@
import java.sql.Connection;
import java.sql.SQLException;
+import org.teiid.client.RequestMessage.ShowPlan;
import org.teiid.jdbc.BaseDataSource;
import org.teiid.jdbc.TeiidDataSource;
@@ -153,7 +154,7 @@
ds.setTransactionAutoWrap(txnAutoWrap);
ds.setPartialResultsMode(partialMode);
if(showPlan) {
- ds.setSqlOptions(ExecutionProperties.SQL_OPTION_SHOWPLAN);
+ ds.setShowPlan(ShowPlan.ON.toString());
}
ds.setSecure(secure);
ds.setAlternateServers(alternateServers);
@@ -258,14 +259,6 @@
assertEquals(result,STD_TXN_WRAP);
}
- public void testGetShowPlan() {
- assertTrue(dataSource.getSqlOptions() == null);
- dataSource.setSqlOptions(ExecutionProperties.SQL_OPTION_SHOWPLAN);
- assertTrue(dataSource.getSqlOptions() ==
ExecutionProperties.SQL_OPTION_SHOWPLAN);
- dataSource.setSqlOptions(null);
- assertTrue(dataSource.getSqlOptions() == null);
- }
-
public void testGetSecure() {
assertTrue(dataSource.isSecure());
dataSource.setSecure(false);
@@ -511,7 +504,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:teiid:vdbName@mm://hostname:7001;ApplicationName=JDBC;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
"jdbc:teiid:vdbName@mm://hostname:7001;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
// Test secure protocol
@@ -524,7 +517,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = true;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:teiid:vdbName@mms://hostname:7001;ApplicationName=JDBC;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
"jdbc:teiid:vdbName@mms://hostname:7001;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
/*
@@ -542,7 +535,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
"jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
/*
@@ -560,7 +553,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = true;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:teiid:vdbName@mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
"jdbc:teiid:vdbName@mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
/*
@@ -579,7 +572,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap,
partialMode, -1, true, secure,
-
"jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN");
//$NON-NLS-1$
+
"jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName");
//$NON-NLS-1$
}
public void testBuildURL_AdditionalProperties() {
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2010-04-06 21:51:32 UTC
(rev 2030)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2010-04-07 03:29:59 UTC
(rev 2031)
@@ -27,18 +27,15 @@
import static org.junit.Assert.assertFalse;
import java.sql.DriverPropertyInfo;
+import java.util.Properties;
import org.junit.Test;
+import org.teiid.net.TeiidURL;
public class TestTeiidDriver {
TeiidDriver drv = new TeiidDriver();
-
+ public String localhost = "localhost"; //$NON-NLS-1$
- @Test public void testGetPropertyInfo1() throws Exception {
- DriverPropertyInfo info[] =
drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345", null); //$NON-NLS-1$
- assertEquals(17, info.length);
- }
-
@Test public void testAccepts() throws Exception {
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345"));
//$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar"));
//$NON-NLS-1$
@@ -52,4 +49,93 @@
}
+ /** Valid format of urls*/
+ @Test public void testAcceptsURL1() throws Exception {
+ assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:1234"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;version=x"));
//$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mms://localhost:1234"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234;version=x"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://127.0.0.1:1234;logLevel=2"));
//$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mms://127.0.0.1:1234"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234"));
//$NON-NLS-1$
+
assertTrue(drv.acceptsURL("jdbc:metamatrix:vdb@mm://123.123.123.123:53535,127.0.0.1:1234"));
//$NON-NLS-1$
+
+ //DQP type
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@c:/dqp.properties;version=1"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@/foo/dqp.properties;version=1"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@../foo/dqp.properties;version=1"));
//$NON-NLS-1$
+
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:port"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:vdb@localhost:port;version=x"));
//$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:@localhost:1234;stickyConnections=false;socketsPerVM=4"));
//$NON-NLS-1$
+
assertTrue(!drv.acceptsURL("jdbc:metamatrix:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234"));
//$NON-NLS-1$
+ }
+
+ /** Invalid format of urls*/
+ @Test public void testAcceptsURL2() throws Exception {
+ assertTrue(!drv.acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("metamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
+ }
+
+ @Test public void testParseURL() throws Exception{
+ Properties p = new Properties();
+ SocketProfile.parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234", p);
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234"));
//$NON-NLS-1$
+ assertEquals(3, p.size());
+ }
+
+ @Test public void testParseURL2() throws Exception {
+ Properties p = new Properties();
+
SocketProfile.parseURL("jdbc:metamatrix:BQT@mms://slwxp157:1234;version=3", p);
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals(BaseDataSource.DEFAULT_APP_NAME));
+ assertEquals(5, p.size());
+ }
+
+ @Test public void testParseURL3() throws Exception{
+ Properties p = new Properties();
+
SocketProfile.parseURL("jdbc:metamatrix:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client",
p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES"));
//$NON-NLS-1$
+
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4"));
//$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals("Client"));
//$NON-NLS-1$
+ assertEquals(7, p.size());
+ }
+
+ @Test public void testGetPropertyInfo1() throws Exception {
+ DriverPropertyInfo info[] =
drv.getPropertyInfo("jdbc:metamatrix:vdb@mm://localhost:12345;applicationName=x",
null); //$NON-NLS-1$
+
+ assertEquals(18, info.length);
+ assertEquals(false, info[0].required);
+ assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
+ assertEquals("x", info[0].value); //$NON-NLS-1$
+ }
+
}
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -55,13 +55,13 @@
public static final String CRITERIA = "CRITERIA"; //$NON-NLS-1$
public static final String ERROR = "ERROR"; //$NON-NLS-1$
public static final String FN = "FN"; //$NON-NLS-1$
+ public static final String LIMIT = "LIMIT"; //$NON-NLS-1$
public static final String LONG = "LONG"; //$NON-NLS-1$
public static final String LOOP = "LOOP"; //$NON-NLS-1$
public static final String MAKEDEP = "MAKEDEP"; //$NON-NLS-1$
public static final String MAKENOTDEP = "MAKENOTDEP"; //$NON-NLS-1$
public static final String NOCACHE = "NOCACHE"; //$NON-NLS-1$
public static final String OJ = "OJ"; //$NON-NLS-1$
- public static final String PLANONLY = "PLANONLY"; //$NON-NLS-1$
public static final String SQL_TSI_FRAC_SECOND = "SQL_TSI_FRAC_SECOND";
//$NON-NLS-1$
public static final String SQL_TSI_SECOND = "SQL_TSI_SECOND";
//$NON-NLS-1$
public static final String SQL_TSI_MINUTE = "SQL_TSI_MINUTE";
//$NON-NLS-1$
@@ -123,7 +123,6 @@
public static final String DATE = "DATE"; //$NON-NLS-1$
public static final String DAY = "DAY"; //$NON-NLS-1$
public static final String DEALLOCATE = "DEALLOCATE"; //$NON-NLS-1$
- public static final String DEBUG = "DEBUG"; //$NON-NLS-1$
public static final String DECIMAL = "DECIMAL"; //$NON-NLS-1$
public static final String DECLARE = "DECLARE"; //$NON-NLS-1$
public static final String DEFAULT = "DEFAULT"; //$NON-NLS-1$
@@ -184,7 +183,6 @@
public static final String LEADING = "LEADING"; //$NON-NLS-1$
public static final String LEFT = "LEFT"; //$NON-NLS-1$
public static final String LIKE = "LIKE"; //$NON-NLS-1$
- public static final String LIMIT = "LIMIT"; //$NON-NLS-1$
public static final String LOCAL = "LOCAL"; //$NON-NLS-1$
public static final String MATCH = "MATCH"; //$NON-NLS-1$
public static final String MAX = "MAX"; //$NON-NLS-1$
@@ -244,7 +242,6 @@
public static final String SESSION_USER = "SESSION_USER"; //$NON-NLS-1$
public static final String SET = "SET"; //$NON-NLS-1$
public static final String SHORT = "SHORT"; //$NON-NLS-1$
- public static final String SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
public static final String SIILAR = "ROWS"; //$NON-NLS-1$
public static final String SMALLINT = "ROWS"; //$NON-NLS-1$
public static final String SOME = "SOME"; //$NON-NLS-1$
Modified: trunk/documentation/reference/src/main/docbook/en-US/Reference.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/Reference.xml 2010-04-06 21:51:32
UTC (rev 2030)
+++ trunk/documentation/reference/src/main/docbook/en-US/Reference.xml 2010-04-07 03:29:59
UTC (rev 2031)
@@ -52,9 +52,9 @@
<xi:include href="content/datatypes.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/scalar_functions.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/procedures.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/other_commands.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/transaction_support.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/system_schema.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/connectors.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/federated_planning.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/architecture.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/grammar.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
Deleted: trunk/documentation/reference/src/main/docbook/en-US/content/connectors.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/connectors.xml 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/connectors.xml 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="connectors">
- <title>Connectors</title>
- <sect1>
- <title>Common Connector Properties</title>
- <para>These properties are common to all connectors.</para>
- <informaltable frame="all">
- <tgroup cols="4">
- <colspec colwidth="1*"/>
- <colspec colwidth="1.25*"/>
- <colspec colwidth="1*"/>
- <colspec colwidth=".5*"/>
- <thead>
- <row>
- <entry>
- <para>Property</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- <entry>
- <para>Type</para>
- </entry>
- <entry>
- <para>Default</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>ConnectorClass</para>
- </entry>
- <entry>
- <para>The class name of the custom connector class that
- connects to the data source. Required. Not editable.
- </para>
- </entry>
- <entry>
- <para>string</para>
- </entry>
- <entry>
- <para />
- </entry>
- </row>
- <row>
- <entry>
- <para>CapabilitiesClass</para>
- </entry>
- <entry>
- <para>The class is used to provide the Connector
Capabilities</para>
- </entry>
- <entry>
- <para>string</para>
- </entry>
- <entry>
- <para />
- </entry>
- </row>
- <row>
- <entry>
- <para>Immutable</para>
- </entry>
- <entry>
- <para>True if the source never changes.</para>
- </entry>
- <entry>
- <para>boolean</para>
- </entry>
- <entry>
- <para />
- </entry>
- </row>
- <row>
- <entry>
- <para>XaCapable</para>
- </entry>
- <entry>
- <para>True, if this connector supports XA Transactions</para>
- </entry>
- <entry>
- <para>boolean</para>
- </entry>
- <entry>
- <para />
- </entry>
- </row>
- <row>
- <entry>
- <para>ExceptionOnMaxRows</para>
- </entry>
- <entry>
- <para>Specifies whether or not an exception is
- thrown when the number of rows for a query exceeds the
- value of MaxResultRows. If this flag is set to false,
- then no more rows than MaxResultRows will be returned,
- but no exception will be thrown.</para>
- </entry>
- <entry>
- <para>boolean</para>
- </entry>
- <entry>
- <para />
- </entry>
- </row>
- <row>
- <entry>
- <para>MaxResultRows</para>
- </entry>
- <entry>
- <para>The maximum number of rows to be processed by the
- connector from a source. A custom connector should stop
- adding rows to the ResultsCollector when the number of
- rows reaches this value. Optional – if not specified,
- all rows will be processed.</para>
- </entry>
- <entry>
- <para>integer</para>
- </entry>
- <entry>
- <para />
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </sect1>
- <sect1>
- <title>Source Security</title>
- <para>For the configuring the Connection Factories and Data Sources with
security check out JBoss AS documentation.</para>
- </sect1>
-
-</chapter>
\ No newline at end of file
Added: trunk/documentation/reference/src/main/docbook/en-US/content/other_commands.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/other_commands.xml
(rev 0)
+++
trunk/documentation/reference/src/main/docbook/en-US/content/other_commands.xml 2010-04-07
03:29:59 UTC (rev 2031)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter id="other_commands">
+ <title>Other Commands</title>
+ <sect1 id="set_command">
+ <title>SET Command</title>
+ <para>The SET command is used to set execution property values for the duration
of the session.</para>
+ <itemizedlist>
+ <para>SET Syntax:
+ </para>
+ <listitem>
+ <para>SET parameter value
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <para>Syntax Rules:
+ </para>
+ <listitem>
+ <para>Both parameter and value must be simple literals - they cannot contain
spaces.</para>
+ </listitem>
+ <listitem>
+ <para>The value is also not treated as an expression and will not be evaluated
prior to being set as the parameter value.</para>
+ </listitem>
+ </itemizedlist>
+ <para>The SET command can be used to control planning and execution.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>SET SHOWPLAN [ON|DEBUG|OFF] - ON returns the query plan along with the
results and DEBUG additionally prints the query planner debug information in the log and
returns it with the results. Both the plan and the log are available through JDBC API
extensions.</para>
+ </listitem>
+ <listitem>
+ <para>SET NOEXEC [ON|OFF] - ON prevents query execution, but parsing and
planning will still occur.</para>
+ </listitem>
+ </itemizedlist>
+ </sect1>
+</chapter>
\ No newline at end of file
Property changes on:
trunk/documentation/reference/src/main/docbook/en-US/content/other_commands.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
===================================================================
---
trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml 2010-04-07
03:29:59 UTC (rev 2031)
@@ -884,32 +884,31 @@
<para>Supported options:
</para>
<listitem>
- <para>SHOWPLAN - returns the query plan along with the results
+ <para>MAKEDEP table [(,table)*] - specifies source tables that should be
made dependent in the join
</para>
- </listitem><listitem>
- <para>PLANONLY - returns the query plan, but does not execute the
command
+ </listitem>
+ <listitem>
+ <para>MAKENOTDEP table [(,table)*] - prevents a dependent join from being
used
</para>
- </listitem><listitem>
- <para>MAKEDEP [table, (table)*] - specifies source tables that should be
made dependent in the join
+ </listitem>
+ <listitem>
+ <para>NOCACHE [table (,table)*] - prevents cache from being used for all
tables or for the given tables
</para>
- </listitem><listitem>
- <para>MAKENOTDEP [table, (table)*] - prevents a dependent join from being
used
- </para>
- </listitem><listitem>
- <para>DEBUG - prints query planner debug information in the log and
returns it through the JDBC API
- </para>
</listitem>
</itemizedlist>
<itemizedlist>
<para>Examples:
</para>
<listitem>
- <para>LIMIT 100 - returns the first 100 records (rows
1-100)</para>
+ <para>OPTION MAKEDEP table1</para>
</listitem>
<listitem>
- <para>LIMIT 500, 100 - skips 500 records and returns the next 100 records
(rows 501-600)</para>
+ <para>OPTION NOCACHE</para>
</listitem>
</itemizedlist>
+ <para>Previous versions of Teiid accepted the PLANONLY, DEBUG, and SHOWPLAN
option arguments. These are no longer accepted in the OPTION clause.
+ Please see the <link linkend="other_commands">other
commands</link> chapter for using these options.
+ </para>
</sect2>
</sect1>
<sect1 id="set_operations">
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml
===================================================================
---
trunk/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/documentation/reference/src/main/docbook/en-US/content/transaction_support.xml 2010-04-07
03:29:59 UTC (rev 2031)
@@ -175,7 +175,7 @@
Global - the XAResource interface provided by an XAConnection is
used to control the transaction. Note that XAConnections are
available only if Teiid is consumed through its XADataSource,
- <classname>com.metamatrix.jdbc.MMDataSource
+ <classname>org.teiid.jdbc.TeiidDataSource
</classname>
. JEE containers or data access APIs typically control XA
transactions on behalf of application code.
Modified: trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,14 +22,26 @@
package com.metamatrix.query.analysis;
-import java.io.*;
-import java.util.*;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.ListIterator;
import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.query.sql.LanguageObject;
+import com.metamatrix.query.sql.lang.SubqueryContainer;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
+import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
/**
* <p>The AnalysisRecord holds all debug/analysis information for
@@ -42,6 +54,53 @@
* </ul>
*/
public class AnalysisRecord implements Serializable {
+
+ // Common
+ public static final String PROP_OUTPUT_COLS = "Output Columns";
//$NON-NLS-1$
+
+ // Relational
+ public static final String PROP_CRITERIA = "Criteria"; //$NON-NLS-1$
+ public static final String PROP_SELECT_COLS = "Select Columns";
//$NON-NLS-1$
+ public static final String PROP_GROUP_COLS = "Grouping Columns";
//$NON-NLS-1$
+ public static final String PROP_SQL = "Query"; //$NON-NLS-1$
+ public static final String PROP_MODEL_NAME = "Model Name"; //$NON-NLS-1$
+ public static final String PROP_DEPENDENT = "Dependent Join";
//$NON-NLS-1$
+ public static final String PROP_JOIN_STRATEGY = "Join Strategy";
//$NON-NLS-1$
+ public static final String PROP_JOIN_TYPE = "Join Type"; //$NON-NLS-1$
+ public static final String PROP_JOIN_CRITERIA = "Join Criteria";
//$NON-NLS-1$
+ public static final String PROP_EXECUTION_PLAN = "Execution Plan";
//$NON-NLS-1$
+ public static final String PROP_INTO_GROUP = "Into Target"; //$NON-NLS-1$
+ public static final String PROP_SORT_COLS = "Sort Columns"; //$NON-NLS-1$
+ public static final String PROP_SORT_MODE = "Sort Mode"; //$NON-NLS-1$
+ public static final String PROP_NODE_STATS_LIST = "Statistics";
//$NON-NLS-1$
+ public static final String PROP_NODE_COST_ESTIMATES = "Cost Estimates";
//$NON-NLS-1$
+ public static final String PROP_ROW_OFFSET = "Row Offset"; //$NON-NLS-1$
+ public static final String PROP_ROW_LIMIT = "Row Limit"; //$NON-NLS-1$
+
+ // XML
+ public static final String PROP_MESSAGE = "Message"; //$NON-NLS-1$
+ public static final String PROP_TAG = "Tag"; //$NON-NLS-1$
+ public static final String PROP_NAMESPACE = "Namespace"; //$NON-NLS-1$
+ public static final String PROP_DATA_COL = "Data Column"; //$NON-NLS-1$
+ public static final String PROP_NAMESPACE_DECL = "Namespace Declarations";
//$NON-NLS-1$
+ public static final String PROP_OPTIONAL = "Optional Flag"; //$NON-NLS-1$
+ public static final String PROP_DEFAULT = "Default Value"; //$NON-NLS-1$
+ public static final String PROP_RECURSE_DIR = "Recursion Direction";
//$NON-NLS-1$
+ public static final String PROP_BINDINGS = "Bindings"; //$NON-NLS-1$
+ public static final String PROP_IS_STAGING = "Is Staging Flag";
//$NON-NLS-1$
+ public static final String PROP_IN_MEMORY = "Source In Memory Flag";
//$NON-NLS-1$
+ public static final String PROP_CONDITION = "Condition"; //$NON-NLS-1$
+ public static final String PROP_DEFAULT_PROGRAM = "Default Program";
//$NON-NLS-1$
+ public static final String PROP_ENCODING = "Encoding"; //$NON-NLS-1$
+ public static final String PROP_FORMATTED = "Formatted Flag";
//$NON-NLS-1$
+
+ // Procedure
+ public static final String PROP_EXPRESSION = "Expression"; //$NON-NLS-1$
+ public static final String PROP_RESULT_SET = "Result Set"; //$NON-NLS-1$
+ public static final String PROP_PROGRAM = "Program"; //$NON-NLS-1$
+ public static final String PROP_VARIABLE = "Variable"; //$NON-NLS-1$
+ public static final String PROP_THEN = "Then"; //$NON-NLS-1$
+ public static final String PROP_ELSE = "Else"; //$NON-NLS-1$
// Flags regarding what should be recorded
private boolean recordQueryPlan;
@@ -49,7 +108,7 @@
private boolean logDebug;
// Query plan
- private Map queryPlan;
+ private PlanNode queryPlan;
// Annotations
private Collection<Annotation> annotations;
@@ -109,7 +168,7 @@
* Set the query plan that was created
* @param queryPlan The plan
*/
- public void setQueryPlan(Map queryPlan) {
+ public void setQueryPlan(PlanNode queryPlan) {
this.queryPlan = queryPlan;
}
@@ -117,7 +176,7 @@
* Get the query plan that was created
* @return The plan
*/
- public Map getQueryPlan() {
+ public PlanNode getQueryPlan() {
return this.queryPlan;
}
@@ -158,4 +217,36 @@
}
return null;
}
+
+ /**
+ * Helper method to turn a list of projected symbols into a suitable list of
+ * output column strings with name and type.
+ * @param projectedSymbols The list of SingleElementSymbol projected from a plan or
node
+ * @return List of output columns for sending to the client as part of the plan
+ */
+ public static List<String>
getOutputColumnProperties(List<SingleElementSymbol> projectedSymbols) {
+ if(projectedSymbols != null) {
+ List<String> outputCols = new
ArrayList<String>(projectedSymbols.size());
+ for(int i=0; i<projectedSymbols.size() ; i++) {
+ SingleElementSymbol symbol = projectedSymbols.get(i);
+ outputCols.add(symbol.getShortName() + " (" +
DataTypeManager.getDataTypeName(symbol.getType()) + ")"); //$NON-NLS-1$
//$NON-NLS-2$
+ }
+ return outputCols;
+ }
+ return Collections.emptyList();
+ }
+
+ public static void addLanaguageObjects(PlanNode node, String key, List<? extends
LanguageObject> objects) {
+ List<String> values = new ArrayList<String>();
+ int index = 0;
+ for (LanguageObject languageObject : objects) {
+ values.add(languageObject.toString());
+ List<SubqueryContainer> subqueries =
ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(objects);
+ for (ListIterator<SubqueryContainer> iterator = subqueries.listIterator();
iterator.hasNext();) {
+ SubqueryContainer subqueryContainer = iterator.next();
+ node.addProperty(key + " Subplan " + index++,
subqueryContainer.getCommand().getProcessorPlan().getDescriptionProperties());
//$NON-NLS-1$
+ }
+ }
+ node.addProperty(key, values);
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/mapping/xml/ResultSetInfo.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -26,6 +26,7 @@
import java.util.List;
import java.util.Set;
+import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.sql.lang.OrderBy;
@@ -47,7 +48,7 @@
private List boundReferences;
// The processor plan output for the result set
- private Object rsPlan;
+ private ProcessorPlan rsPlan;
// Row limit, may be null if no limit
private int userRowLimit = -1;
@@ -92,11 +93,11 @@
this.rsCommand = cmd;
}
- public Object getPlan() {
+ public ProcessorPlan getPlan() {
return rsPlan;
}
- public void setPlan(Object plan) {
+ public void setPlan(ProcessorPlan plan) {
this.rsPlan = plan;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -36,7 +36,6 @@
import com.metamatrix.query.optimizer.QueryOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.processor.proc.AbstractAssignmentInstruction;
import com.metamatrix.query.processor.proc.AssignmentInstruction;
import com.metamatrix.query.processor.proc.BreakInstruction;
import com.metamatrix.query.processor.proc.ContinueInstruction;
@@ -60,9 +59,11 @@
import com.metamatrix.query.sql.proc.CreateUpdateProcedureCommand;
import com.metamatrix.query.sql.proc.IfStatement;
import com.metamatrix.query.sql.proc.LoopStatement;
+import com.metamatrix.query.sql.proc.RaiseErrorStatement;
import com.metamatrix.query.sql.proc.Statement;
import com.metamatrix.query.sql.proc.WhileStatement;
import com.metamatrix.query.sql.symbol.Expression;
+import com.metamatrix.query.sql.symbol.ScalarSubquery;
import com.metamatrix.query.sql.visitor.CommandCollectorVisitor;
import com.metamatrix.query.util.CommandContext;
@@ -167,7 +168,6 @@
// plan each statement in the block
for (Statement statement : block.getStatements()) {
Object instruction = planStatement(parentProcCommand, statement, metadata, debug,
idGenerator, capFinder, analysisRecord, context);
- //childIndex = ((Integer) array[0]).intValue();
if(instruction instanceof ProgramInstruction){
programBlock.addInstruction((ProgramInstruction)instruction);
}else{
@@ -207,38 +207,44 @@
// program instr resulting in planning this statement
Object instruction = null;
switch(stmtType) {
- case Statement.TYPE_ERROR:
case Statement.TYPE_ASSIGNMENT:
case Statement.TYPE_DECLARE:
{
- AbstractAssignmentInstruction assignInstr = null;
- if (stmtType == Statement.TYPE_ERROR) {
- assignInstr = new ErrorInstruction();
- } else {
- assignInstr = new AssignmentInstruction();
- }
+ AssignmentInstruction assignInstr = new AssignmentInstruction();
instruction = assignInstr;
AssignmentStatement assignStmt = (AssignmentStatement)statement;
assignInstr.setVariable(assignStmt.getVariable());
- ProcessorPlan assignPlan = null;
if(assignStmt.hasCommand()) {
- assignPlan = assignStmt.getCommand().getProcessorPlan();
- assignInstr.setProcessPlan(assignPlan);
+ assignInstr.setExpression(new ScalarSubquery(assignStmt.getCommand()));
} else if (assignStmt.hasExpression()) {
Expression asigExpr = assignStmt.getExpression();
assignInstr.setExpression(asigExpr);
}
if(debug) {
-
analysisRecord.println("\t"+instruction.toString()+"\n" + statement);
//$NON-NLS-1$ //$NON-NLS-2$
- if (assignPlan != null) {
- analysisRecord.println("\t\tASSIGNMENT COMMAND PROCESS PLAN:\n
" + assignPlan); //$NON-NLS-1$
- }
+ analysisRecord.println("\tASSIGNMENT\n" + statement);
//$NON-NLS-1$
}
break;
}
+ case Statement.TYPE_ERROR:
+ {
+ ErrorInstruction error = new ErrorInstruction();
+ instruction = error;
+ RaiseErrorStatement res = (RaiseErrorStatement)statement;
+
+ if(res.hasCommand()) {
+ error.setExpression(new ScalarSubquery(res.getCommand()));
+ } else if (res.hasExpression()) {
+ Expression asigExpr = res.getExpression();
+ error.setExpression(asigExpr);
+ }
+ if(debug) {
+ analysisRecord.println("\tERROR STATEMENT:\n" + statement);
//$NON-NLS-1$
+ }
+ break;
+ }
case Statement.TYPE_COMMAND:
{
CommandStatement cmdStmt = (CommandStatement) statement;
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/optimizer/xml/XMLPlanner.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,7 +22,6 @@
package com.metamatrix.query.optimizer.xml;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -33,7 +32,6 @@
import com.metamatrix.api.exception.query.QueryPlannerException;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
-import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.id.IDGenerator;
import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.execution.QueryExecPlugin;
@@ -42,8 +40,6 @@
import com.metamatrix.query.mapping.xml.MappingNodeLogger;
import com.metamatrix.query.mapping.xml.MappingRecursiveElement;
import com.metamatrix.query.mapping.xml.MappingSourceNode;
-import com.metamatrix.query.mapping.xml.MappingVisitor;
-import com.metamatrix.query.mapping.xml.Navigator;
import com.metamatrix.query.mapping.xml.ResultSetInfo;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.optimizer.CommandPlanner;
@@ -136,7 +132,6 @@
// create plan from program and initialized environment
XMLProcessorEnvironment env = planEnv.createProcessorEnvironment(programPlan);
- env.setChildPlans(getChildPlans(doc));
XMLPlan plan = new XMLPlan(env);
plan.setXMLSchemas(metadata.getXMLSchemas(group.getMetadataID()));
if(debug) {
@@ -148,28 +143,6 @@
return plan;
}
- private static Collection getChildPlans(MappingDocument doc) throws
QueryMetadataException, MetaMatrixComponentException {
- final List childPlans = new ArrayList();
- MappingVisitor real = new MappingVisitor(){
- public void visit(MappingSourceNode element) {
- childPlans.add(element.getResultSetInfo().getPlan());
- }
- };
- try {
- MappingVisitor visitor = new Navigator(true, real);
- doc.acceptVisitor(visitor);
- } catch (MetaMatrixRuntimeException e) {
- if (e.getCause() instanceof QueryMetadataException) {
- throw (QueryMetadataException)e.getCause();
- }
- else if (e.getCause() instanceof MetaMatrixComponentException) {
- throw (MetaMatrixComponentException)e.getCause();
- }
- throw e;
- }
- return childPlans;
- }
-
private static void debugDocumentInfo(String msgTag, XMLPlannerEnvironment planEnv)
{
planEnv.analysisRecord.println("\n"+msgTag+":============================================================================");
//$NON-NLS-1$ //$NON-NLS-2$
planEnv.analysisRecord.println("MAPPING DOCUMENT:\n" +
MappingNode.toStringNodeTree(planEnv.mappingDoc)); //$NON-NLS-1$
Deleted: trunk/engine/src/main/java/com/metamatrix/query/processor/Describable.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/Describable.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/Describable.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,91 +0,0 @@
-/*
- * 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 com.metamatrix.query.processor;
-
-import java.util.Map;
-
-/**
- * Interface for processor plans, nodes, etc to mark them as being
- * describable by a set of properties.
- */
-public interface Describable {
-
- // Common
- public static final String PROP_TYPE = "type"; //$NON-NLS-1$
- public static final String PROP_CHILDREN = "children"; //$NON-NLS-1$
- public static final String PROP_OUTPUT_COLS = "outputCols"; //$NON-NLS-1$
-
- // Relational
- public static final String PROP_CRITERIA = "criteria"; //$NON-NLS-1$
- public static final String PROP_SELECT_COLS = "selectCols"; //$NON-NLS-1$
- public static final String PROP_GROUP_COLS = "groupCols"; //$NON-NLS-1$
- public static final String PROP_SQL = "sql"; //$NON-NLS-1$
- public static final String PROP_MODEL_NAME = "modelName"; //$NON-NLS-1$
- public static final String PROP_JOIN_STRATEGY = "joinStrategy";
//$NON-NLS-1$
- public static final String PROP_JOIN_TYPE = "joinType"; //$NON-NLS-1$
- public static final String PROP_JOIN_CRITERIA = "joinCriteria";
//$NON-NLS-1$
- public static final String PROP_EXECUTION_PLAN = "execPlan"; //$NON-NLS-1$
- public static final String PROP_INTO_GROUP = "intoGrp"; //$NON-NLS-1$
- public static final String PROP_SORT_COLS = "sortCols"; //$NON-NLS-1$
- public static final String PROP_REMOVE_DUPS = "removeDups"; //$NON-NLS-1$
- public static final String PROP_NODE_STATS_LIST = "nodeStatistics";
//$NON-NLS-1$
- public static final String PROP_NODE_STATS_PROPS =
"nodeStatisticsProperties"; //$NON-NLS-1$
- public static final String PROP_NODE_COST_ESTIMATES = "nodeCostEstimates";
//$NON-NLS-1$
- public static final String PROP_ROW_OFFSET = "rowOffset"; //$NON-NLS-1$
- public static final String PROP_ROW_LIMIT = "rowLimit"; //$NON-NLS-1$
-
- // XML
- public static final String PROP_MESSAGE = "message"; //$NON-NLS-1$
- public static final String PROP_TAG = "tag"; //$NON-NLS-1$
- public static final String PROP_NAMESPACE = "namespace"; //$NON-NLS-1$
- public static final String PROP_DATA_COL = "dataCol"; //$NON-NLS-1$
- public static final String PROP_NAMESPACE_DECL = "namespaceDeclarations";
//$NON-NLS-1$
- public static final String PROP_OPTIONAL = "optional"; //$NON-NLS-1$
- public static final String PROP_DEFAULT = "default"; //$NON-NLS-1$
- public static final String PROP_PROGRAM = "program"; //$NON-NLS-1$
- public static final String PROP_RECURSE_DIR = "recurseDir"; //$NON-NLS-1$
- public static final String PROP_RESULT_SET = "resultSet"; //$NON-NLS-1$
- public static final String PROP_BINDINGS = "bindings"; //$NON-NLS-1$
- public static final String PROP_IS_STAGING = "isStaging"; //$NON-NLS-1$
- public static final String PROP_IN_MEMORY = "inMemory"; //$NON-NLS-1$
- public static final String PROP_CONDITIONS = "conditions"; //$NON-NLS-1$
- public static final String PROP_PROGRAMS = "programs"; //$NON-NLS-1$
- public static final String PROP_DEFAULT_PROGRAM = "defaultProgram";
//$NON-NLS-1$
- public static final String PROP_ENCODING = "encoding"; //$NON-NLS-1$
- public static final String PROP_FORMATTED = "formatted"; //$NON-NLS-1$
- public static final String PROP_EXPRESSION = "expression"; //$NON-NLS-1$
-
- // Procedure
- public static final String PROP_VARIABLE = "variable"; //$NON-NLS-1$
- public static final String PROP_GROUP = "group"; //$NON-NLS-1$
- public static final String PROP_THEN = "then"; //$NON-NLS-1$
- public static final String PROP_ELSE = "else"; //$NON-NLS-1$
-
- /**
- * Get a description as a set of properties of primitive types such
- * as String, Integer, etc.
- * @return Map of properties
- */
- Map getDescriptionProperties();
-
-}
Deleted: trunk/engine/src/main/java/com/metamatrix/query/processor/DescribableUtil.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/DescribableUtil.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/DescribableUtil.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,62 +0,0 @@
-/*
- * 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 com.metamatrix.query.processor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.query.sql.symbol.SingleElementSymbol;
-
-/**
- */
-public class DescribableUtil {
-
- /**
- * Never construct - just a utilities class
- */
- private DescribableUtil() {
- super();
- }
-
- /**
- * Helper method to turn a list of projected symbols into a suitable list of
- * output column strings with name and type.
- * @param projectedSymbols The list of SingleElementSymbol projected from a plan or
node
- * @return List of output columns for sending to the client as part of the plan
- */
- public static List getOutputColumnProperties(List projectedSymbols) {
- if(projectedSymbols != null) {
- List outputCols = new ArrayList(projectedSymbols.size());
- for(int i=0; i<projectedSymbols.size() ; i++) {
- SingleElementSymbol symbol = (SingleElementSymbol)
projectedSymbols.get(i);
- outputCols.add(symbol.getShortName() + " (" +
DataTypeManager.getDataTypeName(symbol.getType()) + ")"); //$NON-NLS-1$
//$NON-NLS-2$
- }
- return outputCols;
- }
- return Collections.EMPTY_LIST;
- }
-
-
-}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,15 +22,20 @@
package com.metamatrix.query.processor;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.List;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.processor.BatchCollector.BatchProducer;
import com.metamatrix.query.util.CommandContext;
@@ -47,7 +52,7 @@
* the call to {@link #close}.
* </p>
*/
-public abstract class ProcessorPlan implements Cloneable, Describable, BatchProducer {
+public abstract class ProcessorPlan implements Cloneable, BatchProducer {
private List warnings = null;
@@ -148,5 +153,14 @@
public boolean requiresTransaction(boolean transactionalReads) {
return transactionalReads;
}
+
+ /**
+ * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
+ */
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode(this.getClass().getSimpleName());
+ props.addProperty(PROP_OUTPUT_COLS,
AnalysisRecord.getOutputColumnProperties(getOutputElements()));
+ return props;
+ }
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/batch/BatchedUpdatePlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,16 +24,15 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.query.processor.DescribableUtil;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.sql.lang.Command;
@@ -206,15 +205,11 @@
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
* @since 4.2
*/
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "Batched Update Plan"); //$NON-NLS-1$
- List children = new ArrayList();
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
for (int i = 0; i < getPlanCount(); i++) {
- children.add(updatePlans[i].getDescriptionProperties());
+ props.addProperty("Batch Plan " + i,
updatePlans[i].getDescriptionProperties()); //$NON-NLS-1$
}
- props.put(PROP_CHILDREN, children);
- props.put(PROP_OUTPUT_COLS,
DescribableUtil.getOutputColumnProperties(getOutputElements()));
return props;
}
Deleted:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AbstractAssignmentInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AbstractAssignmentInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AbstractAssignmentInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -1,179 +0,0 @@
-/*
- * 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 com.metamatrix.query.processor.proc;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.query.execution.QueryExecPlugin;
-import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.processor.program.ProgramInstruction;
-import com.metamatrix.query.sql.symbol.ElementSymbol;
-import com.metamatrix.query.sql.symbol.Expression;
-import com.metamatrix.query.sql.util.VariableContext;
-import com.metamatrix.query.util.ErrorMessageKeys;
-
-/**
- * <p> This instruction updates the current variable context with a value for the
Variable
- * defined using a DeclareInstruction, the variable value is obtained by either
processing
- * a expression or a command(stored as a processplan). The Processing of the command is
- * expected to result in 1 column, 1 row tuple.</p>
- */
-public abstract class AbstractAssignmentInstruction extends ProgramInstruction {
-
- // variable whose value is updated in the context
- private ElementSymbol variable;
- // expression to be processed
- private Expression expression;
- // processorPlan to be processed
- private ProcessorPlan processPlan;
-
- /**
- * <p> Updates the current variable context with a value for the Variable
- * defined using a DeclareInstruction, the variable value is obtained by either
processing
- * a expression or a command(stored as a processplan). The Processing of the command is
- * expected to result in 1 column, 1 row tuple, if more than a row is returned an
exception
- * is thrown. Also updates the program counter.</p>
- * @throws BlockedException
- * @throws MetaMatrixComponentException if error processing command or expression on
this instruction
- */
- public void process(ProcedurePlan procEnv) throws BlockedException,
- MetaMatrixComponentException,
MetaMatrixProcessingException {
-
- VariableContext varContext = procEnv.getCurrentVariableContext();
- Object value = null;
- if (this.getExpression() != null || this.getProcessorPlan() != null) {
-
- if (this.expression != null) {
- //Evaluated the given expression - may throw BlockedException!
- value = procEnv.evaluateExpression(this.expression);
- } else if (processPlan != null) {
- String rsName = "ASSIGNMENT_INSTRUCTION"; //$NON-NLS-1$
- procEnv.executePlan(processPlan, rsName);
-
- procEnv.iterateCursor(rsName);
- List tuple = procEnv.getCurrentRow(rsName);
- // did not expect more than one tupe
- if (procEnv.iterateCursor(rsName)) {
- throw new
MetaMatrixProcessingException(ErrorMessageKeys.PROCESSOR_0019,
-
QueryExecPlugin.Util.getString(ErrorMessageKeys.PROCESSOR_0019, variable));
- }
- if (tuple != null) {
- value = tuple.get(0);
- }
- procEnv.removeResults(rsName);
- }
- }
- processValue(value, varContext);
- }
-
- protected abstract void processValue(Object value, VariableContext varContext) throws
MetaMatrixComponentException, MetaMatrixProcessingException;
-
- protected ProcessorPlan getProcessorPlan(){
- return this.processPlan;
- }
-
-
- protected void cloneState(AbstractAssignmentInstruction clone) {
- clone.setVariable(this.variable);
- clone.setExpression(this.expression);
- if (processPlan != null) {
- clone.setProcessPlan(getProcessPlan().clone());
- }
- }
-
- public Map getDescriptionProperties() {
- Map props = new HashMap();
-
- if (this.expression != null) {
- props.put(PROP_EXPRESSION, this.expression.toString());
- } else if (this.processPlan != null){
- props.put(PROP_PROGRAM, this.processPlan.getDescriptionProperties());
- }
-
- getDescriptionProperties(props);
-
- return props;
- }
-
- protected abstract void getDescriptionProperties(Map props);
-
- /**
- * @see com.metamatrix.query.processor.program.ProgramInstruction#getChildPlans()
- * @since 4.2
- */
- public List<ProcessorPlan> getChildPlans() {
- if(this.processPlan != null) {
- return Arrays.asList(this.processPlan);
- }
- return null;
- }
-
- /**
- * @return Returns the expression.
- */
- public Expression getExpression() {
- return this.expression;
- }
-
- /**
- * @param expression The expression to set.
- */
- public void setExpression(Expression expression) {
- this.expression = expression;
- }
-
- /**
- * @return Returns the processPlan.
- */
- public ProcessorPlan getProcessPlan() {
- return this.processPlan;
- }
-
- /**
- * @param processPlan The processPlan to set.
- */
- public void setProcessPlan(ProcessorPlan processPlan) {
- this.processPlan = processPlan;
- }
-
- /**
- * @return Returns the variable.
- */
- public ElementSymbol getVariable() {
- return this.variable;
- }
-
- /**
- * @param variable The variable to set.
- */
- public void setVariable(ElementSymbol variable) {
- this.variable = variable;
- }
-
-}
\ No newline at end of file
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,11 +22,21 @@
package com.metamatrix.query.processor.proc;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import java.util.Arrays;
+
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.buffer.BlockedException;
+import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
+import com.metamatrix.query.analysis.AnalysisRecord;
+import com.metamatrix.query.processor.program.ProgramInstruction;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
+import com.metamatrix.query.sql.symbol.Expression;
import com.metamatrix.query.sql.util.VariableContext;
/**
@@ -35,13 +45,78 @@
* a expression or a command(stored as a processplan). The Processing of the command is
* expected to result in 1 column, 1 row tuple.</p>
*/
-public class AssignmentInstruction extends AbstractAssignmentInstruction {
+public class AssignmentInstruction extends ProgramInstruction {
+ // variable whose value is updated in the context
+ private ElementSymbol variable;
+ // expression to be processed
+ private Expression expression;
+
public AssignmentInstruction() {
}
+
+ /**
+ * <p> Updates the current variable context with a value for the Variable
+ * defined using a DeclareInstruction, the variable value is obtained by either
processing
+ * a expression or a command(stored as a processplan). The Processing of the command is
+ * expected to result in 1 column, 1 row tuple, if more than a row is returned an
exception
+ * is thrown. Also updates the program counter.</p>
+ * @throws BlockedException
+ * @throws MetaMatrixComponentException if error processing command or expression on
this instruction
+ */
+ public void process(ProcedurePlan procEnv) throws BlockedException,
+ MetaMatrixComponentException,
MetaMatrixProcessingException {
+ VariableContext varContext = procEnv.getCurrentVariableContext();
+ Object value = null;
+ if (this.expression != null) {
+ value = procEnv.evaluateExpression(this.expression);
+ }
+ varContext.setValue(getVariable(), value);
+ LogManager.logTrace(LogConstants.CTX_DQP,
+ new Object[] {this.toString() + " The variable "
//$NON-NLS-1$
+ + getVariable() + " in the variablecontext
is updated with the value :", value}); //$NON-NLS-1$
+ }
+
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("ASSIGNMENT"); //$NON-NLS-1$
+ props.addProperty(PROP_VARIABLE, this.variable.toString());
+ if (this.expression != null) {
+ AnalysisRecord.addLanaguageObjects(props, PROP_EXPRESSION,
Arrays.asList(this.expression));
+ }
+ return props;
+ }
+
+ /**
+ * @return Returns the expression.
+ */
+ public Expression getExpression() {
+ return this.expression;
+ }
+
+ /**
+ * @param expression The expression to set.
+ */
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
+
+ /**
+ * @return Returns the variable.
+ */
+ public ElementSymbol getVariable() {
+ return this.variable;
+ }
+
+ /**
+ * @param variable The variable to set.
+ */
+ public void setVariable(ElementSymbol variable) {
+ this.variable = variable;
+ }
+
public String toString() {
- return "ASSIGNMENT INSTRUCTION:"; //$NON-NLS-1$
+ return "ASSIGNMENT INSTRUCTION: " + variable; //$NON-NLS-1$
}
/**
@@ -49,26 +124,9 @@
*/
public AssignmentInstruction clone() {
AssignmentInstruction clone = new AssignmentInstruction();
- this.cloneState(clone);
+ clone.setVariable(this.variable);
+ clone.setExpression(this.expression);
return clone;
}
- /**
- * @see
com.metamatrix.query.processor.proc.AbstractAssignmentInstruction#processValue(java.lang.Object)
- */
- protected void processValue(Object value, VariableContext varContext) throws
MetaMatrixComponentException,
- MetaMatrixProcessingException {
- varContext.setValue(getVariable(), value);
- LogManager.logTrace(com.metamatrix.common.log.LogConstants.CTX_DQP,
- new Object[] {this.toString() + " The variable "
//$NON-NLS-1$
- + getVariable() + " in the variablecontext
is updated with the value :", value}); //$NON-NLS-1$
- }
-
- /**
- * @see
com.metamatrix.query.processor.proc.AbstractAssignmentInstruction#getDescriptionProperties(java.util.Map)
- */
- protected void getDescriptionProperties(Map props) {
- props.put(PROP_TYPE, "ASSIGNMENT"); //$NON-NLS-1$
- }
-
}
\ No newline at end of file
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/BreakInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/BreakInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/BreakInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,10 +24,10 @@
*/
package com.metamatrix.query.processor.proc;
-import java.util.*;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.query.processor.program.*;
+import com.metamatrix.query.processor.program.ProgramInstruction;
/**
* <p>This {@link ProgramInstruction} break from a loop when processed</p>.
@@ -43,11 +43,8 @@
env.incrementProgramCounter();
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "BREAK"); //$NON-NLS-1$
-
- return props;
+ public PlanNode getDescriptionProperties() {
+ return new PlanNode("BREAK"); //$NON-NLS-1$
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ContinueInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ContinueInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ContinueInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -26,6 +26,8 @@
import java.util.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.query.processor.program.*;
@@ -50,10 +52,8 @@
}
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "CONTINUE"); //$NON-NLS-1$
- return props;
+ public PlanNode getDescriptionProperties() {
+ return new PlanNode("CONTINUE"); //$NON-NLS-1$
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,11 +24,10 @@
*/
package com.metamatrix.query.processor.proc;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -80,11 +79,10 @@
return "CREATE CURSOR RESULTSET INSTRUCTION - " + rsName;
//$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "CREATE CURSOR"); //$NON-NLS-1$
- props.put(PROP_RESULT_SET, this.rsName);
- props.put(PROP_SQL, this.plan.toString());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("CREATE CURSOR"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.rsName);
+ props.addProperty(PROP_SQL, this.plan.getDescriptionProperties());
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,51 +22,61 @@
package com.metamatrix.query.processor.proc;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.ProcedureErrorInstructionException;
import com.metamatrix.common.log.LogManager;
-import com.metamatrix.query.sql.util.VariableContext;
+import com.metamatrix.query.processor.program.ProgramInstruction;
+import com.metamatrix.query.sql.symbol.Expression;
/**
* <p> This instruction updates the current variable context with the Variable
defined using
* the declare statement that is used in constructing this instruction.</p>
*/
-public class ErrorInstruction extends AbstractAssignmentInstruction {
+public class ErrorInstruction extends ProgramInstruction {
public static final String ERROR_PREFIX = "Procedure error:";
//$NON-NLS-1$
+ private Expression expression;
+
/**
* Constructor for DeclareInstruction.
*/
public ErrorInstruction() {
}
+
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
/**
* @see com.metamatrix.query.processor.program.ProgramInstruction#clone()
*/
public ErrorInstruction clone() {
ErrorInstruction clone = new ErrorInstruction();
- this.cloneState(clone);
+ clone.expression = expression;
return clone;
}
public String toString() {
- return "RAISE ERROR INSTRUCTION:"; //$NON-NLS-1$
+ return "RAISE ERROR INSTRUCTION: " + expression; //$NON-NLS-1$
}
-
- protected void getDescriptionProperties(Map props) {
- props.put(PROP_TYPE, "RAISE ERROR"); //$NON-NLS-1$
+
+ public PlanNode getDescriptionProperties() {
+ PlanNode node = new PlanNode("RAISE ERROR"); //$NON-NLS-1$
+ node.addProperty(PROP_EXPRESSION, this.expression.toString());
+ return node;
}
-
- /**
- * @see
com.metamatrix.query.processor.proc.AbstractAssignmentInstruction#processValue(java.lang.Object)
- */
- protected void processValue(Object value, VariableContext varContext) throws
MetaMatrixComponentException,
- MetaMatrixProcessingException {
- LogManager.logTrace(com.metamatrix.common.log.LogConstants.CTX_DQP,
+
+ @Override
+ public void process(ProcedurePlan env) throws MetaMatrixComponentException,
+ MetaMatrixProcessingException {
+ Object value = env.evaluateExpression(expression);
+ LogManager.logTrace(com.metamatrix.common.log.LogConstants.CTX_DQP,
new Object[] {"Processing RaiseErrorInstruction with the
value :", value}); //$NON-NLS-1$
throw new ProcedureErrorInstructionException(ERROR_PREFIX + (value != null ?
value.toString() : "")); //$NON-NLS-1$
}
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 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,6 +22,8 @@
package com.metamatrix.query.processor.proc;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -29,6 +31,7 @@
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
import org.teiid.connector.language.SQLReservedWords;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -75,20 +78,6 @@
*/
public class ExecDynamicSqlInstruction extends ProgramInstruction {
- private static class PopCallInstruction extends ProgramInstruction {
-
- /**
- * @see
com.metamatrix.query.processor.program.ProgramInstruction#process(ProcedurePlan)
- */
- public void process(ProcedurePlan procEnv) throws MetaMatrixComponentException,
- MetaMatrixProcessingException {
- procEnv.getContext().popCall();
- }
-
- }
-
- private static PopCallInstruction POP_CALL_INSTRUCTION = new PopCallInstruction();
-
// the DynamicCommand
private DynamicCommand dynamicCommand;
@@ -200,11 +189,18 @@
.createNonRecordingRecord(), procEnv
.getContext());
- CreateCursorResultSetInstruction inst = new
CreateCursorResultSetInstruction(CreateCursorResultSetInstruction.RS_NAME, commandPlan);
+ CreateCursorResultSetInstruction inst = new
CreateCursorResultSetInstruction(CreateCursorResultSetInstruction.RS_NAME, commandPlan) {
+ @Override
+ public void process(ProcedurePlan procEnv)
+ throws BlockedException, MetaMatrixComponentException,
+ MetaMatrixProcessingException {
+ super.process(procEnv);
+ procEnv.getContext().popCall();
+ }
+ };
dynamicProgram = new Program();
dynamicProgram.addInstruction(inst);
- dynamicProgram.addInstruction(POP_CALL_INSTRUCTION);
if (dynamicCommand.getIntoGroup() != null) {
String groupName = dynamicCommand.getIntoGroup().getCanonicalName();
@@ -332,13 +328,9 @@
return "ExecDynamicSqlInstruction"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "SQL"); //$NON-NLS-1$
- props.put(PROP_SQL, CreateCursorResultSetInstruction.RS_NAME);
- if (dynamicCommand.getIntoGroup() != null) {
- props.put(PROP_GROUP, dynamicCommand.getIntoGroup().toString());
- }
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("ExecDynamicSqlInstruction"); //$NON-NLS-1$
+ props.addProperty(PROP_SQL, dynamicCommand.toString());
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,10 @@
package com.metamatrix.query.processor.proc;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -129,13 +130,12 @@
return "IF INSTRUCTION:"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "IF"); //$NON-NLS-1$
- props.put(PROP_CRITERIA, this.condition.toString());
- props.put(PROP_THEN, this.ifProgram.getDescriptionProperties());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("IF"); //$NON-NLS-1$
+ props.addProperty(PROP_CRITERIA, this.condition.toString());
+ props.addProperty(PROP_THEN, this.ifProgram.getDescriptionProperties());
if(elseProgram != null) {
- props.put(PROP_ELSE, this.elseProgram.getDescriptionProperties());
+ props.addProperty(PROP_ELSE, this.elseProgram.getDescriptionProperties());
}
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,11 +24,13 @@
*/
package com.metamatrix.query.processor.proc;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.query.processor.ProcessorPlan;
@@ -43,8 +45,6 @@
// the loop block
private Program loopProgram;
- //list of ElementSymbols theat represents all the possible
- //cursor columns
private List elements;
public LoopInstruction(Program loopProgram, String rsName, ProcessorPlan plan) {
@@ -79,14 +79,14 @@
}
public String toString() {
- return "LOOP INSTRUCTION:"; //$NON-NLS-1$
+ return "LOOP INSTRUCTION: " + this.rsName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "LOOP"); //$NON-NLS-1$
- props.put(PROP_RESULT_SET, this.rsName);
- props.put(PROP_PROGRAM, this.loopProgram.getDescriptionProperties());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("LOOP"); //$NON-NLS-1$
+ props.addProperty(PROP_SQL, this.plan.getDescriptionProperties());
+ props.addProperty(PROP_RESULT_SET, this.rsName);
+ props.addProperty(PROP_PROGRAM, this.loopProgram.getDescriptionProperties());
return props;
}
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 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,6 +22,8 @@
package com.metamatrix.query.processor.proc;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -33,6 +35,8 @@
import java.util.Set;
import java.util.Stack;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.QueryValidatorException;
@@ -42,12 +46,12 @@
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.common.buffer.TupleSource;
import com.metamatrix.common.log.LogManager;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.SupportConstants;
import com.metamatrix.query.processor.BatchIterator;
import com.metamatrix.query.processor.CollectionTupleSource;
-import com.metamatrix.query.processor.DescribableUtil;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.processor.QueryProcessor;
@@ -367,12 +371,10 @@
return batch;
}
- public Map getDescriptionProperties() {
- Map props = this.originalProgram.getDescriptionProperties();
- props.put(PROP_TYPE, "Procedure Plan"); //$NON-NLS-1$
- props.put(PROP_OUTPUT_COLS,
DescribableUtil.getOutputColumnProperties(getOutputElements()));
-
- return props;
+ public PlanNode getDescriptionProperties() {
+ PlanNode node = this.originalProgram.getDescriptionProperties();
+ node.addProperty(PROP_OUTPUT_COLS,
AnalysisRecord.getOutputColumnProperties(getOutputElements()));
+ return node;
}
public void setMetadata( QueryMetadataInterface metadata ) {
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,9 +24,10 @@
*/
package com.metamatrix.query.processor.proc;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.query.processor.program.Program;
@@ -66,11 +67,10 @@
return "WHILE INSTRUCTION:"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "WHILE"); //$NON-NLS-1$
- props.put(PROP_CRITERIA, this.condition.toString());
- props.put(PROP_PROGRAM, this.whileProgram.getDescriptionProperties());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("WHILE"); //$NON-NLS-1$
+ props.addProperty(PROP_CRITERIA, this.condition.toString());
+ props.addProperty(PROP_PROGRAM, this.whileProgram.getDescriptionProperties());
return props;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -23,12 +23,10 @@
package com.metamatrix.query.processor.program;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import com.metamatrix.query.processor.Describable;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.query.processor.proc.IfInstruction;
import com.metamatrix.query.processor.proc.WhileInstruction;
@@ -37,7 +35,7 @@
* ProgramInstructions, such as {@link IfInstruction} and {@link WhileInstruction} may
* have pointers to sub programs.
*/
-public class Program implements Cloneable, Describable {
+public class Program implements Cloneable {
private List<ProgramInstruction> programInstructions;
private int counter = 0;
@@ -132,19 +130,15 @@
return program;
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "Program"); //$NON-NLS-1$
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("Program"); //$NON-NLS-1$
if(this.programInstructions != null) {
- List children = new ArrayList();
- Iterator iter = this.programInstructions.iterator();
- while(iter.hasNext()) {
- ProgramInstruction inst = (ProgramInstruction) iter.next();
- Map childProps = inst.getDescriptionProperties();
- children.add(childProps);
+ for (int i = 0; i < programInstructions.size(); i++) {
+ ProgramInstruction inst = programInstructions.get(i);
+ PlanNode childProps = inst.getDescriptionProperties();
+ props.addProperty("Instruction " + i, childProps);
//$NON-NLS-1$
}
- props.put(PROP_CHILDREN, children);
}
return props;
}
@@ -180,7 +174,7 @@
programToString(str);
- return "PROGRAM counter " + this.counter + " " +
str.toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ return "PROGRAM counter " + this.counter + "\n" +
str.toString(); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,13 +22,12 @@
package com.metamatrix.query.processor.program;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.query.processor.Describable;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.processor.proc.ProcedurePlan;
@@ -42,7 +41,7 @@
* The exception to this are instructions that have sub programs in them -
* those sub programs need to be cloned.</p>
*/
-public abstract class ProgramInstruction implements Cloneable, Describable {
+public abstract class ProgramInstruction implements Cloneable {
public ProgramInstruction() {
}
@@ -82,11 +81,7 @@
}
return null;
}
-
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- return props;
- }
-
+ public abstract PlanNode getDescriptionProperties();
+
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/AccessNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/AccessNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/AccessNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,10 +22,13 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.CriteriaEvaluationException;
@@ -215,12 +218,10 @@
/*
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
*/
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Access"); //$NON-NLS-1$
- props.put(PROP_SQL, this.command.toString());
- props.put(PROP_MODEL_NAME, this.modelName);
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
+ props.addProperty(PROP_SQL, this.command.toString());
+ props.addProperty(PROP_MODEL_NAME, this.modelName);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentAccessNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentAccessNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentAccessNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,8 +22,6 @@
package com.metamatrix.query.processor.relational;
-import java.util.Map;
-
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.core.util.Assertion;
@@ -76,17 +74,6 @@
return clonedNode;
}
- /*
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Dependent Access"); //$NON-NLS-1$
- props.put(PROP_SQL, this.getCommand().toString());
- props.put(PROP_MODEL_NAME, getModelName());
- return props;
- }
-
/**
* @return Returns the maxSize.
*/
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureAccessNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureAccessNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureAccessNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -23,7 +23,6 @@
package com.metamatrix.query.processor.relational;
import java.util.List;
-import java.util.Map;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -52,15 +51,6 @@
this.inputReferences = references;
}
- /*
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Dependent Procedure Access"); //$NON-NLS-1$
- return props;
- }
-
/**
* @see com.metamatrix.query.processor.relational.PlanExecutionNode#clone()
*/
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureExecutionNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -51,15 +51,6 @@
this.inputReferences = references;
}
- /*
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Dependent Procedure Execution"); //$NON-NLS-1$
- return props;
- }
-
/**
* @see com.metamatrix.query.processor.relational.PlanExecutionNode#clone()
*/
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/GroupingNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,12 +22,15 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
import org.teiid.connector.language.SQLReservedWords;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -414,21 +417,20 @@
/*
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
*/
- public Map getDescriptionProperties() {
+ public PlanNode getDescriptionProperties() {
// Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Grouping"); //$NON-NLS-1$
+ PlanNode props = super.getDescriptionProperties();
if(sortElements != null) {
int elements = sortElements.size();
- List groupCols = new ArrayList(elements);
+ List<String> groupCols = new ArrayList<String>(elements);
for(int i=0; i<elements; i++) {
groupCols.add(this.sortElements.get(i).toString());
}
- props.put(PROP_GROUP_COLS, groupCols);
+ props.addProperty(PROP_GROUP_COLS, groupCols);
}
- props.put(PROP_REMOVE_DUPS, this.removeDuplicates);
+ props.addProperty(PROP_SORT_MODE, String.valueOf(this.removeDuplicates));
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/JoinNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,13 +22,14 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.CriteriaEvaluationException;
@@ -39,7 +40,6 @@
import com.metamatrix.common.buffer.BufferManager.BufferReserveMode;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.relational.SourceState.ImplicitBuffer;
-import com.metamatrix.query.sql.LanguageObject;
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.sql.lang.JoinType;
import com.metamatrix.query.util.CommandContext;
@@ -234,24 +234,22 @@
* @see
com.metamatrix.query.processor.relational.RelationalNode#getDescriptionProperties()
* @since 4.2
*/
- public Map getDescriptionProperties() {
+ public PlanNode getDescriptionProperties() {
// Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
+ PlanNode props = super.getDescriptionProperties();
if(isDependent()) {
- props.put(PROP_TYPE, "Dependent Join"); //$NON-NLS-1$
- } else {
- props.put(PROP_TYPE, "Join"); //$NON-NLS-1$
+ props.addProperty(PROP_DEPENDENT, Boolean.TRUE.toString());
}
- props.put(PROP_JOIN_STRATEGY, this.joinStrategy.toString());
- props.put(PROP_JOIN_TYPE, this.joinType.toString());
- List critList = getCriteriaList();
- props.put(PROP_JOIN_CRITERIA, critList);
+ props.addProperty(PROP_JOIN_STRATEGY, this.joinStrategy.toString());
+ props.addProperty(PROP_JOIN_TYPE, this.joinType.toString());
+ List<String> critList = getCriteriaList();
+ props.addProperty(PROP_JOIN_CRITERIA, critList);
return props;
}
- private List getCriteriaList() {
- List critList = new ArrayList();
+ private List<String> getCriteriaList() {
+ List<String> critList = new ArrayList<String>();
if (leftExpressions != null) {
for(int i=0; i < this.leftExpressions.size(); i++) {
critList.add(this.leftExpressions.get(i).toString() + "=" +
this.rightExpressions.get(i).toString()); //$NON-NLS-1$
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/LimitNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/LimitNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/LimitNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,10 +22,13 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.Collections;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -33,6 +36,7 @@
import com.metamatrix.query.eval.Evaluator;
import com.metamatrix.query.sql.symbol.Expression;
+
public class LimitNode extends RelationalNode {
private final Expression limitExpr;
@@ -137,11 +141,10 @@
}
}
- public Map getDescriptionProperties() {
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Limit"); //$NON-NLS-1$
- props.put(PROP_ROW_OFFSET, offsetExpr);
- props.put(PROP_ROW_LIMIT, limitExpr);
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
+ props.addProperty(PROP_ROW_OFFSET, String.valueOf(offsetExpr));
+ props.addProperty(PROP_ROW_LIMIT, String.valueOf(limitExpr));
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/NullNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/NullNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/NullNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,8 +22,6 @@
package com.metamatrix.query.processor.relational;
-import java.util.Map;
-
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.buffer.TupleBatch;
@@ -50,14 +48,4 @@
return clonedNode;
}
- /*
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Null"); //$NON-NLS-1$
- return props;
- }
-
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,12 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -158,15 +161,13 @@
protected void copy(PlanExecutionNode source,
PlanExecutionNode target) {
- target.setProcessorPlan((ProcessorPlan)source.plan.clone());
+ target.setProcessorPlan(source.plan.clone());
super.copy(source, target);
}
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Plan Execution"); //$NON-NLS-1$
- props.put(PROP_EXECUTION_PLAN, this.plan.getDescriptionProperties());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
+ props.addProperty(PROP_EXECUTION_PLAN, this.plan.getDescriptionProperties());
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectIntoNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectIntoNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectIntoNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,10 +24,13 @@
*/
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -217,16 +220,14 @@
return clonedNode;
}
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Project Into"); //$NON-NLS-1$
- props.put(PROP_INTO_GROUP, intoGroup.toString());
- List selectCols = new ArrayList(intoElements.size());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
+ props.addProperty(PROP_INTO_GROUP, intoGroup.toString());
+ List<String> selectCols = new
ArrayList<String>(intoElements.size());
for(int i=0; i<this.intoElements.size(); i++) {
selectCols.add(this.intoElements.get(i).toString());
}
- props.put(PROP_SELECT_COLS, selectCols);
+ props.addProperty(PROP_SELECT_COLS, selectCols);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/ProjectNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,13 +22,16 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.ExpressionEvaluationException;
@@ -36,9 +39,9 @@
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.core.util.Assertion;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.processor.ProcessorDataManager;
-import com.metamatrix.query.sql.LanguageObject;
import com.metamatrix.query.sql.symbol.AggregateSymbol;
import com.metamatrix.query.sql.symbol.AliasSymbol;
import com.metamatrix.query.sql.symbol.ElementSymbol;
@@ -254,16 +257,9 @@
/*
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
*/
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Project"); //$NON-NLS-1$
- List selectCols = new ArrayList(selectSymbols.size());
- for(int i=0; i<this.selectSymbols.size(); i++) {
- selectCols.add(this.selectSymbols.get(i).toString());
- }
- props.put(PROP_SELECT_COLS, selectCols);
-
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
+ AnalysisRecord.addLanaguageObjects(props, PROP_SELECT_COLS, this.selectSymbols);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,12 +22,16 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -36,15 +40,14 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.Assertion;
-import com.metamatrix.query.processor.Describable;
-import com.metamatrix.query.processor.DescribableUtil;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.BatchCollector.BatchProducer;
import com.metamatrix.query.sql.symbol.AliasSymbol;
import com.metamatrix.query.sql.symbol.SingleElementSymbol;
import com.metamatrix.query.util.CommandContext;
-public abstract class RelationalNode implements Cloneable, Describable, BatchProducer {
+public abstract class RelationalNode implements Cloneable, BatchProducer {
// External context and state
private CommandContext context;
@@ -464,9 +467,7 @@
* @return Just the last part which is the class name
*/
protected String getClassName() {
- String fullClassName = this.getClass().getName();
- int index = fullClassName.lastIndexOf("."); //$NON-NLS-1$
- return fullClassName.substring(index+1);
+ return this.getClass().getSimpleName();
}
/**
@@ -494,34 +495,24 @@
}
}
- /*
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
+ public PlanNode getDescriptionProperties() {
// Default implementation - should be overridden
- Map props = new HashMap();
+ PlanNode result = new PlanNode(getClassName());
+ result.addProperty(PROP_OUTPUT_COLS,
AnalysisRecord.getOutputColumnProperties(this.elements));
if(this.context != null && this.context.getCollectNodeStatistics()) {
this.nodeStatistics.setStatisticsList();
- props.put(PROP_NODE_STATS_LIST, this.nodeStatistics.getStatisticsList());
+ result.addProperty(PROP_NODE_STATS_LIST,
this.nodeStatistics.getStatisticsList());
}
- List costEstimates = this.getCostEstimates();
+ List<String> costEstimates = this.getCostEstimates();
if(costEstimates != null) {
- props.put(PROP_NODE_COST_ESTIMATES, costEstimates);
+ result.addProperty(PROP_NODE_COST_ESTIMATES, costEstimates);
}
- props.put(PROP_TYPE, "Relational"); //$NON-NLS-1$
- props.put(PROP_CHILDREN, getChildDescriptionProperties());
- props.put(PROP_OUTPUT_COLS,
DescribableUtil.getOutputColumnProperties(this.elements));
- return props;
- }
-
- protected List getChildDescriptionProperties() {
- ArrayList childrenProps = new ArrayList(children.length);
for(int i=0; i<children.length; i++) {
if(children[i] != null) {
- childrenProps.add(this.children[i].getDescriptionProperties());
+ result.addProperty("Child " + i,
this.children[i].getDescriptionProperties()); //$NON-NLS-1$
}
}
- return childrenProps;
+ return result;
}
/**
@@ -552,8 +543,8 @@
this.estimateJoinCost = estimateJoinCost;
}
- private List getCostEstimates() {
- List costEstimates = new ArrayList();
+ private List<String> getCostEstimates() {
+ List<String> costEstimates = new ArrayList<String>();
if(this.estimateNodeCardinality != null) {
costEstimates.add("Estimated Node Cardinality: "+
this.estimateNodeCardinality); //$NON-NLS-1$
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -37,7 +37,7 @@
static final int BATCHCOMPLETE_STOP = 0;
static final int BLOCKEDEXCEPTION_STOP = 1;
- private List statisticsList;
+ private List<String> statisticsList = new ArrayList<String>();
private boolean setNodeStartTime;
// The total amount of rows output by this node
@@ -67,7 +67,6 @@
private int nodeBlocks;
public RelationalNodeStatistics() {
- this.statisticsList = new ArrayList();
this.setNodeStartTime = false;
}
@@ -126,7 +125,7 @@
this.statisticsList.add("Node Blocks: " + this.nodeBlocks);
//$NON-NLS-1$
}
- public List getStatisticsList() {
+ public List<String> getStatisticsList() {
return this.statisticsList;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalPlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,16 +24,15 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.query.processor.DescribableUtil;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.sql.lang.QueryCommand;
@@ -135,15 +134,8 @@
/*
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
*/
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "Relational Plan"); //$NON-NLS-1$
- List children = new ArrayList();
- Map childProps = getRootNode().getDescriptionProperties();
- children.add(childProps);
- props.put(PROP_CHILDREN, children);
- props.put(PROP_OUTPUT_COLS,
DescribableUtil.getOutputColumnProperties(getOutputElements()));
- return props;
+ public PlanNode getDescriptionProperties() {
+ return this.root.getDescriptionProperties();
}
/**
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SelectNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SelectNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SelectNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,14 +22,20 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.util.CommandContext;
@@ -147,11 +153,9 @@
/*
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
*/
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Select"); //$NON-NLS-1$
- props.put(PROP_CRITERIA, this.criteria.toString());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
+ AnalysisRecord.addLanaguageObjects(props, PROP_CRITERIA,
Arrays.asList(this.criteria));
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,10 +22,13 @@
package com.metamatrix.query.processor.relational;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -156,24 +159,12 @@
return clonedNode;
}
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- switch (mode) {
- case SORT:
- props.put(PROP_TYPE, "Sort"); //$NON-NLS-1$
- break;
- case DUP_REMOVE:
- props.put(PROP_TYPE, "Duplicate Removal"); //$NON-NLS-1$
- break;
- case DUP_REMOVE_SORT:
- props.put(PROP_TYPE, "Duplicate Removal And Sort"); //$NON-NLS-1$
- break;
- }
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = super.getDescriptionProperties();
if(this.mode != Mode.DUP_REMOVE && this.sortElements != null) {
Boolean ASC_B = Boolean.valueOf(OrderBy.ASC);
- List cols = new ArrayList(this.sortElements.size());
+ List<String> cols = new
ArrayList<String>(this.sortElements.size());
for(int i=0; i<this.sortElements.size(); i++) {
String elemName = this.sortElements.get(i).toString();
if(this.sortTypes.get(i).equals(ASC_B)) {
@@ -182,10 +173,10 @@
cols.add(elemName + " DESC"); //$NON-NLS-1$
}
}
- props.put(PROP_SORT_COLS, cols);
+ props.addProperty(PROP_SORT_COLS, cols);
}
- props.put(PROP_REMOVE_DUPS, this.mode);
+ props.addProperty(PROP_SORT_MODE, this.mode.toString());
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SubqueryAwareEvaluator.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -112,6 +112,7 @@
if (!state.done) {
if (state.processor == null) {
CommandContext subContext = (CommandContext) context.clone();
+ state.plan.reset();
state.processor = new QueryProcessor(state.plan, subContext, manager,
this.dataMgr);
if (container.getCommand().getCorrelatedReferences() != null) {
VariableContext currentContext = new VariableContext();
@@ -123,7 +124,6 @@
state.collector = state.processor.createBatchCollector();
}
state.done = true;
- state.plan.reset();
}
return new
DependentValueSource(state.collector.collectTuples()).getValueIterator(ref.getValueExpression());
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/UnionAllNode.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -23,7 +23,6 @@
package com.metamatrix.query.processor.relational;
import java.util.Collections;
-import java.util.Map;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -150,13 +149,5 @@
super.copy(this, clonedNode);
return clonedNode;
}
-
- public Map getDescriptionProperties() {
- // Default implementation - should be overridden
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "Union All"); //$NON-NLS-1$
-
- return props;
- }
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AbortProcessingInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AbortProcessingInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AbortProcessingInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,8 +22,7 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -68,10 +67,8 @@
return "ABORT"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "ABORT"); //$NON-NLS-1$
- return props;
+ public PlanNode getDescriptionProperties() {
+ return new PlanNode("ABORT"); //$NON-NLS-1$
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddCommentInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddCommentInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddCommentInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,12 +22,14 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
+import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
/**
@@ -56,7 +58,7 @@
DocumentInProgress doc = env.getDocumentInProgress();
doc.addComment(this.commentText);
- LogManager.logTrace(com.metamatrix.common.log.LogConstants.CTX_XML_PLAN,
"COMMENT"); //$NON-NLS-1$
+ LogManager.logTrace(LogConstants.CTX_XML_PLAN, "COMMENT");
//$NON-NLS-1$
env.incrementCurrentProgramCounter();
return context;
@@ -68,11 +70,9 @@
return str.toString();
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "ADD COMMENT"); //$NON-NLS-1$
- props.put(PROP_MESSAGE, this.commentText);
-
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("COMMENT"); //$NON-NLS-1$
+ props.addProperty(PROP_MESSAGE, this.commentText);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddNodeInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddNodeInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/AddNodeInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,13 +22,15 @@
package com.metamatrix.query.processor.xml;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -183,42 +185,42 @@
return str.toString();
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = null;
if(descriptor.isElement()) {
- props.put(PROP_TYPE, "ADD ELEMENT"); //$NON-NLS-1$
+ props = new PlanNode("ADD ELEMENT"); //$NON-NLS-1$
} else {
- props.put(PROP_TYPE, "ADD ATTRIBUTE"); //$NON-NLS-1$
+ props = new PlanNode("ADD ATTRIBUTE"); //$NON-NLS-1$
}
- props.put(PROP_TAG, this.descriptor.getName());
+ props.addProperty(PROP_TAG, this.descriptor.getName());
if(descriptor.isOptional()) {
- props.put(PROP_OPTIONAL, ""+descriptor.isOptional()); //$NON-NLS-1$
+ props.addProperty(PROP_OPTIONAL, ""+descriptor.isOptional());
//$NON-NLS-1$
}
if(this.symbol != null) {
- props.put(PROP_DATA_COL, this.symbol);
+ props.addProperty(PROP_DATA_COL, this.symbol.toString());
}
if(descriptor.getNamespacePrefix() != null) {
- props.put(PROP_NAMESPACE, descriptor.getNamespacePrefix());
+ props.addProperty(PROP_NAMESPACE, descriptor.getNamespacePrefix());
}
Properties namespaceDeclarations = descriptor.getNamespaceURIs();
if(namespaceDeclarations != null) {
- List nsDecl = new ArrayList(namespaceDeclarations.size());
+ List<String> nsDecl = new
ArrayList<String>(namespaceDeclarations.size());
Enumeration e = namespaceDeclarations.propertyNames();
while (e.hasMoreElements()){
String prefix = (String)e.nextElement();
String ns = namespaceDeclarations.getProperty(prefix);
nsDecl.add(prefix + "=\"" + ns + "\"");
//$NON-NLS-1$ //$NON-NLS-2$
}
- props.put(PROP_NAMESPACE_DECL, nsDecl);
+ props.addProperty(PROP_NAMESPACE_DECL, nsDecl);
}
if(descriptor.getDefaultValue() != null) {
- props.put(PROP_DEFAULT, descriptor.getDefaultValue());
+ props.addProperty(PROP_DEFAULT, descriptor.getDefaultValue());
}
return props;
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/BlockInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/BlockInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/BlockInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,10 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -60,12 +61,9 @@
return "BLOCK " + resultSetName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "BLOCK"); //$NON-NLS-1$
-
- props.put(PROP_RESULT_SET, this.resultSetName);
-
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("BLOCK"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.resultSetName);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndBlockInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndBlockInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndBlockInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,10 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -75,11 +76,9 @@
return "CLOSE " + resultSetName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "CLOSE RESULTSET"); //$NON-NLS-1$
- props.put(PROP_RESULT_SET, this.resultSetName);
-
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("CLOSE RESULTSET"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.resultSetName);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndDocumentInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndDocumentInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/EndDocumentInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,8 +22,7 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -65,11 +64,8 @@
return "END DOC"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "END DOCUMENT"); //$NON-NLS-1$
-
- return props;
+ public PlanNode getDescriptionProperties() {
+ return new PlanNode("END DOCUMENT"); //$NON-NLS-1$
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecSqlInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecSqlInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecSqlInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,10 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -72,13 +73,10 @@
return "SQL " + resultSetName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "EXECUTE SQL"); //$NON-NLS-1$
- props.put(PROP_SQL, this.resultSetName);
- props.put(PROP_RESULT_SET, this.resultSetName);
- props.put(PROP_IS_STAGING, "false"); //$NON-NLS-1$
-
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("EXECUTE SQL"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.resultSetName);
+ props.addProperty(PROP_SQL, this.info.getPlan().getDescriptionProperties());
return props;
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecStagingTableInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecStagingTableInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ExecStagingTableInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,12 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -85,11 +88,11 @@
return "STAGING:"+resultSetName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "Staging Table"); //$NON-NLS-1$
- props.put(PROP_RESULT_SET, this.resultSetName);
- props.put(PROP_IS_STAGING, "true"); //$NON-NLS-1$
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("Staging Table"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.resultSetName);
+ props.addProperty(PROP_IS_STAGING, "true"); //$NON-NLS-1$
+ props.addProperty(PROP_SQL, this.info.getPlan().getDescriptionProperties());
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/IfInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/IfInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/IfInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,12 +22,13 @@
package com.metamatrix.query.processor.xml;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -204,28 +205,24 @@
return "IF BLOCK:"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "CHOICE"); //$NON-NLS-1$
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("CHOICE"); //$NON-NLS-1$
- List conditions = new ArrayList(thenBlocks.size());
- List programs = new ArrayList(thenBlocks.size());
-
- Iterator iter = this.thenBlocks.iterator();
- while(iter.hasNext()) {
- Condition condition = (Condition) iter.next();
- conditions.add(condition.toString());
+ for (int i = 0; i < this.thenBlocks.size(); i++) {
+ Condition condition = (Condition) thenBlocks.get(i);
+ PlanNode node = null;
if(condition instanceof RecurseProgramCondition) {
- programs.add(new HashMap());
+ node = new PlanNode("RECURSIVE"); //$NON-NLS-1$
+ node.addProperty(PROP_CONDITION, condition.toString());
} else {
- programs.add(condition.getThenProgram().getDescriptionProperties());
+ node = condition.getThenProgram().getDescriptionProperties();
+ node.addProperty(PROP_CONDITION,
((CriteriaCondition)condition).criteria.toString());
}
+ props.addProperty("Condition " + i, node); //$NON-NLS-1$
}
- props.put(PROP_CONDITIONS, conditions);
- props.put(PROP_PROGRAMS, programs);
if (defaultCondition != null && defaultCondition.getThenProgram() !=
null){
- props.put(PROP_DEFAULT_PROGRAM,
defaultCondition.getThenProgram().getDescriptionProperties());
+ props.addProperty(PROP_DEFAULT_PROGRAM,
defaultCondition.getThenProgram().getDescriptionProperties());
}
return props;
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/InitializeDocumentInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/InitializeDocumentInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/InitializeDocumentInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,10 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -112,12 +113,11 @@
return "DOC encoding: " + encoding + ", is formatted: " +
isFormatted; //$NON-NLS-1$ //$NON-NLS-2$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "START DOCUMENT"); //$NON-NLS-1$
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("START DOCUMENT"); //$NON-NLS-1$
- props.put(PROP_ENCODING, this.encoding);
- props.put(PROP_FORMATTED, ""+this.isFormatted); //$NON-NLS-1$
+ props.addProperty(PROP_ENCODING, this.encoding);
+ props.addProperty(PROP_FORMATTED, String.valueOf(this.isFormatted));
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/JoinedWhileInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/JoinedWhileInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/JoinedWhileInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -25,6 +25,8 @@
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -137,9 +139,7 @@
return "JOINED " + originalResultSet + " " +
super.toString(); //$NON-NLS-1$ //$NON-NLS-2$
}
- public Map getDescriptionProperties() {
- Map props = super.getDescriptionProperties();
- props.put(PROP_TYPE, "JOINED LOOP"); //$NON-NLS-1$
- return props;
+ public PlanNode getDescriptionProperties() {
+ return new PlanNode("JOINED LOOP"); //$NON-NLS-1$
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveCursorInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveCursorInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveCursorInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,10 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -63,12 +64,9 @@
return "NEXT " + resultSetName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "NEXT ROW"); //$NON-NLS-1$
-
- props.put(PROP_RESULT_SET, this.resultSetName);
-
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("NEXT ROW"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.resultSetName);
return props;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveDocInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveDocInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/MoveDocInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,9 +22,7 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
-
+import org.teiid.client.plan.PlanNode;
import org.xml.sax.SAXException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -88,15 +86,11 @@
return "LAST"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
+ public PlanNode getDescriptionProperties() {
if(direction == UP) {
- props.put(PROP_TYPE, "UP IN DOCUMENT"); //$NON-NLS-1$
- } else {
- props.put(PROP_TYPE, "NEXT IN DOCUMENT"); //$NON-NLS-1$
- }
-
- return props;
+ return new PlanNode("UP IN DOCUMENT"); //$NON-NLS-1$
+ }
+ return new PlanNode("NEXT IN DOCUMENT"); //$NON-NLS-1$
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ProcessorInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ProcessorInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/ProcessorInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,18 +22,16 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.query.processor.Describable;
/**
* <p>Abstract superclass of all XML Processor Instructions.</p>
*/
-public abstract class ProcessorInstruction implements Describable {
+public abstract class ProcessorInstruction {
public ProcessorInstruction() {
}
@@ -54,12 +52,7 @@
*/
public abstract XMLContext process(XMLProcessorEnvironment env, XMLContext context)
throws BlockedException, MetaMatrixComponentException,
MetaMatrixProcessingException;
+
+ public abstract PlanNode getDescriptionProperties();
- /*
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- return props;
- }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/xml/Program.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/xml/Program.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/xml/Program.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,12 +22,10 @@
package com.metamatrix.query.processor.xml;
-import java.util.*;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import com.metamatrix.query.processor.Describable;
+import org.teiid.client.plan.PlanNode;
/**
* A program is a sequence of {@link ProcessorInstruction ProcessorInstructions}.
Certain
@@ -35,9 +33,9 @@
* pointers to sub programs. XMLPlan will maintain a stack of programs during
* execution.
*/
-public class Program implements Describable {
+public class Program {
- private List processorInstructions;
+ private List<ProcessorInstruction> processorInstructions;
/**
* Constructor for Program.
@@ -62,7 +60,7 @@
* @param instructionIndex index of instruction to be removed
*/
public void removeInstructionAt(int instructionIndex) {
- List instructions = getProcessorInstructions();
+ List<ProcessorInstruction> instructions = getProcessorInstructions();
if (instructionIndex < instructions.size()) {
instructions.remove(instructionIndex);
}
@@ -85,19 +83,15 @@
return ("PROGRAM size " + getProcessorInstructions().size());
//$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "XML Program"); //$NON-NLS-1$
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("XML Program"); //$NON-NLS-1$
if(this.processorInstructions != null) {
- List children = new ArrayList();
- Iterator iter = this.processorInstructions.iterator();
- while(iter.hasNext()) {
- ProcessorInstruction inst = (ProcessorInstruction) iter.next();
- Map childProps = inst.getDescriptionProperties();
- children.add(childProps);
+ for (int i = 0; i < processorInstructions.size(); i++) {
+ ProcessorInstruction inst = processorInstructions.get(i);
+ PlanNode childProps = inst.getDescriptionProperties();
+ props.addProperty("Instruction " + i, childProps);
//$NON-NLS-1$
}
- props.put(PROP_CHILDREN, children);
}
return props;
}
@@ -115,15 +109,15 @@
private ProcessorInstruction getInstructionAtIndex(int instructionIndex){
if (processorInstructions != null){
if (instructionIndex < getProcessorInstructions().size()){
- return
(ProcessorInstruction)getProcessorInstructions().get(instructionIndex);
+ return getProcessorInstructions().get(instructionIndex);
}
}
return null;
}
- List getProcessorInstructions(){
+ List<ProcessorInstruction> getProcessorInstructions(){
if (processorInstructions == null){
- processorInstructions = new ArrayList();
+ processorInstructions = new ArrayList<ProcessorInstruction>();
}
return processorInstructions;
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/RelationalPlanExecutor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -70,7 +70,7 @@
this.resultInfo = resultInfo;
this.bufferMgr = bufferMgr;
- ProcessorPlan plan = (ProcessorPlan)resultInfo.getPlan();
+ ProcessorPlan plan = resultInfo.getPlan();
CommandContext subContext = (CommandContext)context.clone();
subContext.pushVariableContext(new VariableContext());
this.internalProcessor = new QueryProcessor(plan, subContext, bufferMgr,
dataMgr);
@@ -80,7 +80,7 @@
* @see com.metamatrix.query.processor.xml.PlanExecutor#getOutputElements()
*/
public List getOutputElements() throws MetaMatrixComponentException {
- ProcessorPlan plan = (ProcessorPlan)resultInfo.getPlan();
+ ProcessorPlan plan = resultInfo.getPlan();
return plan.getOutputElements();
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/WhileInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/WhileInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/WhileInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,10 +22,13 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.PlanNode;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
@@ -109,11 +112,10 @@
return "LOOP " + resultSetName; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "LOOP"); //$NON-NLS-1$
- props.put(PROP_RESULT_SET, this.resultSetName);
- props.put(PROP_PROGRAM, this.blockProgram.getDescriptionProperties());
+ public PlanNode getDescriptionProperties() {
+ PlanNode props = new PlanNode("LOOP"); //$NON-NLS-1$
+ props.addProperty(PROP_RESULT_SET, this.resultSetName);
+ props.addProperty(PROP_PROGRAM, this.blockProgram.getDescriptionProperties());
return props;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,6 +22,8 @@
package com.metamatrix.query.processor.xml;
+import static com.metamatrix.query.analysis.AnalysisRecord.*;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
@@ -36,13 +38,13 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.teiid.client.lob.LobChunk;
+import org.teiid.client.plan.PlanNode;
import org.xml.sax.Attributes;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
@@ -66,8 +68,8 @@
import com.metamatrix.common.types.Streamable;
import com.metamatrix.common.types.XMLType;
import com.metamatrix.core.util.Assertion;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.execution.QueryExecPlugin;
-import com.metamatrix.query.processor.DescribableUtil;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.processor.TempTableDataManager;
@@ -77,6 +79,7 @@
import com.metamatrix.query.tempdata.TempTableStoreImpl;
import com.metamatrix.query.util.CommandContext;
import com.metamatrix.query.util.ErrorMessageKeys;
+
/**
*
*/
@@ -132,7 +135,7 @@
nextBatchCount = 1;
this.env = (XMLProcessorEnvironment)this.env.clone();
-
+
LogManager.logTrace(LogConstants.CTX_XML_PLAN, "XMLPlan reset");
//$NON-NLS-1$
}
@@ -561,24 +564,10 @@
/*
* @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
*/
- public Map getDescriptionProperties() {
- Map props = this.originalProgram.getDescriptionProperties();
-// Get relational plans to get description props and add them to children
- Collection childRelationalPlans = env.getChildPlans();
- ArrayList children = (ArrayList) props.get(PROP_CHILDREN);
- if(childRelationalPlans!=null) {
- Iterator childRelationalPlansIterator = childRelationalPlans.iterator();
- while(childRelationalPlansIterator.hasNext()) {
- ProcessorPlan relationalPlan = (ProcessorPlan)
childRelationalPlansIterator.next();
- Map planProperties = relationalPlan.getDescriptionProperties();
- children.add(planProperties);
- }
- }
- props.put(PROP_CHILDREN, children);
- props.put(PROP_TYPE, "XML Plan"); //$NON-NLS-1$
- props.put(PROP_OUTPUT_COLS,
DescribableUtil.getOutputColumnProperties(getOutputElements()));
-
- return props;
+ public PlanNode getDescriptionProperties() {
+ PlanNode node = this.originalProgram.getDescriptionProperties();
+ node.addProperty(PROP_OUTPUT_COLS,
AnalysisRecord.getOutputColumnProperties(getOutputElements()));
+ return node;
}
public GroupSymbol getDocumentGroup() {
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPostProcessor.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPostProcessor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPostProcessor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -31,7 +31,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Map;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
@@ -188,11 +187,6 @@
}
@Override
- public Map getDescriptionProperties() {
- return this.plan.getDescriptionProperties();
- }
-
- @Override
public boolean requiresTransaction(boolean transactionalReads) {
return plan.requiresTransaction(transactionalReads);
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLProcessorEnvironment.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,7 +22,6 @@
package com.metamatrix.query.processor.xml;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -63,8 +62,6 @@
private BufferManager bufferMgr;
private CommandContext commandContext;
- private Collection childPlans;
-
protected XMLProcessorEnvironment(){
}
@@ -221,11 +218,11 @@
public PlanExecutor createResultExecutor(String resultSetName, ResultSetInfo info)
throws MetaMatrixComponentException{
- // this cloning code is here beacuse, cloning the plan inside the resultset is
not possible
- // becuse of the dependencies.
+ // cloning the plan inside the resultset is not possible
+ // because of the dependencies.
ResultSetInfo clone = (ResultSetInfo)info.clone();
- ProcessorPlan plan = (ProcessorPlan)clone.getPlan();
- plan = (ProcessorPlan)plan.clone();
+ ProcessorPlan plan = clone.getPlan();
+ plan = plan.clone();
clone.setPlan(plan);
return new RelationalPlanExecutor(clone, this.commandContext, this.dataMgr,
this.bufferMgr);
@@ -275,13 +272,6 @@
/**
- * @see com.metamatrix.query.processor.xml.ProcessorEnvironment#getChildPlans()
- */
- public Collection getChildPlans() {
- return this.childPlans;
- }
-
- /**
* @see com.metamatrix.query.processor.xml.ProcessorEnvironment#clone()
*/
public Object clone() {
@@ -325,7 +315,4 @@
this.loadedStagingTables.put(tableName, Boolean.TRUE);
}
- public void setChildPlans(Collection childPlans){
- this.childPlans = childPlans;
- }
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,9 +24,7 @@
import java.sql.SQLXML;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -38,7 +36,6 @@
import com.metamatrix.common.types.Streamable;
import com.metamatrix.common.types.XMLTranslator;
import com.metamatrix.common.types.XMLType;
-import com.metamatrix.query.processor.DescribableUtil;
import com.metamatrix.query.processor.ProcessorDataManager;
import com.metamatrix.query.processor.ProcessorPlan;
import com.metamatrix.query.processor.xml.XMLUtil;
@@ -166,18 +163,6 @@
public void close() throws MetaMatrixComponentException {
}
- /**
- * @see com.metamatrix.query.processor.Describable#getDescriptionProperties()
- */
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "XQuery Plan"); //$NON-NLS-1$
- List children = new ArrayList();
- props.put(PROP_CHILDREN, children);
- props.put(PROP_OUTPUT_COLS,
DescribableUtil.getOutputColumnProperties(getOutputElements()));
- return props;
- }
-
public String toString() {
return "XQueryPlan: " + this.xQuery.toString(); //$NON-NLS-1$
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Option.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,13 +22,15 @@
package com.metamatrix.query.sql.lang;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
import org.teiid.connector.language.SQLReservedWords;
-import com.metamatrix.core.util.HashCodeUtil;
-import com.metamatrix.query.sql.*;
import com.metamatrix.core.util.EquivalenceUtil;
+import com.metamatrix.core.util.HashCodeUtil;
+import com.metamatrix.query.sql.LanguageObject;
+import com.metamatrix.query.sql.LanguageVisitor;
import com.metamatrix.query.sql.visitor.SQLStringVisitor;
/**
@@ -42,11 +44,8 @@
public final static String MAKENOTDEP = SQLReservedWords.MAKENOTDEP;
public final static String OPTIONAL = "optional"; //$NON-NLS-1$
- private boolean showPlan = false;
- private boolean debug = false;
private List<String> makeDependentGroups;
private List<String> makeNotDependentGroups;
- private boolean planOnly = false;
private List<String> noCacheGroups;
private boolean noCache;
@@ -56,55 +55,7 @@
public Option() {
}
- /**
- * Set flag for returning the query plan with the results
- * @param flag True to return the query plan with the results, false otherwise
- */
- public void setShowPlan(boolean flag) {
- this.showPlan = flag;
- }
-
- /**
- * Get flag for whether to return the query plan with the results
- * @return True to return the query plan with the results
- */
- public boolean getShowPlan() {
- return this.showPlan;
- }
-
/**
- * Set flag for returning only the query plan without executing the query
- * @param flag True to return the query plan without the results, false otherwise
- */
- public void setPlanOnly(boolean planOnly) {
- this.planOnly = planOnly;
- }
-
- /**
- * Get flag for whether to return the query plan without the results
- * @return True to return the query plan without the results
- */
- public boolean getPlanOnly() {
- return this.planOnly;
- }
-
- /**
- * Set flag to dump debug info on the server
- * @param flag True to dump debug info for this query, false otherwise
- */
- public void setDebug(boolean flag) {
- this.debug = flag;
- }
-
- /**
- * Get flag for whether to dump debug info on the server
- * @return True if debug info should be dumped on the server, false otherwise
- */
- public boolean getDebug() {
- return this.debug;
- }
-
- /**
* Add group to make dependent
* @param group Group to make dependent
*/
@@ -202,10 +153,7 @@
Option other = (Option) obj;
- return getShowPlan() == other.getShowPlan() &&
- getDebug() == other.getDebug() &&
- getPlanOnly() == other.getPlanOnly() &&
- noCache == other.noCache &&
+ return noCache == other.noCache &&
EquivalenceUtil.areEqual(getDependentGroups(), other.getDependentGroups())
&&
EquivalenceUtil.areEqual(getNotDependentGroups(),
other.getNotDependentGroups()) &&
EquivalenceUtil.areEqual(getNoCacheGroups(), other.getNoCacheGroups());
@@ -217,9 +165,6 @@
*/
public int hashCode() {
int hc = 0;
- hc = HashCodeUtil.hashCode(hc, getShowPlan());
- hc = HashCodeUtil.hashCode(hc, getDebug());
- hc = HashCodeUtil.hashCode(hc, getPlanOnly());
if(getDependentGroups() != null) {
hc = HashCodeUtil.hashCode(hc, getDependentGroups());
}
@@ -238,9 +183,6 @@
*/
public Object clone() {
Option newOption = new Option();
- newOption.setDebug(getDebug());
- newOption.setShowPlan(getShowPlan());
- newOption.setPlanOnly(getPlanOnly());
newOption.setNoCache(noCache);
if(getDependentGroups() != null) {
Modified:
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/SQLStringVisitor.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/SQLStringVisitor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/com/metamatrix/query/sql/visitor/SQLStringVisitor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -624,21 +624,6 @@
public void visit(Option obj) {
parts.add(SQLReservedWords.OPTION);
- if(obj.getShowPlan()) {
- parts.add(" "); //$NON-NLS-1$
- parts.add(SQLReservedWords.SHOWPLAN);
- }
-
- if(obj.getPlanOnly()) {
- parts.add(" "); //$NON-NLS-1$
- parts.add(SQLReservedWords.PLANONLY);
- }
-
- if(obj.getDebug()) {
- parts.add(" "); //$NON-NLS-1$
- parts.add(SQLReservedWords.DEBUG);
- }
-
Collection groups = obj.getDependentGroups();
if(groups != null && groups.size() > 0) {
parts.add(" "); //$NON-NLS-1$
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 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -30,6 +30,7 @@
import org.teiid.client.RequestMessage;
import org.teiid.client.RequestMessage.ResultsMode;
+import org.teiid.client.RequestMessage.ShowPlan;
import org.teiid.client.xa.XATransactionException;
import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
import org.teiid.dqp.internal.process.multisource.MultiSourceCapabilitiesFinder;
@@ -78,7 +79,6 @@
import com.metamatrix.query.sql.lang.BatchedUpdateCommand;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.Limit;
-import com.metamatrix.query.sql.lang.Option;
import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.QueryCommand;
import com.metamatrix.query.sql.lang.SetQuery;
@@ -240,8 +240,8 @@
workContext.getVdbName(),
workContext.getVdbVersion(),
props,
- useProcDebug(userCommand),
- collectNodeStatistics(userCommand));
+ useProcDebug(),
+ this.requestMsg.getShowPlan() != ShowPlan.OFF);
this.context.setProcessorBatchSize(bufferManager.getProcessorBatchSize());
this.context.setConnectorBatchSize(bufferManager.getConnectorBatchSize());
this.context.setStreamingBatchSize(chunkSize);
@@ -366,27 +366,13 @@
this.processor = new QueryProcessor(processPlan, context, bufferManager, new
TempTableDataManager(processorDataManager, tempTableStore));
}
- private boolean useProcDebug(Command command) {
+ private boolean useProcDebug() {
if(this.procDebugAllowed) {
- Option option = command.getOption();
- if(option != null) {
- return option.getDebug();
- }
+ return requestMsg.getShowPlan() == ShowPlan.DEBUG;
}
return false;
}
- private boolean collectNodeStatistics(Command command) {
- if(this.requestMsg.getShowPlan()) {
- return true;
- }
- Option option = command.getOption();
- if(option != null) {
- return (option.getDebug() || option.getShowPlan());
- }
- return false;
- }
-
/**
* state side effects:
* creates the analysis record
@@ -409,7 +395,7 @@
//there should be no reference (?) for query/update executed as statement
checkReferences(references);
- createAnalysisRecord(command);
+ this.analysisRecord = new AnalysisRecord(requestMsg.getShowPlan() !=
ShowPlan.OFF, requestMsg.getShowPlan() == ShowPlan.DEBUG);
resolveCommand(command);
@@ -463,18 +449,6 @@
}
}
- private void createAnalysisRecord(Command command) {
- Option option = command.getOption();
- boolean getPlan = requestMsg.getShowPlan();
- boolean debug = false;
- if (option != null) {
- getPlan = getPlan || option.getShowPlan() || option.getPlanOnly();
- debug = option.getDebug();
- }
-
- this.analysisRecord = new AnalysisRecord(getPlan, debug);
- }
-
public void processRequest()
throws QueryValidatorException, QueryParserException, QueryResolverException,
MetaMatrixComponentException, QueryPlannerException {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -25,7 +25,6 @@
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -36,7 +35,6 @@
import org.teiid.client.SourceWarning;
import org.teiid.client.lob.LobChunk;
import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.client.plan.Annotation;
import org.teiid.client.util.ResultsReceiver;
import org.teiid.client.xa.XATransactionException;
import org.teiid.connector.api.DataNotAvailableException;
@@ -66,7 +64,6 @@
import com.metamatrix.query.processor.QueryProcessor;
import com.metamatrix.query.processor.BatchCollector.BatchHandler;
import com.metamatrix.query.sql.lang.Command;
-import com.metamatrix.query.sql.lang.Option;
import com.metamatrix.query.sql.lang.SPParameter;
import com.metamatrix.query.sql.lang.StoredProcedure;
import com.metamatrix.query.sql.symbol.SingleElementSymbol;
@@ -382,8 +379,7 @@
if (analysisRecord.recordQueryPlan()) {
analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
}
- Option option = originalCommand.getOption();
- if (option != null && option.getPlanOnly()) {
+ if (requestMsg.isNoExec()) {
doneProducingBatches = true;
resultsBuffer.close();
this.cid = null;
Modified: trunk/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj 2010-04-07
03:29:59 UTC (rev 2031)
@@ -144,7 +144,6 @@
| <DAY: "day">
| <DEALLOCATE: "deallocate">
| <DEFAULT_KEYWORD: "default">
-| <DEBUG: "debug">
| <DECLARE: "declare">
| <DELETE: "delete">
| <DESC: "desc">
@@ -234,7 +233,6 @@
| <OVERLAPS: "OVERLAPS">
| <PARAMETER: "parameter">
| <PARTITION: "partition">
-| <PLANONLY: "planonly">
| <PRECISION: "precision">
| <PREPARE: "prepare">
| <PRIMARY: "primary">
@@ -260,7 +258,6 @@
| <SENSITIVE: "sensitive">
| <SESSION_USER: "session_user">
| <SET: "set">
-| <SHOWPLAN: "showplan">
| <SIMILAR: "similar">
| <SPECIFIC: "specific">
| <SOME: "some">
@@ -2504,9 +2501,6 @@
*/
Option option(ParseInfo info) :
{
- Token plan = null;
- Token debug = null;
- Token planOnly = null;
String id = null;
Token nocache = null;
Option option = new Option();
@@ -2514,10 +2508,6 @@
{
<OPTION>
(
- plan = <SHOWPLAN> |
- planOnly = <PLANONLY> |
- debug = <DEBUG> |
-
<MAKEDEP>
id=id()
{
@@ -2555,9 +2545,6 @@
)*
{
- option.setShowPlan( (plan != null) );
- option.setPlanOnly( (planOnly != null) );
- option.setDebug( (debug != null) );
option.setNoCache( (nocache != null) );
return option;
}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/message/TestResultsMessage.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/dqp/message/TestResultsMessage.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/dqp/message/TestResultsMessage.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -24,18 +24,18 @@
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import junit.framework.TestCase;
+
import org.teiid.client.ResultsMessage;
import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.client.plan.PlanNode;
-import junit.framework.TestCase;
-
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.core.util.UnitTestUtil;
+@SuppressWarnings("nls")
public class TestResultsMessage extends TestCase {
/**
@@ -46,7 +46,7 @@
super(name);
}
- public static ResultsMessage example() {
+ public static ResultsMessage example() {
ResultsMessage message = new ResultsMessage();
message.setColumnNames(new String[] {"A", "B", "C",
"D"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
message.setDataTypes(new String[] {DataTypeManager.DefaultDataTypes.BIG_INTEGER,
@@ -60,11 +60,11 @@
parameters.add(new ParameterInfo(ParameterInfo.IN, 0));
parameters.add(new ParameterInfo(ParameterInfo.RESULT_SET, 5));
message.setParameters(parameters);
- Map planDescs = new HashMap();
- planDescs.put("key1", "val1"); //$NON-NLS-1$ //$NON-NLS-2$
- planDescs.put("key2", "val2"); //$NON-NLS-1$ //$NON-NLS-2$
- planDescs.put("key3", "val3"); //$NON-NLS-1$ //$NON-NLS-2$
- planDescs.put("key4", "val4"); //$NON-NLS-1$ //$NON-NLS-2$
+ PlanNode planDescs = new PlanNode("test");
+ planDescs.addProperty("key1", "val1"); //$NON-NLS-1$
//$NON-NLS-2$
+ planDescs.addProperty("key2", "val2"); //$NON-NLS-1$
//$NON-NLS-2$
+ planDescs.addProperty("key3", "val3"); //$NON-NLS-1$
//$NON-NLS-2$
+ planDescs.addProperty("key4", "val4"); //$NON-NLS-1$
//$NON-NLS-2$
message.setPlanDescription(planDescs);
List results = new ArrayList();
@@ -113,15 +113,7 @@
assertEquals(5, info2.getNumColumns());
assertNotNull(copy.getPlanDescription());
- assertEquals(4, copy.getPlanDescription().size());
- assertTrue(copy.getPlanDescription().containsKey("key1"));
//$NON-NLS-1$
- assertTrue(copy.getPlanDescription().containsKey("key2"));
//$NON-NLS-1$
- assertTrue(copy.getPlanDescription().containsKey("key3"));
//$NON-NLS-1$
- assertTrue(copy.getPlanDescription().containsKey("key4"));
//$NON-NLS-1$
- assertEquals("val1", copy.getPlanDescription().get("key1"));
//$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("val2", copy.getPlanDescription().get("key2"));
//$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("val3", copy.getPlanDescription().get("key3"));
//$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("val4", copy.getPlanDescription().get("key4"));
//$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(4, copy.getPlanDescription().getProperties().size());
assertNotNull(copy.getResults());
assertEquals(1, copy.getResults().length);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,15 +22,16 @@
package com.metamatrix.query.analysis;
-import java.util.*;
+import java.util.Collection;
+import junit.framework.TestCase;
+
import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
import org.teiid.client.plan.Annotation.Priority;
import com.metamatrix.core.util.StringUtil;
-import junit.framework.TestCase;
-
/**
*/
public class TestAnalysisRecord extends TestCase {
@@ -47,8 +48,8 @@
AnalysisRecord rec = new AnalysisRecord(true, false);
assertTrue(rec.recordQueryPlan());
- Map plan = new HashMap();
- plan.put("node", "value"); //$NON-NLS-1$ //$NON-NLS-2$
+ PlanNode plan = new PlanNode("test"); //$NON-NLS-1$
+ plan.addProperty("node", "value"); //$NON-NLS-1$
//$NON-NLS-2$
rec.setQueryPlan(plan);
assertEquals(rec.getQueryPlan(), plan);
}
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -47,7 +47,6 @@
import com.metamatrix.query.optimizer.TestOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
import com.metamatrix.query.parser.QueryParser;
-import com.metamatrix.query.processor.Describable;
import com.metamatrix.query.processor.xml.BlockInstruction;
import com.metamatrix.query.processor.xml.EndBlockInstruction;
import com.metamatrix.query.processor.xml.ExecSqlInstruction;
@@ -919,13 +918,5 @@
return new FakeMetadataFacade(store);
}
- public void testGetDescriptionProperties() throws Exception {
- XMLPlan plan = helpPlan(
- "SELECT * FROM vm1.doc1 ORDER BY vm1.doc1.a0.a1.c1", //$NON-NLS-1$
- example1());
- assertEquals("[{formatted=false, encoding=UTF-8, type=START DOCUMENT},
{tag=a0, type=ADD ELEMENT, namespaceDeclarations=[], namespace=}, {type=NEXT IN DOCUMENT},
{isStaging=true, resultSet=tm1.g1, type=Staging Table}, {sql=VM1.G1_1, isStaging=false,
resultSet=VM1.G1_1, type=EXECUTE SQL}, {resultSet=VM1.G1_1, type=BLOCK},
{resultSet=VM1.G1_1, type=NEXT ROW}, {program={children=[{tag=a1, type=ADD ELEMENT,
namespaceDeclarations=[], namespace=}, {type=NEXT IN DOCUMENT}, {tag=a1,
dataCol=VM1.G1_1.e1, type=ADD ELEMENT, namespaceDeclarations=[], namespace=}, {tag=b1,
dataCol=VM1.G1_1.e2, type=ADD ELEMENT, namespaceDeclarations=[], namespace=}, {tag=c1,
dataCol=VM1.G1_1.e3, type=ADD ELEMENT, namespaceDeclarations=[], namespace=}, {type=UP IN
DOCUMENT}, {resultSet=VM1.G1_1, type=NEXT ROW}], type=XML Program}, resultSet=VM1.G1_1,
type=LOOP}, {resultSet=VM1.G1_1, type=CLOSE RESULTSET}, {type=UP IN DOCUMENT}, {type=END
DOCUMENT}, {isStaging=true, resultSet=unload_tm1.g1, type=S!
taging Table}, {children=[{removeDups=SORT, sortCols=[#TM1_G1.E3 ASC],
nodeCostEstimates=[Estimated Node Cardinality: -1.0],
children=[{nodeCostEstimates=[Estimated Node Cardinality: -1.0],
children=[{modelName=__TEMP__, sql=SELECT #TM1_G1.E1, #TM1_G1.E2, #TM1_G1.E3, #TM1_G1.E4
FROM #TM1_G1, nodeCostEstimates=[Estimated Node Cardinality: -1.0], children=[],
type=Access, outputCols=[E1 (string), E2 (integer), E3 (boolean), E4 (double)]}],
selectCols=[#TM1_G1.E1, #TM1_G1.E2, #TM1_G1.E3, #TM1_G1.E4], type=Project, outputCols=[E1
(string), E2 (integer), E3 (boolean), E4 (double)]}], type=Sort, outputCols=[E1 (string),
E2 (integer), E3 (boolean), E4 (double)]}], type=Relational Plan, outputCols=[E1 (string),
E2 (integer), E3 (boolean), E4 (double)]}]",
plan.getDescriptionProperties().get(Describable.PROP_CHILDREN).toString());//$NON-NLS-1$
- }
- // ################################## TEST SUITE ################################
-
private static final boolean DEBUG = false;
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/parser/TestOptionsAndHints.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/parser/TestOptionsAndHints.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/parser/TestOptionsAndHints.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -348,14 +348,13 @@
option.setNoCache(true);
option.addNoCacheGroup("a.b.c"); //$NON-NLS-1$
option.addNoCacheGroup("d.e.f"); //$NON-NLS-1$
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setOption(option);
- TestParser.helpTest("Select a From db.g Option nocache a.b.c, d.e.f
showplan", //$NON-NLS-1$
- "SELECT a FROM db.g OPTION SHOWPLAN NOCACHE a.b.c, d.e.f",
//$NON-NLS-1$
+ TestParser.helpTest("Select a From db.g Option nocache a.b.c, d.e.f",
//$NON-NLS-1$
+ "SELECT a FROM db.g OPTION NOCACHE a.b.c, d.e.f",
//$NON-NLS-1$
query);
}
@@ -396,10 +395,10 @@
values.add(new Reference(0));
insert.setValues(values);
Option option = new Option();
- option.setShowPlan(true);
+ option.setNoCache(true);
insert.setOption(option);
- TestParser.helpTest("INSERT INTO m.g (a) VALUES (?) OPTION SHOWPLAN",
//$NON-NLS-1$
- "INSERT INTO m.g (a) VALUES (?) OPTION SHOWPLAN",
//$NON-NLS-1$
+ TestParser.helpTest("INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE",
//$NON-NLS-1$
+ "INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE",
//$NON-NLS-1$
insert);
}
@@ -407,10 +406,10 @@
Delete delete = new Delete();
delete.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
Option option = new Option();
- option.setShowPlan(true);
+ option.setNoCache(true);
delete.setOption(option);
- TestParser.helpTest("DELETE FROM m.g OPTION SHOWPLAN", //$NON-NLS-1$
- "DELETE FROM m.g OPTION SHOWPLAN", //$NON-NLS-1$
+ TestParser.helpTest("DELETE FROM m.g OPTION NOCACHE", //$NON-NLS-1$
+ "DELETE FROM m.g OPTION NOCACHE", //$NON-NLS-1$
delete);
}
@@ -419,11 +418,11 @@
update.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$
update.addChange(new ElementSymbol("a"), new Reference(0));
Option option = new Option();
- option.setShowPlan(true);
+ option.setNoCache(true);
Criteria crit = new CompareCriteria(new ElementSymbol("b"),
CompareCriteria.EQ, new Reference(1)); //$NON-NLS-1$
update.setCriteria(crit);
- TestParser.helpTest("UPDATE m.g SET a = ? WHERE b = ? OPTION SHOWPLAN",
//$NON-NLS-1$
- "UPDATE m.g SET a = ? WHERE b = ? OPTION SHOWPLAN",
//$NON-NLS-1$
+ TestParser.helpTest("UPDATE m.g SET a = ? WHERE b = ? OPTION NOCACHE",
//$NON-NLS-1$
+ "UPDATE m.g SET a = ? WHERE b = ? OPTION NOCACHE",
//$NON-NLS-1$
update);
}
@@ -840,55 +839,12 @@
StoredProcedure storedQuery = new StoredProcedure();
storedQuery.setProcedureName("proc1"); //$NON-NLS-1$
Option option = new Option();
- option.setDebug(true);
+ option.setNoCache(true);
storedQuery.setOption(option);
- TestParser.helpTest("exec proc1() option debug", "EXEC proc1()
OPTION DEBUG", storedQuery); //$NON-NLS-1$ //$NON-NLS-2$
+ TestParser.helpTest("exec proc1() option nocache", "EXEC proc1()
OPTION NOCACHE", storedQuery); //$NON-NLS-1$ //$NON-NLS-2$
}
/** Select a From db.g Option SHOWPLAN */
- @Test public void testOptionShowPlan(){
- GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
- From from = new From();
- from.addGroup(g);
-
- Select select = new Select();
- ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
- select.addSymbol(a);
-
- Option showplan = new Option();
- showplan.setShowPlan(true);
-
- Query query = new Query();
- query.setSelect(select);
- query.setFrom(from);
- query.setOption(showplan);
- TestParser.helpTest("Select a From db.g Option SHOWPLAN",
//$NON-NLS-1$
- "SELECT a FROM db.g OPTION SHOWPLAN", //$NON-NLS-1$
- query);
- }
-
- /** Select a From db.g Option PLANONLY */
- @Test public void testOptionPlanOnly(){
- GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
- From from = new From();
- from.addGroup(g);
-
- Select select = new Select();
- ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
- select.addSymbol(a);
-
- Option showplan = new Option();
- showplan.setPlanOnly(true);
-
- Query query = new Query();
- query.setSelect(select);
- query.setFrom(from);
- query.setOption(showplan);
- TestParser.helpTest("Select a From db.g Option planOnly",
//$NON-NLS-1$
- "SELECT a FROM db.g OPTION PLANONLY", //$NON-NLS-1$
- query);
- }
-
/** Select a From db.g Option makedep a.b.c */
@Test public void testOptionMakeDependent1(){
GroupSymbol g = new GroupSymbol("db.g"); //$NON-NLS-1$
@@ -924,14 +880,13 @@
Option option = new Option();
option.addDependentGroup("a.b.c"); //$NON-NLS-1$
option.addDependentGroup("d.e.f"); //$NON-NLS-1$
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setOption(option);
- TestParser.helpTest("Select a From db.g Option makedep a.b.c, d.e.f
showplan", //$NON-NLS-1$
- "SELECT a FROM db.g OPTION SHOWPLAN MAKEDEP a.b.c, d.e.f",
//$NON-NLS-1$
+ TestParser.helpTest("Select a From db.g Option makedep a.b.c, d.e.f",
//$NON-NLS-1$
+ "SELECT a FROM db.g OPTION MAKEDEP a.b.c, d.e.f",
//$NON-NLS-1$
query);
}
@@ -994,14 +949,13 @@
Option option = new Option();
option.addNotDependentGroup("a.b.c"); //$NON-NLS-1$
option.addNotDependentGroup("d.e.f"); //$NON-NLS-1$
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setOption(option);
- TestParser.helpTest("Select a From db.g Option makeNOTdep a.b.c, d.e.f
showplan", //$NON-NLS-1$
- "SELECT a FROM db.g OPTION SHOWPLAN MAKENOTDEP a.b.c, d.e.f",
//$NON-NLS-1$
+ TestParser.helpTest("Select a From db.g Option makeNOTdep a.b.c,
d.e.f", //$NON-NLS-1$
+ "SELECT a FROM db.g OPTION MAKENOTDEP a.b.c, d.e.f",
//$NON-NLS-1$
query);
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/parser/TestParserXQuery.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/parser/TestParserXQuery.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/parser/TestParserXQuery.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -92,7 +92,7 @@
"}\r\n" + //$NON-NLS-1$
"</Items>"; //$NON-NLS-1$
- String expectedString = xQueryString + " OPTION DEBUG"; //$NON-NLS-1$
+ String expectedString = xQueryString + " OPTION NOCACHE";
//$NON-NLS-1$
XQuery xQuery = new XQuery(xQueryString, null);
@@ -111,8 +111,8 @@
"}\r\n" + //$NON-NLS-1$
"</Items>"; //$NON-NLS-1$
- String xQueryStringWithOption = xQueryString + " option debug";
//$NON-NLS-1$
- String expectedString = xQueryString + " OPTION DEBUG"; //$NON-NLS-1$
+ String xQueryStringWithOption = xQueryString + " option nocache";
//$NON-NLS-1$
+ String expectedString = xQueryString + " OPTION NOCACHE";
//$NON-NLS-1$
XQuery xQuery = new XQuery(xQueryString, null);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -26,9 +26,7 @@
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.buffer.BlockedException;
@@ -141,8 +139,4 @@
return this.outputElements;
}
- public Map getDescriptionProperties() {
- return new HashMap();
- }
-
}
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 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -516,7 +516,7 @@
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- helpTestProcessFailure(false, plan, dataMgr, "Error Code:ERR.015.006.0019
Message:Error processing the AssignmentStatement in stored procedure language, expected to
get a single row of data to be assigned to the variable ROWS_UPDATED but got more.");
//$NON-NLS-1$
+ helpTestProcessFailure(false, plan, dataMgr, "Error Code:ERR.015.006.0058
Message:Unable to evaluate (SELECT pm1.g1.e2 FROM pm1.g1): Error Code:ERR.015.006.0058
Message:The command of this scalar subquery returned more than one value: SELECT pm1.g1.e2
FROM pm1.g1"); //$NON-NLS-1$
}
// error statement
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalNodeStatistics.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalNodeStatistics.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalNodeStatistics.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -86,7 +86,7 @@
assertEquals("The NodeComulativeBlocks was Inccorrect. Correct: 0 Actual:
"+ this.actualNodeCumulativeBlocks, 0, this.actualNodeCumulativeBlocks);
//$NON-NLS-1$
}
- public void testDescriptionProperties() throws MetaMatrixComponentException,
MetaMatrixProcessingException {
+ public void testDescriptionProperties() throws Exception {
List[] data = createData(1000);
FakeRelationalNode fakeNode = this.createFakeNode(data);
@@ -97,17 +97,10 @@
break;
}
}
- List statsList = (List)
fakeNode.getDescriptionProperties().get("nodeStatistics"); //$NON-NLS-1$
-// Iterator statsIterator = statsList.iterator();
-// while(statsIterator.hasNext()) {
-// String stat = (String) statsIterator.next();
-// System.out.println(stat);
-// }
-
- assertEquals("The Number of Statistic was Inccorrect. Correct: 6 Actual:
"+ statsList.size(), 6, statsList.size()); //$NON-NLS-1$
+ assertEquals("FakeRelationalNode",
fakeNode.getDescriptionProperties().getName()); //$NON-NLS-1$
}
- private FakeRelationalNode createFakeNode(List[] data) throws
MetaMatrixComponentException {
+ private FakeRelationalNode createFakeNode(List[] data) {
// setup
ElementSymbol element = new ElementSymbol("a"); //$NON-NLS-1$
element.setType(DataTypeManager.DefaultDataClasses.INTEGER);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/NoOpInstruction.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/NoOpInstruction.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/NoOpInstruction.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -22,8 +22,7 @@
package com.metamatrix.query.processor.xml;
-import java.util.HashMap;
-import java.util.Map;
+import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.buffer.BlockedException;
@@ -53,11 +52,8 @@
return "NOOP"; //$NON-NLS-1$
}
- public Map getDescriptionProperties() {
- Map props = new HashMap();
- props.put(PROP_TYPE, "NO OP"); //$NON-NLS-1$
-
- return props;
+ public PlanNode getDescriptionProperties() {
+ return new PlanNode("NO OP"); //$NON-NLS-1$
}
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestOption.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestOption.java 2010-04-06
21:51:32 UTC (rev 2030)
+++ trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestOption.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -42,14 +42,7 @@
public void testOptionEquals1() {
Option opt1 = new Option();
- opt1.setDebug(true);
- opt1.setShowPlan(true);
- opt1.setPlanOnly(true);
-
Option opt2 = new Option();
- opt2.setDebug(true);
- opt2.setShowPlan(true);
- opt2.setPlanOnly(true);
assertTrue("Options should be equal", opt1.equals(opt2));
//$NON-NLS-1$
assertTrue("Options should be equal", opt2.equals(opt1));
//$NON-NLS-1$
@@ -89,19 +82,6 @@
assertTrue("Options should be equal", opt2.equals(opt1));
//$NON-NLS-1$
}
- public void testOptionEqualsFail1() {
- Option opt1 = new Option();
- opt1.setDebug(true);
- opt1.setShowPlan(true);
-
- Option opt2 = new Option();
- opt2.setDebug(true);
- opt2.setShowPlan(false);
-
- assertTrue("Options should not be equal", ! opt1.equals(opt2));
//$NON-NLS-1$
- assertTrue("Options should not be equal", ! opt2.equals(opt1));
//$NON-NLS-1$
- }
-
public void testOptionEqualsFail2() {
Option opt1 = new Option();
opt1.addDependentGroup("abc"); //$NON-NLS-1$
@@ -112,19 +92,6 @@
assertTrue("Options should not be equal", ! opt2.equals(opt1));
//$NON-NLS-1$
}
- public void testOptionEqualsFail3() {
- Option opt1 = new Option();
- opt1.setDebug(true);
- opt1.setPlanOnly(true);
-
- Option opt2 = new Option();
- opt2.setDebug(true);
- opt2.setPlanOnly(false);
-
- assertTrue("Options should not be equal", ! opt1.equals(opt2));
//$NON-NLS-1$
- assertTrue("Options should not be equal", ! opt2.equals(opt1));
//$NON-NLS-1$
- }
-
public void testObjectEquivalence1() {
Option opt1 = new Option();
opt1.addDependentGroup("abc"); //$NON-NLS-1$
@@ -198,8 +165,6 @@
public void testClone() {
Option opt1 = new Option();
- opt1.setDebug(true);
- opt1.setShowPlan(true);
opt1.addDependentGroup("abc"); //$NON-NLS-1$
opt1.addNotDependentGroup("xyz"); //$NON-NLS-1$
opt1.addNoCacheGroup("abc"); //$NON-NLS-1$
Modified:
trunk/engine/src/test/java/com/metamatrix/query/sql/visitor/TestSQLStringVisitor.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/sql/visitor/TestSQLStringVisitor.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/com/metamatrix/query/sql/visitor/TestSQLStringVisitor.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -516,71 +516,35 @@
helpTest(option, "OPTION"); //$NON-NLS-1$
}
- public void testOption2() {
- Option option = new Option();
- option.setDebug(true);
- helpTest(option, "OPTION DEBUG"); //$NON-NLS-1$
- }
-
- public void testOption3() {
- Option option = new Option();
- option.setShowPlan(true);
- helpTest(option, "OPTION SHOWPLAN"); //$NON-NLS-1$
- }
-
- public void testOption4() {
- Option option = new Option();
- option.setDebug(true);
- option.setShowPlan(true);
- helpTest(option, "OPTION SHOWPLAN DEBUG"); //$NON-NLS-1$
- }
-
public void testOption5() {
Option option = new Option();
- option.setDebug(true);
- option.setShowPlan(true);
option.addDependentGroup("abc"); //$NON-NLS-1$
option.addDependentGroup("def"); //$NON-NLS-1$
option.addDependentGroup("xyz"); //$NON-NLS-1$
- helpTest(option, "OPTION SHOWPLAN DEBUG MAKEDEP abc, def, xyz");
//$NON-NLS-1$
+ helpTest(option, "OPTION MAKEDEP abc, def, xyz"); //$NON-NLS-1$
}
public void testOption6() {
Option option = new Option();
- option.setDebug(true);
- option.setShowPlan(true);
- option.setPlanOnly(true);
option.addDependentGroup("abc"); //$NON-NLS-1$
option.addDependentGroup("def"); //$NON-NLS-1$
option.addDependentGroup("xyz"); //$NON-NLS-1$
- helpTest(option, "OPTION SHOWPLAN PLANONLY DEBUG MAKEDEP abc, def,
xyz"); //$NON-NLS-1$
+ helpTest(option, "OPTION MAKEDEP abc, def, xyz"); //$NON-NLS-1$
}
- public void testOption7() {
- Option option = new Option();
- option.setPlanOnly(true);
- helpTest(option, "OPTION PLANONLY"); //$NON-NLS-1$
- }
-
public void testOption8() {
Option option = new Option();
- option.setDebug(true);
- option.setShowPlan(true);
- option.setPlanOnly(true);
option.addNoCacheGroup("abc"); //$NON-NLS-1$
option.addNoCacheGroup("def"); //$NON-NLS-1$
option.addNoCacheGroup("xyz"); //$NON-NLS-1$
- helpTest(option, "OPTION SHOWPLAN PLANONLY DEBUG NOCACHE abc, def,
xyz"); //$NON-NLS-1$
+ helpTest(option, "OPTION NOCACHE abc, def, xyz"); //$NON-NLS-1$
}
// related to defect 14423
public void testOption9() {
Option option = new Option();
- option.setDebug(true);
- option.setShowPlan(true);
- option.setPlanOnly(true);
option.setNoCache(true);
- helpTest(option, "OPTION SHOWPLAN PLANONLY DEBUG NOCACHE");
//$NON-NLS-1$
+ helpTest(option, "OPTION NOCACHE"); //$NON-NLS-1$
}
public void testOrderBy1() {
@@ -629,8 +593,6 @@
CompareCriteria having = new CompareCriteria(new ElementSymbol("e1"),
CompareCriteria.GT, new Constant(new Integer(0))); //$NON-NLS-1$
OrderBy orderBy = new OrderBy();
orderBy.addVariable(new ElementSymbol("e1")); //$NON-NLS-1$
- Option option = new Option();
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
@@ -639,9 +601,8 @@
query.setGroupBy(groupBy);
query.setHaving(having);
query.setOrderBy(orderBy);
- query.setOption(option);
- helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 GROUP BY e1 HAVING e1 > 0 ORDER
BY e1 OPTION SHOWPLAN"); //$NON-NLS-1$
+ helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 GROUP BY e1 HAVING e1 > 0 ORDER
BY e1"); //$NON-NLS-1$
}
public void testQuery3() {
@@ -654,8 +615,6 @@
CompareCriteria having = new CompareCriteria(new ElementSymbol("e1"),
CompareCriteria.GT, new Constant(new Integer(0))); //$NON-NLS-1$
OrderBy orderBy = new OrderBy();
orderBy.addVariable(new ElementSymbol("e1")); //$NON-NLS-1$
- Option option = new Option();
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
@@ -663,9 +622,8 @@
query.setGroupBy(groupBy);
query.setHaving(having);
query.setOrderBy(orderBy);
- query.setOption(option);
- helpTest(query, "SELECT * FROM m.g GROUP BY e1 HAVING e1 > 0 ORDER BY e1 OPTION
SHOWPLAN"); //$NON-NLS-1$
+ helpTest(query, "SELECT * FROM m.g GROUP BY e1 HAVING e1 > 0 ORDER BY
e1"); //$NON-NLS-1$
}
public void testQuery4() {
@@ -677,8 +635,6 @@
CompareCriteria having = new CompareCriteria(new ElementSymbol("e1"),
CompareCriteria.GT, new Constant(new Integer(0))); //$NON-NLS-1$
OrderBy orderBy = new OrderBy();
orderBy.addVariable(new ElementSymbol("e1")); //$NON-NLS-1$
- Option option = new Option();
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
@@ -686,9 +642,8 @@
query.setCriteria(cc);
query.setHaving(having);
query.setOrderBy(orderBy);
- query.setOption(option);
- helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 HAVING e1 > 0 ORDER BY e1
OPTION SHOWPLAN"); //$NON-NLS-1$
+ helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 HAVING e1 > 0 ORDER BY
e1"); //$NON-NLS-1$
}
public void testQuery5() {
@@ -701,8 +656,6 @@
groupBy.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
OrderBy orderBy = new OrderBy();
orderBy.addVariable(new ElementSymbol("e1")); //$NON-NLS-1$
- Option option = new Option();
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
@@ -710,9 +663,8 @@
query.setCriteria(cc);
query.setGroupBy(groupBy);
query.setOrderBy(orderBy);
- query.setOption(option);
- helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 GROUP BY e1 ORDER BY e1 OPTION
SHOWPLAN"); //$NON-NLS-1$
+ helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 GROUP BY e1 ORDER BY e1");
//$NON-NLS-1$
}
public void testQuery6() {
@@ -724,8 +676,6 @@
GroupBy groupBy = new GroupBy();
groupBy.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
CompareCriteria having = new CompareCriteria(new ElementSymbol("e1"),
CompareCriteria.GT, new Constant(new Integer(0))); //$NON-NLS-1$
- Option option = new Option();
- option.setShowPlan(true);
Query query = new Query();
query.setSelect(select);
@@ -733,9 +683,8 @@
query.setCriteria(cc);
query.setGroupBy(groupBy);
query.setHaving(having);
- query.setOption(option);
- helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 GROUP BY e1 HAVING e1 > 0
OPTION SHOWPLAN"); //$NON-NLS-1$
+ helpTest(query, "SELECT * FROM m.g WHERE e1 = 5 GROUP BY e1 HAVING e1 >
0"); //$NON-NLS-1$
}
public void testQuery7() {
@@ -912,13 +861,9 @@
q2.setSelect(s2);
q2.setFrom(f2);
- Option option = new Option();
- option.setDebug(true);
-
SetQuery sq = new SetQuery(Operation.UNION, false, q1, q2);
- sq.setOption(option);
- helpTest(sq, "SELECT e1 FROM m.g1 UNION SELECT e1 FROM m.g2 OPTION DEBUG");
//$NON-NLS-1$
+ helpTest(sq, "SELECT e1 FROM m.g1 UNION SELECT e1 FROM m.g2"); //$NON-NLS-1$
}
public void testSetQuery5() {
@@ -1905,12 +1850,11 @@
"for $x in doc(\"xmltest.doc9893\")//ItemName\r\n" +
//$NON-NLS-1$
"return <Item>{$x/text()}</Item>\r\n" +
//$NON-NLS-1$
"}\r\n" + //$NON-NLS-1$
- "</Items> OPTION SHOWPLAN DEBUG"; //$NON-NLS-1$
+ "</Items> OPTION NOCACHE"; //$NON-NLS-1$
XQuery xquery = new XQuery(xquerystring, null);
Option option = new Option();
- option.setDebug(true);
- option.setShowPlan(true);
+ option.setNoCache(true);
xquery.setOption(option);
helpTest(xquery, expectedString);
}
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-04-06
21:51:32 UTC (rev 2030)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-04-07
03:29:59 UTC (rev 2031)
@@ -25,8 +25,6 @@
import static org.junit.Assert.*;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -78,7 +76,7 @@
assertNotNull("Unable to get prepared plan from cache", pPlan);
//$NON-NLS-1$
assertEquals("Error getting plan from cache", new RelationalPlan(new
ProjectNode(12)).toString(), pPlan.getPlan().toString()); //$NON-NLS-1$
assertEquals("Error getting command from cache", EXAMPLE_QUERY + 12,
pPlan.getCommand().toString()); //$NON-NLS-1$
- assertNotNull("Error getting plan description from cache",
pPlan.getAnalysisRecord().getQueryPlan()); //$NON-NLS-1$
+ assertNotNull("Error getting plan description from cache",
pPlan.getAnalysisRecord()); //$NON-NLS-1$
assertEquals("Error gettting reference from cache", "ref12",
pPlan.getReferences().get(0)); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -153,10 +151,7 @@
cache.put(id, true, pPlan);
pPlan.setCommand(dummy);
pPlan.setPlan(new RelationalPlan(new ProjectNode(i)));
- Map props = new HashMap();
- props.put("desc", "desc"+i); //$NON-NLS-1$ //$NON-NLS-2$
AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
- analysisRecord.setQueryPlan(props);
pPlan.setAnalysisRecord(analysisRecord);
ArrayList refs = new ArrayList();
refs.add("ref"+i); //$NON-NLS-1$