teiid SVN: r2688 - branches/7.1.x/runtime/src/main/java/org/teiid/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-28 17:21:51 -0400 (Thu, 28 Oct 2010)
New Revision: 2688
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
Log:
TEIID-1334: URL class does not care about the spaces in its URL. It does not automatically encode them, However URI class does. Doing URL->URI->URL code to remove the spaces in the URL.
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java 2010-10-28 18:02:05 UTC (rev 2687)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java 2010-10-28 21:21:51 UTC (rev 2688)
@@ -22,6 +22,7 @@
package org.teiid.deployers;
import java.io.IOException;
+import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -42,7 +43,9 @@
if (url == null) {
throw new TeiidRuntimeException(RuntimeMetadataPlugin.Util.getString("system_vdb_not_found")); //$NON-NLS-1$
}
- this.vdbRepository.setSystemStore(new IndexMetadataFactory(url).getMetadataStore(null));
+ // uri conversion is only to remove the spaces in URL, note this only with above kind situation
+ URI uri = new URI(url.getProtocol(), url.getPath(), null);
+ this.vdbRepository.setSystemStore(new IndexMetadataFactory(uri.toURL()).getMetadataStore(null));
} catch (URISyntaxException e) {
throw new TeiidRuntimeException(e, RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
} catch (IOException e) {
14 years, 4 months
teiid SVN: r2687 - in branches/7.1.x: runtime/src/main/java/org/teiid/deployers and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-28 14:02:05 -0400 (Thu, 28 Oct 2010)
New Revision: 2687
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
Log:
TEIID-1333: Remove the only error the has been added as result of metadata load from vdb validation errors, removing all the errors will cause to make a VDB active which should not be.
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-10-28 14:46:37 UTC (rev 2686)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-10-28 18:02:05 UTC (rev 2687)
@@ -227,13 +227,22 @@
return list;
}
- public void addError(String severity, String message) {
+ public ValidationError addError(String severity, String message) {
if (this.errors == null) {
this.errors = new ArrayList<ValidationError>();
}
- this.errors.add(new ValidationError(severity, message));
+ ValidationError ve = new ValidationError(severity, message);
+ this.errors.add(ve);
+ return ve;
}
+ public boolean removeError(ValidationError remove) {
+ if (this.errors == null) {
+ return false;
+ }
+ return this.errors.remove(remove);
+ }
+
public void clearErrors() {
this.errors.clear();
}
@@ -290,5 +299,27 @@
public void setPath(String path) {
this.path = path;
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ValidationError other = (ValidationError) obj;
+ if (severity == null) {
+ if (other.severity != null)
+ return false;
+ } else if (!severity.equals(other.severity))
+ return false;
+ if (value == null) {
+ if (other.value != null)
+ return false;
+ } else if (!value.equals(other.value))
+ return false;
+ return true;
+ }
}
}
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-10-28 14:46:37 UTC (rev 2686)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-10-28 18:02:05 UTC (rev 2687)
@@ -42,7 +42,7 @@
import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.core.CoreConstants;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
import org.teiid.core.util.FileUtils;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
@@ -285,19 +285,19 @@
if (!loaded) {
String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName()+"-"+vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ final ValidationError addedError = model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
threadPool.run(new Runnable() {
@Override
public void run() {
- loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
+ loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr, addedError);
}
});
}
}
}
- private void loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
+ private void loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr, ValidationError addedError) {
Exception exception = null;
boolean loaded = false;
@@ -312,7 +312,7 @@
this.serializer.saveAttachment(cacheFile, store);
}
vdbStore.addStore(store);
- model.clearErrors();
+ model.removeError(addedError);
loaded = true;
break;
} catch (TranslatorException e) {
14 years, 4 months
teiid SVN: r2686 - branches/7.1.x/client/src/main/java/org/teiid/adminapi.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-28 10:46:37 -0400 (Thu, 28 Oct 2010)
New Revision: 2686
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
Log:
TEIID-1325: Avoiding the NPE, instead when the connection is lost it will throw an exception
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-10-28 14:46:07 UTC (rev 2685)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-10-28 14:46:37 UTC (rev 2686)
@@ -28,7 +28,6 @@
import java.lang.reflect.Proxy;
import java.util.Properties;
-import org.teiid.client.util.ExceptionUtil;
import org.teiid.core.util.PropertiesUtils;
import org.teiid.jdbc.JDBCPlugin;
import org.teiid.net.CommunicationException;
14 years, 4 months
teiid SVN: r2685 - branches/7.1.x/client/src/main/java/org/teiid/adminapi.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-28 10:46:07 -0400 (Thu, 28 Oct 2010)
New Revision: 2685
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
Log:
TEIID-1325: Avoiding the NPE, instead when the connection is lost it will throw an exception
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-10-27 02:16:50 UTC (rev 2684)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-10-28 14:46:07 UTC (rev 2685)
@@ -75,9 +75,6 @@
try {
return method.invoke(getTarget(), args);
} catch (InvocationTargetException e) {
- if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
- this.admin = null;
- }
throw e.getTargetException();
}
}
14 years, 4 months
teiid SVN: r2684 - in trunk: build/kits/jboss-container and 14 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-26 22:16:50 -0400 (Tue, 26 Oct 2010)
New Revision: 2684
Added:
trunk/engine/src/main/java/org/teiid/query/function/aggregate/TextAgg.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java
Modified:
trunk/api/src/main/java/org/teiid/language/SQLConstants.java
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java
trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
Log:
TEIID-962: Adding TextAgg function that aggregates expression values into textline using delimiter and header.
Modified: trunk/api/src/main/java/org/teiid/language/SQLConstants.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/SQLConstants.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/api/src/main/java/org/teiid/language/SQLConstants.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -319,6 +319,7 @@
public static final String SYSTEM_USER = "SYSTEM_USER"; //$NON-NLS-1$
public static final String TABLE = "TABLE"; //$NON-NLS-1$
public static final String TEMPORARY = "TEMPORARY"; //$NON-NLS-1$
+ public static final String TEXTAGG = "TEXTAGG"; //$NON-NLS-1$
public static final String THEN = "THEN"; //$NON-NLS-1$
public static final String TIME = "TIME"; //$NON-NLS-1$
public static final String TIMESTAMP = "TIMESTAMP"; //$NON-NLS-1$
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-10-27 02:16:50 UTC (rev 2684)
@@ -42,7 +42,8 @@
<LI><B>Improved clustering support</B> - see the Admin Guide chapter on clustering.
<LI><B>IPv6 support</B> - Teiid can started using IPv6 bind address and can be used with JDBC connection.
<LI><B>SESSION_ID</B> - A new system function "SESSION_ID" is added to the system function library.
- <LI><B>Assignment Syntax Improvements<B> - Teiid's procedure syntax for assignments was clarified so that the assignment value must be a proper expression. INSERT/UPDATE/DELETE update counts must be obtained from VARIABLES.ROWCOUNT, scalar values must be obtained via a scalar subquery.
+ <LI><B>Assignment Syntax Improvements<B> - Teiid's procedure syntax for assignments was clarified so that the assignment value must be a proper expression. INSERT/UPDATE/DELETE update counts must be obtained from VARIABLES.ROWCOUNT, scalar values must be obtained via a scalar subquery.
+ <LI><B>TEXTAGG</B> - SQL support for Text aggregation. Using this function expression values can be aggregated into a single line of text with delimiter and header, that can be optionally saved to a text file.
The parser will continue to accept the old syntax and convert the query into the proper form.
</UL>
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-10-26 20:44:55 UTC (rev 2683)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml 2010-10-27 02:16:50 UTC (rev 2684)
@@ -238,8 +238,15 @@
<para>STDDEV_SAMP(x) – sample standar deviation (excluding null) logically equals SQRT(VAR_SAMP(x))</para>
</listitem>
<listitem>
+ <para>TEXTAGG((expression [as name], ... [DELIMITER char] [QUOTE char] [HEADER]
+ <link linkend="orderby_clause">[ORDER BY ...]</link>) – Text concatination of all expressions in a group (excluding null).
+ When DELIMITER is not specified, by default comma(,) is used as delimiter. Use QUOTE, to quote the each expression value with
+ provided character. If HEADER is specified, the result contains the header row as first line. This aggregation returns a Clob.
+ </para>
+ </listitem>
+ <listitem>
<para>XMLAGG(xml_expr <link linkend="orderby_clause">[ORDER BY ...]</link>) – xml concatination of all xml expressions in a group (excluding null)</para>
- </listitem>
+ </listitem>
</itemizedlist>
<itemizedlist>
<para>Syntax Rules:
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -98,6 +98,7 @@
import org.teiid.query.sql.symbol.ScalarSubquery;
import org.teiid.query.sql.symbol.SearchedCaseExpression;
import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.XMLElement;
import org.teiid.query.sql.symbol.XMLForest;
import org.teiid.query.sql.symbol.XMLNamespaces;
@@ -647,6 +648,8 @@
return evaluate((ScalarSubquery) expression, tuple);
} else if (expression instanceof Criteria) {
return evaluate((Criteria)expression, tuple);
+ } else if (expression instanceof TextLine){
+ return evaluateTextForest(tuple, (TextLine)expression);
} else if (expression instanceof XMLElement){
return evaluateXMLElement(tuple, (XMLElement)expression);
} else if (expression instanceof XMLForest){
@@ -809,7 +812,14 @@
InputStreamFactory isf = getInputStreamFactory(value);
return new ClobType(new ClobImpl(isf, -1));
}
+
+ private Object evaluateTextForest(List<?> tuple, TextLine function) throws ExpressionEvaluationException, BlockedException, TeiidComponentException, FunctionExecutionException {
+ List<DerivedColumn> args = function.getExpressions();
+ Evaluator.NameValuePair<Object>[] nameValuePairs = getNameValuePairs(tuple, args, true);
+ return TextLine.evaluate(nameValuePairs, function.getDelimiter(), function.getQuote());
+ }
+
private Object evaluateXMLForest(List<?> tuple, XMLForest function)
throws ExpressionEvaluationException, BlockedException,
TeiidComponentException, FunctionExecutionException {
Added: trunk/engine/src/main/java/org/teiid/query/function/aggregate/TextAgg.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/aggregate/TextAgg.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/function/aggregate/TextAgg.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -0,0 +1,119 @@
+/*
+ * 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.query.function.aggregate;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.sql.SQLException;
+import java.util.List;
+
+import javax.sql.rowset.serial.SerialClob;
+
+import org.teiid.common.buffer.FileStore;
+import org.teiid.common.buffer.FileStore.FileStoreOutputStream;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ClobImpl;
+import org.teiid.core.types.ClobType;
+import org.teiid.core.types.Streamable;
+import org.teiid.query.processor.xml.XMLUtil.FileStoreInputStreamFactory;
+import org.teiid.query.sql.symbol.TextLine;
+import org.teiid.query.util.CommandContext;
+
+/**
+ * Aggregates Text entries
+ */
+public class TextAgg extends AggregateFunction {
+
+ private FileStoreInputStreamFactory result;
+ private CommandContext context;
+ private TextLine textLine;
+
+ public TextAgg(CommandContext context, TextLine textLine) {
+ this.context = context;
+ this.textLine = textLine;
+ }
+
+ private FileStoreInputStreamFactory buildResult(CommandContext context, TextLine textLine) throws TeiidProcessingException {
+ try {
+ FileStore fs = context.getBufferManager().createFileStore("textagg"); //$NON-NLS-1$
+ FileStoreInputStreamFactory fisf = new FileStoreInputStreamFactory(fs, Streamable.ENCODING);
+ Writer w = fisf.getWriter();
+ if (textLine.isIncludeHeader()) {
+ w.write(TextLine.getHeader(textLine.getExpressions(), textLine.getDelimiter(), textLine.getQuote()));
+ }
+ w.close();
+ return fisf;
+ } catch (IOException e) {
+ throw new TeiidProcessingException(e);
+ }
+ }
+
+ public void reset() {
+ this.result = null;
+ }
+
+ /**
+ * @throws TeiidProcessingException
+ * @throws TeiidComponentException
+ * @see org.teiid.query.function.aggregate.AggregateFunction#addInputDirect(Object, List)
+ */
+ public void addInputDirect(Object input, List<?> tuple) throws TeiidComponentException, TeiidProcessingException {
+ try {
+ if (this.result == null) {
+ this.result = buildResult(this.context, this.textLine);
+ }
+ String in = (String)input;
+ Writer w = result.getWriter();
+ w.write(in);
+ w.close();
+ } catch (IOException e) {
+ throw new TeiidProcessingException(e);
+ }
+ }
+
+ /**
+ * @see org.teiid.query.function.aggregate.AggregateFunction#getResult()
+ */
+ public Object getResult() throws TeiidProcessingException{
+ if (this.result == null) {
+ this.result = buildResult(this.context, this.textLine);
+ }
+
+ try {
+ FileStoreOutputStream fs = this.result.getOuputStream();
+ fs.close();
+
+ if (fs.bytesWritten()) {
+ return new ClobType(new ClobImpl(result, -1));
+ }
+ // fun convert bytes to string to char array!!
+ String msg = new String(fs.getBuffer(),0, fs.getCount(), Streamable.ENCODING);
+ return new ClobType(new SerialClob(msg.toCharArray()));
+ } catch (IOException e) {
+ throw new TeiidProcessingException(e);
+ } catch (SQLException e) {
+ throw new TeiidProcessingException(e);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/engine/src/main/java/org/teiid/query/function/aggregate/TextAgg.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -65,6 +65,7 @@
import org.teiid.query.sql.symbol.QueryString;
import org.teiid.query.sql.symbol.ScalarSubquery;
import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.XMLAttributes;
import org.teiid.query.sql.symbol.XMLElement;
import org.teiid.query.sql.symbol.XMLForest;
@@ -117,6 +118,11 @@
}
@Override
+ public void visit(TextLine obj) {
+ markInvalid(obj, "Pushdown of TextForest not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
public void visit(XMLForest obj) {
markInvalid(obj, "Pushdown of XMLForest not allowed"); //$NON-NLS-1$
}
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -741,7 +741,10 @@
nestedAggregates.add(countAgg);
nestedAggregates.add(sumAgg);
nestedAggregates.add(sumSqAgg);
- } else {
+ } else if (aggFunction == Type.TEXTAGG) {
+ continue;
+ }
+ else {
//AGG(X) -> AGG(AGG(X))
newExpression = new AggregateSymbol("stagedAgg", aggFunction.name(), false, partitionAgg); //$NON-NLS-1$
nestedAggregates.add(partitionAgg);
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -22,7 +22,8 @@
package org.teiid.query.processor.relational;
-import static org.teiid.query.analysis.AnalysisRecord.*;
+import static org.teiid.query.analysis.AnalysisRecord.PROP_GROUP_COLS;
+import static org.teiid.query.analysis.AnalysisRecord.PROP_SORT_MODE;
import java.util.ArrayList;
import java.util.Arrays;
@@ -50,6 +51,7 @@
import org.teiid.query.function.aggregate.Min;
import org.teiid.query.function.aggregate.StatsFunction;
import org.teiid.query.function.aggregate.Sum;
+import org.teiid.query.function.aggregate.TextAgg;
import org.teiid.query.function.aggregate.XMLAgg;
import org.teiid.query.processor.BatchCollector;
import org.teiid.query.processor.ProcessorDataManager;
@@ -60,6 +62,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.AggregateSymbol.Type;
import org.teiid.query.util.CommandContext;
@@ -186,6 +189,9 @@
case XMLAGG:
functions[i] = new XMLAgg(context);
break;
+ case TEXTAGG:
+ functions[i] = new TextAgg(context, (TextLine)ex);
+ break;
default:
functions[i] = new StatsFunction(function);
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -26,7 +26,6 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
@@ -79,7 +78,7 @@
return new OutputStreamWriter(fsos, Charset.forName(encoding));
}
- public OutputStream getOuputStream() {
+ public FileStoreOutputStream getOuputStream() {
return fsos;
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -129,6 +129,7 @@
public void visit(XMLForest obj) {}
public void visit(XMLNamespaces obj) {}
public void visit(TextTable obj) {}
+ public void visit(TextLine obj) {}
public void visit(XMLTable obj) {}
public void visit(DerivedColumn obj) {}
public void visit(XMLSerialize obj) {}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -97,6 +97,7 @@
import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.symbol.ScalarSubquery;
import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.XMLAttributes;
import org.teiid.query.sql.symbol.XMLElement;
import org.teiid.query.sql.symbol.XMLForest;
@@ -541,6 +542,13 @@
}
@Override
+ public void visit(TextLine obj) {
+ preVisitVisitor(obj);
+ visitNodes(obj.getExpressions());
+ postVisitVisitor(obj);
+ }
+
+ @Override
public void visit(XMLForest obj) {
preVisitVisitor(obj);
visitNode(obj.getNamespaces());
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -60,6 +60,7 @@
MIN,
MAX,
XMLAGG,
+ TEXTAGG,
ANY,
SOME,
EVERY,
Added: trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -0,0 +1,196 @@
+/*
+ * 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.query.sql.symbol;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.EquivalenceUtil;
+import org.teiid.core.util.HashCodeUtil;
+import org.teiid.query.eval.Evaluator;
+import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.visitor.SQLStringVisitor;
+
+public class TextLine implements Expression {
+ public static String nl = System.getProperty("line.separator"); //$NON-NLS-1$
+
+ private Character delimiter = null;
+ private Character quote = null;
+ private boolean includeHeader;
+ private List<DerivedColumn> expressions;
+
+ public Character getDelimiter() {
+ return delimiter;
+ }
+
+ public void setDelimiter(Character delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ public Character getQuote() {
+ return quote;
+ }
+
+ public void setQuote(Character quote) {
+ this.quote = quote;
+ }
+
+ public boolean isIncludeHeader() {
+ return includeHeader;
+ }
+
+ public void setIncludeHeader(boolean includeHeader) {
+ this.includeHeader = includeHeader;
+ }
+
+ public List<DerivedColumn> getExpressions() {
+ return expressions;
+ }
+
+ public void setExpressions(List<DerivedColumn> expressions) {
+ this.expressions = expressions;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return DataTypeManager.DefaultDataClasses.CLOB;
+ }
+
+ @Override
+ public boolean isResolved() {
+ for (DerivedColumn arg : this.expressions) {
+ if (!arg.getExpression().isResolved()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void acceptVisitor(LanguageVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public TextLine clone() {
+ TextLine clone = new TextLine();
+
+ if (this.expressions != null && !this.expressions.isEmpty()) {
+ List<DerivedColumn> list = new ArrayList<DerivedColumn>();
+ for (DerivedColumn expr:this.expressions) {
+ list.add(expr.clone());
+ }
+ clone.expressions = list;
+ }
+
+ if (this.delimiter != null) {
+ clone.delimiter = new Character(this.delimiter);
+ }
+
+ if (this.quote != null) {
+ clone.quote = new Character(this.quote);
+ }
+
+ clone.includeHeader = this.includeHeader;
+ return clone;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof TextLine)) {
+ return false;
+ }
+ TextLine other = (TextLine)obj;
+ return EquivalenceUtil.areEqual(this.expressions, other.expressions)
+ && EquivalenceUtil.areEqual(this.delimiter, other.delimiter)
+ && EquivalenceUtil.areEqual(this.quote, other.quote)
+ && this.includeHeader == other.includeHeader;
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeUtil.expHashCode(0, this.expressions);
+ }
+
+ @Override
+ public String toString() {
+ return SQLStringVisitor.getSQLString(this);
+ }
+
+ public static String evaluate(final Evaluator.NameValuePair[] values, Character delimeter, Character quote) {
+
+ if (delimeter == null) {
+ delimeter = new Character(',');
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i].value != null) {
+ addQuote(quote, sb);
+ sb.append(values[i].value);
+ addQuote(quote, sb);
+ }
+ if (i < values.length-1) {
+ sb.append(delimeter);
+ }
+ }
+ sb.append(nl);
+
+ return sb.toString();
+ }
+
+ public static String getHeader(List<DerivedColumn> args, Character delimeter, Character quote) {
+
+ if (delimeter == null) {
+ delimeter = new Character(',');
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < args.size(); i++) {
+ DerivedColumn symbol = args.get(i);
+ String name = symbol.getAlias();
+ Expression ex = symbol.getExpression();
+ if (name == null && ex instanceof ElementSymbol) {
+ name = ((ElementSymbol)ex).getShortName();
+ }
+ addQuote(quote, sb);
+ sb.append(name);
+ addQuote(quote, sb);
+
+ if (i < args.size()-1) {
+ sb.append(delimeter);
+ }
+ }
+ sb.append(nl);
+ return sb.toString();
+ }
+
+ private static void addQuote(Character quote, StringBuilder sb) {
+ if (quote != null) {
+ sb.append(quote);
+ }
+ }
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/sql/symbol/TextLine.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -116,6 +116,7 @@
import org.teiid.query.sql.symbol.SearchedCaseExpression;
import org.teiid.query.sql.symbol.SelectSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.XMLAttributes;
import org.teiid.query.sql.symbol.XMLElement;
import org.teiid.query.sql.symbol.XMLForest;
@@ -1591,6 +1592,32 @@
registerNodes(obj.getArgs(), 0);
append(")"); //$NON-NLS-1$
}
+
+ @Override
+ public void visit( TextLine obj ) {
+ append("TEXTLINE"); //$NON-NLS-1$
+ append("("); //$NON-NLS-1$
+ registerNodes(obj.getExpressions(), 0);
+
+ if (obj.getDelimiter() != null) {
+ append(SPACE);
+ append(NonReserved.DELIMITER);
+ append(SPACE);
+ visitNode(new Constant(obj.getDelimiter()));
+ }
+ if (obj.getQuote() != null) {
+ append(SPACE);
+ append(NonReserved.QUOTE);
+ append(SPACE);
+ visitNode(new Constant(obj.getQuote()));
+ }
+ if (obj.isIncludeHeader()) {
+ append(SPACE);
+ append(NonReserved.HEADER);
+ }
+
+ append(")"); //$NON-NLS-1$
+ }
@Override
public void visit( XMLNamespaces obj ) {
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -117,6 +117,7 @@
import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.symbol.ScalarSubquery;
import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.XMLAttributes;
import org.teiid.query.sql.symbol.XMLElement;
import org.teiid.query.sql.symbol.XMLForest;
@@ -1238,6 +1239,18 @@
validateXMLContentTypes(dc.getExpression(), obj);
}
}
+
+ @Override
+ public void visit(TextLine obj) {
+ validateDerivedColumnNames(obj, obj.getExpressions());
+ for (DerivedColumn dc : obj.getExpressions()) {
+ if (dc.getAlias() == null) {
+ continue;
+ }
+ validateQName(obj, dc.getAlias());
+ validateXMLContentTypes(dc.getExpression(), obj);
+ }
+ }
private String[] validateQName(LanguageObject obj, String name) {
try {
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2010-10-27 02:16:50 UTC (rev 2684)
@@ -260,6 +260,7 @@
| <SYSTEM_USER: "system_user">
| <TABLE: "table">
| <TEMPORARY: "temporary">
+| <TEXTAGG: "textagg">
| <THEN: "then">
| <TIMEZONE_HOUR: "timezone_hour">
| <TIMEZONE_MINUTE: "timezone_minute">
@@ -1788,6 +1789,69 @@
}
}
+
+AggregateSymbol textAgg(ParseInfo info) :
+{
+ DerivedColumn expression = null;
+ Character delimiter = null;
+ Character quote = null;
+ Integer header = null;
+ List<DerivedColumn> expressions = new ArrayList<DerivedColumn>();
+ OrderBy orderBy = null;
+}
+{
+ <TEXTAGG> <LPAREN>
+ expression = derivedColumn(info)
+ {
+ expressions.add(expression);
+ }
+ (<COMMA>
+ expression = derivedColumn(info)
+ {
+ expressions.add(expression);
+ }
+ )*
+ [
+ LOOKAHEAD(<ID>, { "delimiter".equalsIgnoreCase(getToken(1).image) }) <ID>
+ delimiter = charVal(info, "DELMITER")
+ ]
+ [
+ LOOKAHEAD(<ID>, { "quote".equalsIgnoreCase(getToken(1).image) })
+ ( <ID> quote = charVal(info, "QUOTE") )
+ ]
+ [
+ LOOKAHEAD(<ID>, { "header".equalsIgnoreCase(getToken(1).image) }) <ID>
+ [
+ header = intVal()
+ ]
+ {
+ if (header == null) {
+ header = 1;
+ }
+ }
+ ]
+ [
+ orderBy = orderby(info)
+ ]
+ <RPAREN>
+ {
+ if(! info.aggregatesAllowed) {
+ throw new ParseException(QueryPlugin.Util.getString("SQLParser.Aggregate_only_top_level")); //$NON-NLS-1$
+ }
+
+ TextLine tf = new TextLine();
+ tf.setDelimiter(delimiter);
+ tf.setQuote(quote);
+ tf.setIncludeHeader(header!=null);
+ tf.setExpressions(expressions);
+
+ String name = generateFunctionName(info, "TEXTAGG");
+ AggregateSymbol agg = new AggregateSymbol(name, "TEXTAGG", false, tf);
+ agg.setOrderBy(orderBy);
+ return agg;
+ }
+}
+
AggregateSymbol aggregateSymbol(ParseInfo info) :
{
String func = null;
@@ -3144,6 +3208,8 @@
|
(expression=xmlAgg(info))
|
+ (expression=textAgg(info))
+ |
// Function
LOOKAHEAD(2) (expression=function(info))
|
Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -22,7 +22,9 @@
package org.teiid.query.parser;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
@@ -114,6 +116,7 @@
import org.teiid.query.sql.symbol.SearchedCaseExpression;
import org.teiid.query.sql.symbol.TestCaseExpression;
import org.teiid.query.sql.symbol.TestSearchedCaseExpression;
+import org.teiid.query.sql.symbol.TextLine;
import org.teiid.query.sql.symbol.XMLAttributes;
import org.teiid.query.sql.symbol.XMLElement;
import org.teiid.query.sql.symbol.XMLForest;
@@ -6712,6 +6715,39 @@
helpTest(sql, "SELECT XMLAGG(1 ORDER BY e2)", query);
}
+ @Test public void testTextAggWithOrderBy() throws Exception {
+ List<DerivedColumn> expressions = new ArrayList<DerivedColumn>();
+ expressions.add(new DerivedColumn("col1", new ElementSymbol("e1")));
+ expressions.add(new DerivedColumn("col2", new ElementSymbol("e2")));
+
+ TextLine tf = new TextLine();
+ tf.setExpressions(expressions);
+ tf.setDelimiter(new Character(','));
+ tf.setIncludeHeader(true);
+
+ AggregateSymbol as = new AggregateSymbol("foo", Reserved.TEXTAGG, false, tf);
+ as.setOrderBy(new OrderBy(Arrays.asList(new ElementSymbol("e2"))));
+
+ Query query = new Query();
+ query.setSelect(new Select(Arrays.asList(as)));
+
+ String sql = "SELECT TextAgg(e1 as col1, e2 as col2 delimiter ',' header order by e2)"; //$NON-NLS-1$
+ helpTest(sql, "SELECT TEXTAGG(TEXTLINE(e1 AS col1, e2 AS col2 DELIMITER ',' HEADER) ORDER BY e2)", query);
+ }
+
+// @Test public void testTextForrest() throws Exception {
+// List<DerivedColumn> expressions = new ArrayList<DerivedColumn>();
+// expressions.add(new DerivedColumn(null, new Constant(1)));
+// expressions.add(new DerivedColumn("col2", new ElementSymbol("e2")));
+//
+// TextForest tf = new TextForest();
+// tf.setExpressions(expressions);
+// tf.setIncludeHeader(true);
+//
+// String sql = "textforest(1, e2 as col2 HEADER)"; //$NON-NLS-1$
+// helpTestExpression(sql, "TEXTFOREST(1, e2 AS col2 HEADER)", tf);
+// }
+
@Test public void testNestedTable() throws Exception {
String sql = "SELECT * from TABLE(exec foo()) as x"; //$NON-NLS-1$
Query query = new Query();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2010-10-26 20:44:55 UTC (rev 2683)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2010-10-27 02:16:50 UTC (rev 2684)
@@ -22,8 +22,11 @@
package org.teiid.query.processor;
+import static org.teiid.query.optimizer.TestOptimizer.getTypicalCapabilities;
+import static org.teiid.query.optimizer.TestOptimizer.helpPlan;
import static org.teiid.query.processor.TestProcessor.*;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -33,7 +36,12 @@
import org.teiid.core.types.ClobType;
import org.teiid.core.types.InputStreamFactory;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
+import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
+import org.teiid.query.unittest.FakeMetadataFacade;
import org.teiid.query.unittest.FakeMetadataFactory;
@SuppressWarnings({"unchecked", "nls"})
@@ -221,4 +229,31 @@
return new ClobType(new ClobImpl(new InputStreamFactory.FileInputStreamFactory(UnitTestUtil.getTestDataFile(file)), -1));
}
+ @Test public void testTextAgg() throws Exception {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+
+ BasicSourceCapabilities caps = getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, false);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
+ caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ ProcessorPlan plan = helpPlan("select convert(textagg(pm1.g1.e1, pm1.g1.e2 header order by e2), string) as x from pm1.g1", metadata, null, capFinder, //$NON-NLS-1$
+ new String[] { "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+ HardcodedDataManager hdm = new HardcodedDataManager();
+ hdm.addData("SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0", new List[] {Arrays.asList("z", 2), Arrays.asList("b", 1)});
+ hdm.setBlockOnce(true);
+
+ String nl = System.getProperty("line.separator");
+ ArrayList list = new ArrayList();
+ list.add("e1,e2"+nl+"b,1"+nl+"z,2"+nl);
+ List[] expected = new List[] {
+ list,
+ };
+
+ helpProcess(plan, hdm, expected);
+ }
+
}
14 years, 4 months
teiid SVN: r2683 - in trunk/engine/src: test/java/org/teiid/dqp/internal/process/multisource and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-26 16:44:55 -0400 (Tue, 26 Oct 2010)
New Revision: 2683
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
Log:
TEIID-1295 re-fixing multi-source update count.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2010-10-26 14:11:06 UTC (rev 2682)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2010-10-26 20:44:55 UTC (rev 2683)
@@ -190,7 +190,7 @@
ProjectNode projectNode = new ProjectNode(getID());
- Expression intSum = ResolverUtil.convertExpression(sumCount, DataTypeManager.DefaultDataTypes.STRING, metadata);
+ Expression intSum = ResolverUtil.getConversion(sumCount, DataTypeManager.getDataTypeName(sumCount.getType()), DataTypeManager.DefaultDataTypes.INTEGER, false, metadata.getFunctionLibrary());
Expression rowCount = new ExpressionSymbol("RowCount", intSum); //$NON-NLS-1$
outputElements = new ArrayList<Expression>(1);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2010-10-26 14:11:06 UTC (rev 2682)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2010-10-26 20:44:55 UTC (rev 2683)
@@ -249,5 +249,17 @@
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
}
+
+ @Test public void testMultiUpdateAll() throws Exception {
+ final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final String userSql = "update MultiModel.Phys set a = '1' where b = 'z'"; //$NON-NLS-1$
+ final String multiModel = "MultiModel"; //$NON-NLS-1$
+ final int sources = 3;
+ final List[] expected = new List[] { Arrays.asList(3)};
+ final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
+ dataMgr.setMustRegisterCommands(true);
+ dataMgr.addData("UPDATE MultiModel.Phys SET a = '1' WHERE b = 'z'", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ }
}
14 years, 4 months
teiid SVN: r2682 - in trunk: client/src/main/java/org/teiid/jdbc and 39 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-26 10:11:06 -0400 (Tue, 26 Oct 2010)
New Revision: 2682
Added:
trunk/engine/src/test/resources/encoding.xml
Modified:
trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt
trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java
trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
trunk/metadata/src/main/resources/System.vdb
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected
trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected
Log:
forward merge of 7.1.1 in preparation for cr1
Modified: trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/build/kits/jboss-container/teiid-examples/jca/readme.txt 2010-10-26 14:11:06 UTC (rev 2682)
@@ -1,8 +1,8 @@
-This folder contains the sample "-ds.xml" files that can be created for Teiid sources.
+This directory contains examples of data source configuration files for the following types of sources:
+ flat files
+ LDAP
+ SalesForce
+ Web Services (for ws-security see Admin Guide)
-JDBC: Please check "<jboss-as>/docs/examples/jca" directory for creating a -ds.xml file for any type of relational database.
-Please note you can find samples for creating both "local" and "xa" data sources.
-
-Web Serivices with ws-security: Check out Admin guide for a sample with explanation on how to use it.
-
-All the others types of sources, please find a example in this directory.
\ No newline at end of file
+JDBC Users: Please see the examples in the "<jboss-as>/docs/examples/jca" directory for creating data source configuration
+files for any type of relational database. These examples demonstrate creating both "local" and "xa" data sources.
Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -532,12 +532,10 @@
parameterMap = new TreeMap<Integer, Object>();
}
- Object val = null;
if (serverCalendar != null && value instanceof java.util.Date) {
- val = TimestampWithTimezone.create((java.util.Date)value, getDefaultCalendar().getTimeZone(), serverCalendar, value.getClass());
- } else val = value;
-
- parameterMap.put(parameterIndex, val);
+ value = TimestampWithTimezone.create((java.util.Date)value, getDefaultCalendar().getTimeZone(), serverCalendar, value.getClass());
+ }
+ parameterMap.put(parameterIndex, value);
}
/**
Modified: trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -89,14 +89,17 @@
if (cs != null) {
return cs;
}
+ String enc = null;
try {
- String enc = XMLType.getEncoding(this.getBinaryStream());
- if (enc != null) {
- setEncoding(enc);
- }
+ enc = XMLType.getEncoding(this.getBinaryStream());
} catch (SQLException e) {
}
- return Streamable.CHARSET;
+ if (enc != null) {
+ setEncoding(enc);
+ } else {
+ super.setCharset(Streamable.CHARSET);
+ }
+ return super.getCharset();
}
@SuppressWarnings("unchecked")
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -817,6 +817,11 @@
stmt.setTimestamp(i,(java.sql.Timestamp)param, getDatabaseCalendar());
return;
}
+ //not all drivers handle the setObject call with BigDecimal correctly (namely jConnect 6.05)
+ if (TypeFacility.RUNTIME_TYPES.BIG_DECIMAL.equals(paramType)) {
+ stmt.setBigDecimal(i, (BigDecimal)param);
+ return;
+ }
//convert these the following to jdbc safe values
if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
param = new BigDecimal((BigInteger)param);
@@ -824,7 +829,8 @@
param = new Double(((Float)param).doubleValue());
} else if (TypeFacility.RUNTIME_TYPES.CHAR.equals(paramType)) {
param = ((Character)param).toString();
- }
+ }
+
stmt.setObject(i, param, type);
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -150,11 +150,9 @@
//if column and type is date, just use date format
Expression ex = function.getParameters().get(0);
String format = TIMESTAMP_FORMAT;
- if (ex instanceof ColumnReference) {
- if ("date".equals(((ColumnReference)ex).getMetadataObject().getNativeType())) { //$NON-NLS-1$
- format = DATETIME_FORMAT;
- }
- } else if (!(ex instanceof Function) && !(ex instanceof Literal)) {
+ if (ex instanceof ColumnReference && "date".equalsIgnoreCase(((ColumnReference)ex).getMetadataObject().getNativeType())) { //$NON-NLS-1$
+ format = DATETIME_FORMAT;
+ } else if (!(ex instanceof Literal) && !(ex instanceof Function)) {
//this isn't needed in every case, but it's simpler than inspecting the expression more
ex = ConvertModifier.createConvertFunction(getLanguageFactory(), function.getParameters().get(0), TypeFacility.RUNTIME_NAMES.TIMESTAMP);
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -140,7 +140,7 @@
});
convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD")); //$NON-NLS-1$ //$NON-NLS-2$
convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "HH24:MI:SS")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD HH24:MI:SS.UF")); //$NON-NLS-1$ //$NON-NLS-2$
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD HH24:MI:SS.US")); //$NON-NLS-1$ //$NON-NLS-2$
convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -181,7 +181,7 @@
protected List<?> convertTimestampToString(Function function) {
LinkedList<Object> result = new LinkedList<Object>();
result.addAll(convertDateToString(function));
- result.add(' ');
+ result.add('+');
result.addAll(convertTimeToString(function));
return result;
}
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -34,6 +34,7 @@
import org.teiid.language.Expression;
import org.teiid.language.Function;
import org.teiid.language.LanguageFactory;
+import org.teiid.metadata.Column;
import org.teiid.query.unittest.TimestampUtil;
import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.SQLConversionVisitor;
@@ -41,6 +42,7 @@
/**
*/
+@SuppressWarnings("nls")
public class TestOracleConvertModifier {
private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
@@ -500,6 +502,13 @@
Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);
helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts '2003-11-01 12:05:02.01'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ @Test public void testTimestampToString1() throws Exception {
+ Column column = new Column();
+ column.setNativeType("DATE");
+ column.setNameInSource("dt");
+ helpTest(LANG_FACTORY.createColumnReference("dt", LANG_FACTORY.createNamedTable("x", null, null), column, Timestamp.class), "string", "to_char(x.dt, 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
@Test public void testTimestampToDate() throws Exception {
Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/postgresql/TestPostgreSQLTranslator.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -158,7 +158,7 @@
}
@Test public void testConversion13() throws Exception {
String input = "SELECT convert(convert(PART_WEIGHT, timestamp), string) FROM PARTS"; //$NON-NLS-1$
- String output = "SELECT to_char(cast(PARTS.PART_WEIGHT AS timestamp), 'YYYY-MM-DD HH24:MI:SS.UF') FROM PARTS"; //$NON-NLS-1$
+ String output = "SELECT to_char(cast(PARTS.PART_WEIGHT AS timestamp), 'YYYY-MM-DD HH24:MI:SS.US') FROM PARTS"; //$NON-NLS-1$
helpTestVisitor(getTestVDB(),
input,
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sybase/TestSybaseConvertModifier.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -185,7 +185,7 @@
LANG_FACTORY.createLiteral("string", String.class)}, //$NON-NLS-1$
String.class);
- helpGetString1(func, "stuff(stuff(convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 102), 5, 1, '-'), 8, 1, '-') convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 8)"); //$NON-NLS-1$
+ helpGetString1(func, "stuff(stuff(convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 102), 5, 1, '-'), 8, 1, '-')+convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 8)"); //$NON-NLS-1$
}
@Test public void testDateToString() throws Exception {
Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2010-10-26 14:11:06 UTC (rev 2682)
@@ -335,19 +335,6 @@
</entry>
<entry>Name given to this data source</entry>
</row>
- <row>
- <entry>
- <code>PassthroughAuthentication</code>
- </entry>
- <entry>
- <code>boolean</code>
- </entry>
- <entry>Only applies to "local" connections. When this option is set to "true", then Teiid looks for
- already authenticated security context on the calling thread. If one found it uses that users credentials
- to create session. Teiid also verifies that the same user is using this connection during the life of the connection.
- if it finds a different security context on the calling thread, it switches the identity on the connection,
- if the new user is also eligible to log in to Teiid otherwise connection fails to execute.</entry>
- </row>
</tbody>
</tgroup>
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -657,10 +657,8 @@
}
}
Class<?> returnType = null;
- List parameters = sp.getParameters();
List<Argument> translatedParameters = new ArrayList<Argument>();
- for (Iterator i = parameters.iterator(); i.hasNext();) {
- SPParameter param = (SPParameter)i.next();
+ for (SPParameter param : sp.getParameters()) {
Direction direction = Direction.IN;
switch(param.getParameterType()) {
case ParameterInfo.IN:
@@ -676,13 +674,15 @@
continue; //already part of the metadata
case ParameterInfo.RETURN_VALUE:
returnType = param.getClassType();
- break;
-
+ continue;
}
ProcedureParameter metadataParam = metadataFactory.getParameter(param);
//we can assume for now that all arguments will be literals, which may be multivalued
- Literal value = (Literal)translate(param.getExpression());
+ Literal value = null;
+ if (direction != Direction.OUT) {
+ value = (Literal)translate(param.getExpression());
+ }
Argument arg = new Argument(direction, value, param.getClassType(), metadataParam);
translatedParameters.add(arg);
}
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -41,7 +41,6 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.trans.XPathException;
import org.teiid.api.exception.query.ExpressionEvaluationException;
@@ -110,6 +109,7 @@
import org.teiid.query.sql.util.ValueIteratorSource;
import org.teiid.query.util.CommandContext;
import org.teiid.query.xquery.saxon.SaxonXQueryExpression;
+import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
import org.teiid.translator.WSConnection.Util;
public class Evaluator {
@@ -761,13 +761,18 @@
if (xmlQuery.getEmptyOnEmpty() != null) {
emptyOnEmpty = xmlQuery.getEmptyOnEmpty();
}
+ Result result = null;
try {
- SequenceIterator iter = evaluateXQuery(xmlQuery.getXQueryExpression(), xmlQuery.getPassing(), tuple);
- return xmlQuery.getXQueryExpression().createXMLType(iter, this.context.getBufferManager(), emptyOnEmpty);
+ result = evaluateXQuery(xmlQuery.getXQueryExpression(), xmlQuery.getPassing(), tuple);
+ return xmlQuery.getXQueryExpression().createXMLType(result.iter, this.context.getBufferManager(), emptyOnEmpty);
} catch (TeiidProcessingException e) {
throw new FunctionExecutionException(e, QueryPlugin.Util.getString("Evaluator.xmlquery", e.getMessage())); //$NON-NLS-1$
} catch (XPathException e) {
throw new FunctionExecutionException(e, QueryPlugin.Util.getString("Evaluator.xmlquery", e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (result != null) {
+ result.close();
+ }
}
}
@@ -837,7 +842,7 @@
}
}
- public SequenceIterator evaluateXQuery(SaxonXQueryExpression xquery, List<DerivedColumn> cols, List<?> tuple)
+ public Result evaluateXQuery(SaxonXQueryExpression xquery, List<DerivedColumn> cols, List<?> tuple)
throws BlockedException, TeiidComponentException, TeiidProcessingException {
HashMap<String, Object> parameters = new HashMap<String, Object>();
Object contextItem = null;
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -783,10 +783,22 @@
path = path.replace(File.separatorChar, '/');
}
for (String string : schemaPaths) {
- SQLXMLImpl schema = getVDBResourceAsSQLXML(string);
-
+ String parentPath = path;
+ boolean relative = false;
+ while (string.startsWith("../")) { //$NON-NLS-1$
+ relative = true;
+ string = string.substring(3);
+ parentPath = new File(parentPath).getParent();
+ }
+ SQLXMLImpl schema = null;
+ if (!relative) {
+ schema = getVDBResourceAsSQLXML(string);
+ }
if (schema == null) {
- schema = getVDBResourceAsSQLXML(path + '/' + string);
+ if (!parentPath.endsWith("/")) { //$NON-NLS-1$
+ parentPath += "/"; //$NON-NLS-1$
+ }
+ schema = getVDBResourceAsSQLXML(parentPath + string);
}
if (schema == null) {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -82,6 +82,7 @@
import org.teiid.query.sql.lang.JoinType;
import org.teiid.query.sql.lang.OrderBy;
import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.TableFunctionReference;
import org.teiid.query.sql.lang.TextTable;
@@ -319,13 +320,15 @@
aNode.setShouldEvaluateExpressions(EvaluatableVisitor.needsProcessingEvaluation(command));
}
- try {
- command = (Command)command.clone();
- boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
- boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
- command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
- } catch (QueryMetadataException err) {
- throw new TeiidComponentException(err);
+ if (command instanceof QueryCommand) {
+ try {
+ command = (Command)command.clone();
+ boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
+ boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
+ command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
+ } catch (QueryMetadataException err) {
+ throw new TeiidComponentException(err);
+ }
}
aNode.setCommand(command);
aNode.setModelName(getRoutingName(node));
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -61,6 +61,7 @@
import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
import org.teiid.query.optimizer.relational.rules.CapabilitiesUtil;
import org.teiid.query.optimizer.relational.rules.CriteriaCapabilityValidatorVisitor;
+import org.teiid.query.optimizer.relational.rules.RuleCollapseSource;
import org.teiid.query.optimizer.relational.rules.RuleConstants;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.ProcessorPlan;
@@ -538,12 +539,6 @@
private void addNestedProcedure(PlanNode sourceNode,
ProcedureContainer container) throws TeiidComponentException,
QueryMetadataException, TeiidProcessingException {
- //plan any subqueries in criteria/parameters/values
- for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
- ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
- subqueryContainer.getCommand().setProcessorPlan(plan);
- }
-
String cacheString = "transformation/" + container.getClass().getSimpleName(); //$NON-NLS-1$
Command c = (Command)metadata.getFromMetadataCache(container.getGroup().getMetadataID(), cacheString);
if (c == null) {
@@ -579,6 +574,20 @@
//so that we know what the determinism level is.
addNestedCommand(sourceNode, container.getGroup(), container, c, false);
}
+ //plan any subqueries in criteria/parameters/values
+ for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
+ ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
+ subqueryContainer.getCommand().setProcessorPlan(plan);
+
+ if (c == null) {
+ RuleCollapseSource.replaceCorrelatedReferences(subqueryContainer);
+ }
+ }
+
+ if (c == null && !container.getGroup().isTempGroupSymbol() &&
+ !CriteriaCapabilityValidatorVisitor.canPushLanguageObject(container, metadata.getModelID(container.getGroup().getMetadataID()), metadata, capFinder, analysisRecord)) {
+ throw new QueryPlannerException(QueryPlugin.Util.getString("RelationalPlanner.nonpushdown_command", container)); //$NON-NLS-1$
+ }
}
PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -227,7 +227,7 @@
return;
}
if (! CapabilitiesUtil.supportsScalarFunction(modelID, obj, metadata, capFinder)) {
- markInvalid(obj, obj.isImplicit()?"":"(implicit) convert" + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ markInvalid(obj, (obj.isImplicit()?"(implicit) convert":"") + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
} catch(QueryMetadataException e) {
handleException(new TeiidComponentException(e));
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -39,6 +39,7 @@
import org.teiid.query.optimizer.relational.RuleStack;
import org.teiid.query.optimizer.relational.plantree.NodeConstants;
import org.teiid.query.optimizer.relational.plantree.NodeEditor;
+import org.teiid.query.optimizer.relational.plantree.NodeFactory;
import org.teiid.query.optimizer.relational.plantree.PlanNode;
import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
import org.teiid.query.processor.ProcessorPlan;
@@ -352,55 +353,55 @@
private void replaceCorrelatedReferences(List<SubqueryContainer> containers) {
for (SubqueryContainer container : containers) {
- RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
- if (subqueryPlan == null || !(subqueryPlan.getRootNode() instanceof AccessNode)) {
- continue;
- }
- AccessNode child = (AccessNode)subqueryPlan.getRootNode();
- Command command = child.getCommand();
- final SymbolMap map = container.getCommand().getCorrelatedReferences();
- if (map != null) {
- ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(null) {
- @Override
- public Expression replaceExpression(
- Expression element) {
- if (element instanceof Reference) {
- Reference ref = (Reference)element;
- Expression replacement = map.getMappedExpression(ref.getExpression());
- if (replacement != null) {
- return replacement;
- }
- }
- return element;
- }
- };
- DeepPostOrderNavigator.doVisit(command, visitor);
- }
- command.setProcessorPlan(container.getCommand().getProcessorPlan());
- container.setCommand(command);
+ replaceCorrelatedReferences(container);
}
}
+ public static void replaceCorrelatedReferences(SubqueryContainer container) {
+ RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
+ if (subqueryPlan == null || !(subqueryPlan.getRootNode() instanceof AccessNode)) {
+ return;
+ }
+ AccessNode child = (AccessNode)subqueryPlan.getRootNode();
+ Command command = child.getCommand();
+ final SymbolMap map = container.getCommand().getCorrelatedReferences();
+ if (map != null) {
+ ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(null) {
+ @Override
+ public Expression replaceExpression(
+ Expression element) {
+ if (element instanceof Reference) {
+ Reference ref = (Reference)element;
+ Expression replacement = map.getMappedExpression(ref.getExpression());
+ if (replacement != null) {
+ return replacement;
+ }
+ }
+ return element;
+ }
+ };
+ DeepPostOrderNavigator.doVisit(command, visitor);
+ }
+ command.setProcessorPlan(container.getCommand().getProcessorPlan());
+ container.setCommand(command);
+ }
+
private void processLimit(PlanNode node,
QueryCommand query, QueryMetadataInterface metadata) {
+
Expression limit = (Expression)node.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
- if (limit != null) {
- if (query.getLimit() != null) {
- Expression oldlimit = query.getLimit().getRowLimit();
- query.getLimit().setRowLimit(RulePushLimit.getMinValue(limit, oldlimit));
- } else {
- query.setLimit(new Limit(null, limit));
- }
- }
Expression offset = (Expression)node.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
- if (offset != null) {
- if (query.getLimit() != null) {
- Expression oldoffset = query.getLimit().getOffset();
- query.getLimit().setOffset(RulePushLimit.getSum(offset, oldoffset, metadata.getFunctionLibrary()));
- } else {
- query.setLimit(new Limit(offset, null));
- }
+
+ PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT);
+ Expression childLimit = null;
+ Expression childOffset = null;
+ if (query.getLimit() != null) {
+ childLimit = query.getLimit().getRowLimit();
+ childOffset = query.getLimit().getOffset();
}
+ RulePushLimit.combineLimits(limitNode, metadata, limit, offset, childLimit, childOffset);
+
+ query.setLimit(new Limit((Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT), (Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT)));
}
/**
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushLimit.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -26,11 +26,16 @@
import java.util.LinkedList;
import java.util.List;
+import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryPlannerException;
+import org.teiid.common.buffer.BlockedException;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.eval.Evaluator;
import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -47,7 +52,9 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.Function;
import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.visitor.EvaluatableVisitor;
import org.teiid.query.util.CommandContext;
+import org.teiid.translator.SourceSystemFunctions;
/**
@@ -116,18 +123,19 @@
return false;
}
- switch (child.getType()) {
+ Expression parentLimit = (Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
+ Expression parentOffset = (Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
+ switch (child.getType()) {
case NodeConstants.Types.TUPLE_LIMIT:
{
+
//combine the limits
- Expression minLimit = getMinValue((Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT), (Expression)child.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT));
- Expression offSet = getSum((Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT), (Expression)child.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT), metadata.getFunctionLibrary());
+ Expression childLimit = (Expression)child.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
+ Expression childOffset = (Expression)child.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
+
+ combineLimits(limitNode, metadata, parentLimit, parentOffset, childLimit, childOffset);
NodeEditor.removeChildNode(limitNode, child);
-
- limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit);
- limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet);
-
limitNodes.remove(child);
return canPushLimit(rootNode, limitNode, limitNodes, metadata, capFinder);
@@ -141,9 +149,7 @@
List<PlanNode> grandChildren = new LinkedList<PlanNode>(child.getChildren());
for (PlanNode grandChild : grandChildren) {
PlanNode newLimit = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT);
- Expression limit = (Expression)limitNode.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
- Expression offset = (Expression)limitNode.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
- newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, getSum(limit, offset, metadata.getFunctionLibrary()));
+ newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, parentLimit, parentOffset, metadata.getFunctionLibrary()));
grandChild.addAsParent(newLimit);
limitNodes.add(newLimit);
}
@@ -171,6 +177,28 @@
}
}
}
+
+ static void combineLimits(PlanNode limitNode,
+ QueryMetadataInterface metadata, Expression parentLimit,
+ Expression parentOffset, Expression childLimit,
+ Expression childOffset) {
+ Expression minLimit = null;
+ Expression offSet = null;
+
+ if (childLimit == null) {
+ minLimit = parentLimit;
+ offSet = op(SourceSystemFunctions.ADD_OP, childOffset, parentOffset, metadata.getFunctionLibrary());
+ } else {
+ minLimit = getMinValue(parentLimit, op(SourceSystemFunctions.SUBTRACT_OP, childLimit, parentOffset, metadata.getFunctionLibrary()));
+ offSet = childOffset;
+ if (offSet == null) {
+ offSet = parentOffset;
+ }
+ }
+
+ limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit);
+ limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet);
+ }
static PlanNode raiseAccessOverLimit(PlanNode rootNode,
PlanNode accessNode,
@@ -206,7 +234,7 @@
// since we're pushing underneath the offset, we want enough rows to satisfy both the limit and the row offset
- pushedLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, getSum(limit, offset, metadata.getFunctionLibrary()));
+ pushedLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, limit, offset, metadata.getFunctionLibrary()));
if (accessNode.getChildCount() == 0) {
accessNode.addFirstChild(pushedLimit);
@@ -221,11 +249,7 @@
return RuleRaiseAccess.performRaise(rootNode, accessNode, parentNode);
}
- /**
- * @param limitNode
- * @param child
- */
- static Expression getSum(Expression expr1, Expression expr2, FunctionLibrary functionLibrary) {
+ static Expression op(String op, Expression expr1, Expression expr2, FunctionLibrary functionLibrary) {
if (expr1 == null) {
return expr2;
}
@@ -233,15 +257,29 @@
return expr1;
}
- Function newExpr = new Function("+", new Expression[] {expr1, expr2}); //$NON-NLS-1$
- newExpr.setFunctionDescriptor(functionLibrary.findFunction("+", new Class[] {DataTypeManager.DefaultDataClasses.INTEGER, DataTypeManager.DefaultDataClasses.INTEGER})); //$NON-NLS-1$
+ Function newExpr = new Function(op, new Expression[] {expr1, expr2});
+ newExpr.setFunctionDescriptor(functionLibrary.findFunction(op, new Class[] {DataTypeManager.DefaultDataClasses.INTEGER, DataTypeManager.DefaultDataClasses.INTEGER}));
newExpr.setType(newExpr.getFunctionDescriptor().getReturnType());
+ return evaluateIfPossible(newExpr);
+ }
+
+ private static Expression evaluateIfPossible(Expression newExpr) {
+ if (EvaluatableVisitor.isFullyEvaluatable(newExpr, true)) {
+ try {
+ return new Constant(Evaluator.evaluate(newExpr), newExpr.getType());
+ } catch (TeiidException e) {
+ throw new TeiidRuntimeException(e, "Unexpected Exception"); //$NON-NLS-1$
+ }
+ }
return newExpr;
- }
+ }
/**
* @param limitNode
* @param child
+ * @throws TeiidComponentException
+ * @throws BlockedException
+ * @throws ExpressionEvaluationException
*/
static Expression getMinValue(Expression expr1, Expression expr2) {
if (expr1 == null) {
@@ -254,7 +292,8 @@
Criteria crit = new CompareCriteria(expr1, CompareCriteria.LT, expr2);
SearchedCaseExpression sce = new SearchedCaseExpression(Arrays.asList(new Object[] {crit}), Arrays.asList(new Object[] {expr1}));
sce.setElseExpression(expr2);
- return sce;
+ sce.setType(expr1.getType());
+ return evaluateIfPossible(sce);
}
/**
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -50,6 +50,7 @@
import org.teiid.query.function.FunctionDescriptor;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.XMLTable.XMLColumn;
+import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
/**
* Handles xml table processing.
@@ -69,7 +70,7 @@
private XMLTable table;
private List<XMLColumn> projectedColumns;
- private SequenceIterator result;
+ private Result result;
private int rowCount = 0;
private Item item;
@@ -130,7 +131,7 @@
TeiidComponentException, TeiidProcessingException {
if (item == null) {
try {
- item = result.next();
+ item = result.iter.next();
} catch (XPathException e) {
throw new TeiidProcessingException(e, QueryPlugin.Util.getString("XMLTableNode.error", e.getMessage())); //$NON-NLS-1$
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -58,8 +58,10 @@
import org.teiid.query.sql.lang.GroupContext;
import org.teiid.query.sql.lang.ProcedureContainer;
import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.SubqueryContainer;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
/**
@@ -295,5 +297,15 @@
return Collections.EMPTY_MAP;
}
+
+ public static void resolveSubqueries(Command command,
+ TempMetadataAdapter metadata, AnalysisRecord analysis)
+ throws QueryResolverException, TeiidComponentException {
+ for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(command)) {
+ QueryResolver.setChildMetadata(container.getCommand(), command);
+
+ QueryResolver.resolveCommand(container.getCommand(), Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
+ }
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -33,6 +33,7 @@
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.resolver.ProcedureContainerResolver;
+import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Delete;
@@ -58,7 +59,7 @@
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(delete.getGroup());
ResolverVisitor.resolveLanguageObject(delete, groups, delete.getExternalGroupContexts(), metadata);
-
+ QueryResolver.resolveSubqueries(command, metadata, analysis);
}
/**
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -71,13 +71,14 @@
public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis)
throws QueryMetadataException, QueryResolverException, TeiidComponentException {
-
// Cast to known type
Insert insert = (Insert) command;
- //variables and values must be resolved separately to account for implicitly defined temp groups
- resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
-
+ if (insert.getValues() != null) {
+ QueryResolver.resolveSubqueries(command, metadata, analysis);
+ //variables and values must be resolved separately to account for implicitly defined temp groups
+ resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
+ }
//resolve subquery if there
if(insert.getQueryExpression() != null) {
QueryResolver.setChildMetadata(insert.getQueryExpression(), command);
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -39,6 +39,7 @@
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.resolver.ProcedureContainerResolver;
+import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.resolver.VariableResolver;
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.resolver.util.ResolverVisitor;
@@ -69,6 +70,7 @@
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(update.getGroup());
ResolverVisitor.resolveLanguageObject(update, groups, update.getExternalGroupContexts(), metadata);
+ QueryResolver.resolveSubqueries(command, metadata, analysis);
}
/**
Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -2329,9 +2329,12 @@
//After this method, no longer need to display named parameters
storedProcedure.setDisplayNamedParameters(false);
- for (Iterator i = storedProcedure.getInputParameters().iterator(); i.hasNext();) {
- SPParameter param = (SPParameter)i.next();
- param.setExpression(rewriteExpressionDirect(param.getExpression()));
+ for (SPParameter param : storedProcedure.getInputParameters()) {
+ if (!processing) {
+ param.setExpression(rewriteExpressionDirect(param.getExpression()));
+ } else if (!(param.getExpression() instanceof Constant)) {
+ param.setExpression(new Constant(this.evaluator.evaluate(param.getExpression(), null), param.getClassType()));
+ }
}
return storedProcedure;
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -34,6 +34,7 @@
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.lang.DependentSetCriteria;
import org.teiid.query.sql.lang.ExistsCriteria;
+import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.SubqueryCompareCriteria;
import org.teiid.query.sql.lang.SubquerySetCriteria;
@@ -127,6 +128,11 @@
public void visit(StoredProcedure proc){
evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
+ for (SPParameter param : proc.getInputParameters()) {
+ if (!(param.getExpression() instanceof Constant)) {
+ evaluationNotPossible(EvaluationLevel.PROCESSING);
+ }
+ }
}
public void visit(ScalarSubquery obj){
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -945,7 +945,8 @@
append("("); //$NON-NLS-1$
boolean first = true;
for (SPParameter param : obj.getParameters()) {
- if (param.getParameterType() == SPParameter.RETURN_VALUE || param.getParameterType() == SPParameter.RESULT_SET || param.getExpression() == null) {
+ if (param.isUsingDefault() || param.getParameterType() == SPParameter.RETURN_VALUE
+ || param.getParameterType() == SPParameter.RESULT_SET || param.getExpression() == null) {
continue;
}
if (first) {
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -39,6 +39,7 @@
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.EquivalenceUtil;
@@ -195,9 +196,27 @@
public void visit(Delete obj) {
validateNoXMLUpdates(obj);
validateHasProjectedSymbols(obj);
- validateGroupSupportsUpdate(obj.getGroup());
+ GroupSymbol group = obj.getGroup();
+ validateGroupSupportsUpdate(group);
+ Criteria crit = obj.getCriteria();
+ validateVirtualUpdate(group, crit);
}
+ private void validateVirtualUpdate(GroupSymbol group,
+ Criteria crit) {
+ if (crit == null) {
+ return;
+ }
+ try {
+ if (getMetadata().isVirtualGroup(group.getMetadataID()) &&
+ !ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit).isEmpty()) {
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.virtual_update_subquery"), crit); //$NON-NLS-1$
+ }
+ } catch (TeiidException e) {
+ handleException(e);
+ }
+ }
+
public void visit(GroupBy obj) {
// Get list of all group by IDs
List groupBySymbols = obj.getSymbols();
@@ -307,6 +326,7 @@
validateHasProjectedSymbols(obj);
validateGroupSupportsUpdate(obj.getGroup());
validateUpdate(obj);
+ validateVirtualUpdate(obj.getGroup(), obj.getCriteria());
}
public void visit(Into obj) {
@@ -865,7 +885,7 @@
protected void validateSetClauseList(SetClauseList list) {
Set<ElementSymbol> dups = new HashSet<ElementSymbol>();
- HashSet changeVars = new HashSet();
+ HashSet<ElementSymbol> changeVars = new HashSet<ElementSymbol>();
for (SetClause clause : list.getClauses()) {
ElementSymbol elementID = clause.getSymbol();
if (!changeVars.add(elementID)) {
Modified: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -88,10 +89,27 @@
import org.teiid.query.sql.symbol.DerivedColumn;
import org.teiid.query.sql.symbol.XMLNamespaces;
import org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem;
+import org.teiid.translator.WSConnection.Util;
@SuppressWarnings("serial")
public class SaxonXQueryExpression {
+ public static class Result {
+ public SequenceIterator iter;
+ public List<Source> sources = new LinkedList<Source>();
+
+ public void close() {
+ for (Source source : sources) {
+ Util.closeSource(source);
+ }
+ if (iter != null) {
+ iter.close();
+ }
+ sources.clear();
+ iter = null;
+ }
+ }
+
private static final Expression DUMMY_EXPRESSION = new Expression() {
@Override
public ItemType getItemType(TypeHierarchy th) {
@@ -133,7 +151,7 @@
private net.sf.saxon.query.XQueryExpression xQuery;
private Configuration config = new Configuration();
private PathMapRoot contextRoot;
-
+
public SaxonXQueryExpression(String xQueryString, XMLNamespaces namespaces, List<DerivedColumn> passing, List<XMLTable.XMLColumn> columns)
throws QueryResolverException {
config.setErrorListener(ERROR_LISTENER);
@@ -261,7 +279,7 @@
if (root.getRootExpression() instanceof ContextItemExpression || root.getRootExpression() instanceof RootExpression) {
if (subContextRoot != null) {
if (record.recordDebug()) {
- record.println("Document projection will not be used, since multiple context item exist in column path " + xmlColumn.getPath()); //$NON-NLS-1$
+ record.println("Document projection will not be used, since multiple context items exist in column path " + xmlColumn.getPath()); //$NON-NLS-1$
}
return null;
}
@@ -280,8 +298,7 @@
}
HashSet<PathMapNode> subFinalNodes = new HashSet<PathMapNode>();
getReturnableNodes(subContextRoot, subFinalNodes);
- for (Iterator iter = subFinalNodes.iterator(); iter.hasNext(); ) {
- PathMapNode subNode = (PathMapNode)iter.next();
+ for (PathMapNode subNode : subFinalNodes) {
addReturnedArcs(xmlColumn, subNode);
}
}
@@ -354,47 +371,55 @@
xmlColumn.setPathExpression(exp);
}
}
-
- public SequenceIterator evaluateXQuery(Object context, Map<String, Object> parameterValues) throws TeiidProcessingException {
+
+ public Result evaluateXQuery(Object context, Map<String, Object> parameterValues) throws TeiidProcessingException {
DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
-
+
+ Result result = new Result();
try {
- for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
- Object value = entry.getValue();
- if(value instanceof SQLXML) {
- value = XMLSystemFunctions.convertToSource(value);
- } else if (value instanceof java.util.Date) {
- java.util.Date d = (java.util.Date)value;
- value = XMLSystemFunctions.convertToAtomicValue(value);
+ try {
+ for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
+ Object value = entry.getValue();
+ if(value instanceof SQLXML) {
+ value = XMLSystemFunctions.convertToSource(value);
+ result.sources.add((Source)value);
+ } else if (value instanceof java.util.Date) {
+ value = XMLSystemFunctions.convertToAtomicValue(value);
+ }
+ dynamicContext.setParameter(entry.getKey(), value);
+ }
+ } catch (TransformerException e) {
+ throw new TeiidProcessingException(e);
+ }
+ if (context != null) {
+ Source source = XMLSystemFunctions.convertToSource(context);
+ result.sources.add(source);
+ if (contextRoot != null) {
+ //create our own filter as this logic is not provided in the free saxon
+ ProxyReceiver filter = new PathMapFilter(contextRoot);
+ AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
+ sourceInput.addFilter(filter);
+ source = sourceInput;
}
- dynamicContext.setParameter(entry.getKey(), value);
+ DocumentInfo doc;
+ try {
+ doc = config.buildDocument(source);
+ } catch (XPathException e) {
+ throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
+ }
+ dynamicContext.setContextItem(doc);
}
- } catch (TransformerException e) {
- throw new TeiidProcessingException(e);
+ try {
+ result.iter = xQuery.iterator(dynamicContext);
+ return result;
+ } catch (TransformerException e) {
+ throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_xquery")); //$NON-NLS-1$
+ }
+ } finally {
+ if (result.iter == null) {
+ result.close();
+ }
}
-
- if (context != null) {
- Source source = XMLSystemFunctions.convertToSource(context);
- if (contextRoot != null) {
- //create our own filter as this logic is not provided in the free saxon
- ProxyReceiver filter = new PathMapFilter(contextRoot);
- AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
- sourceInput.addFilter(filter);
- source = sourceInput;
- }
- DocumentInfo doc;
- try {
- doc = config.buildDocument(source);
- } catch (XPathException e) {
- throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
- }
- dynamicContext.setContextItem(doc);
- }
- try {
- return xQuery.iterator(dynamicContext);
- } catch (TransformerException e) {
- throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_xquery")); //$NON-NLS-1$
- }
}
public XMLType createXMLType(final SequenceIterator iter, BufferManager bufferManager, boolean emptyOnEmpty) throws XPathException, TeiidComponentException, TeiidProcessingException {
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-26 14:11:06 UTC (rev 2682)
@@ -193,6 +193,7 @@
ValidationVisitor.translated_or=Translated user criteria must not contain OR criteria
ValidationVisitor.union_insert = Select into is not allowed under a set operation: {0}.
ValidationVisitor.multisource_insert = A multi-source table, {0}, cannot be used in an INSERT with query expression or SELECT INTO statement.
+ValidationVisitor.virtual_update_subquery = Subqueries are not allowed in the criteria for a virtual UPDATE/DELETE: {0}
ERR.015.012.0029 = INSERT, UPDATE, and DELETE not allowed on XML documents
ERR.015.012.0030 = Commands used in stored procedure language not allowed on XML documents
ERR.015.012.0031 = Queries against XML documents can not have a GROUP By clause
@@ -874,7 +875,9 @@
translator_not_found=Translator {0} not accessible.
datasource_not_found=Data Source {0} not accessible.
-RequestWorkItem.cache_nondeterministic=Caching command '{0}'' at a session level, but less deterministic functions were evaluated.
+RequestWorkItem.cache_nondeterministic=Caching command "{0}" at a session level, but less deterministic functions were evaluated.
not_found_cache=Results not found in cache
failed_to_unwrap_connection=Failed to unwrap the source connection.
-connection_factory_not_found=Failed to the Connection Factory with JNDI name {0}. Please check the name for spelling or deploy the Connection Factory with specified name.
\ No newline at end of file
+connection_factory_not_found=Failed to the Connection Factory with JNDI name {0}. Please check the name for spelling or deploy the Connection Factory with specified name.
+
+RelationalPlanner.nonpushdown_command=Source command "{0}" contains non-pushdown constructs.
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -381,7 +381,7 @@
List<String> values = Arrays.asList("aa "); //$NON-NLS-1$
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData2b(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, false, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, TestOptimizer.getGenericFinder(), FakeMetadataFactory.example1Cached(), null, false, false, false, FakeMetadataFactory.example1VDB());
}
@Test(expected=QueryValidatorException.class) public void testLimitValidation() throws Exception {
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -29,6 +29,7 @@
import java.util.List;
import org.junit.Test;
+import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -59,7 +60,7 @@
dataManager.addData("UPDATE pm1.g1 SET e1 = ?, e3 = ? WHERE pm1.g1.e2 = ?", new List[] {Arrays.asList(4)}); //$NON-NLS-1$
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -122,7 +123,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -218,7 +219,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -311,7 +312,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -434,7 +435,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -35,11 +35,11 @@
import org.teiid.dqp.internal.datamgr.ConnectorWorkItem;
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.dqp.message.AtomicResultsMessage;
-import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.translator.DataNotAvailableException;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.DataNotAvailableException;
/**
@@ -56,7 +56,7 @@
public AutoGenDataService() {
super("FakeConnector","FakeConnector"); //$NON-NLS-1$ //$NON-NLS-2$
- caps = new BasicSourceCapabilities();
+ caps = TestOptimizer.getTypicalCapabilities();
}
public void setRows(int rows) {
Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -31,7 +31,9 @@
import java.util.Map;
import java.util.Properties;
+import org.jboss.virtual.VirtualFile;
import org.junit.Test;
+import org.mockito.Mockito;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -42,6 +44,7 @@
import org.teiid.metadata.Table;
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.translator.TranslatorException;
@@ -71,6 +74,14 @@
MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
mf1.addProcedure("y"); //$NON-NLS-1$
+
+ Table table = mf1.addTable("doc");
+ table.setSchemaPaths(Arrays.asList("../../x.xsd"));
+ table.setResourcePath("/a/b/doc.xmi");
+
+ HashMap<String, Resource> resources = new HashMap<String, Resource>();
+ resources.put("/x.xsd", new Resource(Mockito.mock(VirtualFile.class), true));
+
CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
VDBMetaData vdb = new VDBMetaData();
@@ -79,8 +90,9 @@
vdb.addModel(buildModel("x"));
vdb.addModel(buildModel("x1"));
+ vdb.addModel(buildModel("y"));
- return new TransformationMetadata(vdb, cms, null, null, FakeMetadataFactory.SFM.getSystemFunctions());
+ return new TransformationMetadata(vdb, cms, resources, null, FakeMetadataFactory.SFM.getSystemFunctions());
}
ModelMetaData buildModel(String name) {
@@ -131,4 +143,9 @@
tm.getElementID("x.FoO.coL");
}
+ @Test public void testRelativeSchemas() throws Exception {
+ TransformationMetadata tm = exampleTransformationMetadata();
+ assertEquals(1, tm.getXMLSchemas(tm.getGroupID("x1.doc")).size());
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -268,7 +268,7 @@
String sql = "SELECT * FROM pm1.g1 limit 50, 100";//$NON-NLS-1$
String[] expectedSql = new String[] {
- "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT (100 + 50)" //$NON-NLS-1$
+ "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT 150" //$NON-NLS-1$
};
ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -535,7 +535,7 @@
String sql = "SELECT * FROM pm1.g1 UNION SELECT * FROM PM1.g2 LIMIT 50, 100";//$NON-NLS-1$
String[] expectedSql = new String[] {
- "SELECT PM1.g2.e1 AS c_0, PM1.g2.e2 AS c_1, PM1.g2.e3 AS c_2, PM1.g2.e4 AS c_3 FROM PM1.g2 LIMIT (100 + 50)", "SELECT pm1.g1.e1 AS c_0, pm1.g1.e2 AS c_1, pm1.g1.e3 AS c_2, pm1.g1.e4 AS c_3 FROM pm1.g1 LIMIT (100 + 50)" //$NON-NLS-1$ //$NON-NLS-2$
+ "SELECT PM1.g2.e1 AS c_0, PM1.g2.e2 AS c_1, PM1.g2.e3 AS c_2, PM1.g2.e4 AS c_3 FROM PM1.g2 LIMIT 150", "SELECT pm1.g1.e1 AS c_0, pm1.g1.e2 AS c_1, pm1.g1.e3 AS c_2, pm1.g1.e4 AS c_3 FROM pm1.g1 LIMIT 150" //$NON-NLS-1$ //$NON-NLS-2$
};
ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -603,7 +603,7 @@
String sql = "SELECT * from (SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 10, 100) x LIMIT 20, 75";//$NON-NLS-1$
String[] expectedSql = new String[] {
- "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT CASE WHEN (75 + (20 + 10)) < (100 + 10) THEN (75 + (20 + 10)) ELSE (100 + 10) END" //$NON-NLS-1$
+ "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT 105" //$NON-NLS-1$
};
ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -636,9 +636,9 @@
// pm1 model supports order by
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- String sql = "SELECT * from (SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 10, 100) x LIMIT 20, 75";//$NON-NLS-1$
+ String sql = "SELECT * from (SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 10, 100) x LIMIT 40, 75";//$NON-NLS-1$
String[] expectedSql = new String[] {
- "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT (20 + 10), CASE WHEN 75 < 100 THEN 75 ELSE 100 END" //$NON-NLS-1$
+ "SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT 10, 60" //$NON-NLS-1$
};
ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -792,14 +792,20 @@
new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e3 = TRUE"} ); //$NON-NLS-1$
}
- @Test public void testUpdate2() {
+ @Test public void testUpdate2() throws Exception {
+ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+ bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+ DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e2= convert(pm1.g1.e4, integer)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"} ); //$NON-NLS-1$
+ new String[] { "UPDATE pm1.g1 SET e1 = 'MyString', e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
}
- @Test public void testDelete() {
+ @Test public void testDelete() throws Exception {
+ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+ bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+ DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
helpPlan("Delete from pm1.g1 where pm1.g1.e1 = cast(pm1.g1.e2 AS string)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = cast(pm1.g1.e2 AS string)"} ); //$NON-NLS-1$
+ new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = convert(pm1.g1.e2, string)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
}
// ############################# TESTS ON EXAMPLE 1 ############################
@@ -4605,11 +4611,10 @@
checkNodeTypes(plan, FULL_PUSHDOWN);
}
- @Test public void testUpdateWithElement() {
+ @Test public void testUpdateWithElement() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
+ caps.setFunctionSupport(SourceSystemFunctions.ADD_OP, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
String sql = "UPDATE BQT1.SmallA SET IntKey = IntKey + 1"; //$NON-NLS-1$
@@ -4618,7 +4623,7 @@
FakeMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"UPDATE BQT1.SmallA SET IntKey = (IntKey + 1)"}, //$NON-NLS-1$
- SHOULD_SUCCEED );
+ ComparisonMode.EXACT_COMMAND_STRING );
checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -6729,6 +6734,11 @@
new String[] { "SELECT g_0.e1 FROM pm2.g2 AS g_0 WHERE g_0.e1 = pm2.g1.e1", "SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e2 IN (1, 2)" }, capFinder, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {1}, new Class[] {NestedTableJoinStrategy.class});
}
+
+ @Test public void testUpdatePushdownFails() {
+ helpPlan("update pm1.g1 set e1 = 1 where exists (select 1 from pm1.g2)", FakeMetadataFactory.example1Cached(), null, //$NON-NLS-1$
+ null, null, false); //$NON-NLS-1$
+ }
public static final boolean DEBUG = false;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -22,6 +22,7 @@
import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.FakeMetadataObject;
import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.translator.SourceSystemFunctions;
public class TestInsertProcessing {
@@ -33,6 +34,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
+ caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
@@ -155,8 +157,8 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
-
- caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+ caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
@@ -195,10 +197,9 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
-
caps.setCapabilitySupport(Capability.BULK_UPDATE, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.FLOAT});
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -83,7 +83,6 @@
import org.teiid.query.processor.relational.RelationalNode;
import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.resolver.QueryResolver;
-import org.teiid.query.resolver.util.BindVariableVisitor;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.SPParameter;
@@ -116,26 +115,17 @@
}
}
- public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata) {
- return helpGetPlan(sql, metadata, null);
+ public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata) {
+ return helpGetPlan(sql, metadata, new DefaultCapabilitiesFinder());
}
-
- public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata, String[] bindings) {
- if(DEBUG) System.out.println("\n####################################\n" + sql); //$NON-NLS-1$
+
+ public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata, CapabilitiesFinder finder) {
+ if(DEBUG) System.out.println("\n####################################\n" + sql); //$NON-NLS-1$
Command command = helpParse(sql);
- // attach bindings
- if(bindings != null) {
- try {
- BindVariableVisitor.bindReferences(command, Arrays.asList(bindings), metadata);
- } catch(Throwable e) {
- throw new TeiidRuntimeException(e);
- }
- }
+ ProcessorPlan process = helpGetPlan(command, metadata, finder);
- ProcessorPlan process = helpGetPlan(command, metadata);
-
return process;
}
@@ -6232,11 +6222,11 @@
String sql = "update vm1.g39 set e2=3"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
// Construct data manager with data
HardcodedDataManager dataManager = new HardcodedDataManager();
- dataManager.addData("SELECT pm1.g1.e2 FROM pm1.g1", //$NON-NLS-1$
+ dataManager.addData("SELECT g_0.e2 FROM pm1.g1 AS g_0 WHERE g_0.e2 = 3", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(3) } )});
dataManager.addData("UPDATE pm1.g1 SET e2 = 3 WHERE pm1.g1.e2 = 3", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) } )});
@@ -7331,7 +7321,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData2(dataManager);
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"SELECT pm1.g1.e1 FROM pm1.g1 LIMIT (5 + 1)"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 6"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
helpProcess(plan, dataManager, expected);
}
@@ -7574,6 +7564,21 @@
helpProcess(plan, hdm, expected);
}
-
+
+ @Test public void testStoredProcedureSubqueryInput() {
+ String sql = "exec pm1.sp2((select e2 from pm1.g1 order by e1 limit 1))"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList("b", 2),
+ };
+
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1", new List[] {Arrays.asList(1, "2"), Arrays.asList(3, "4")});
+ dataManager.addData("EXEC pm1.sp2(1)", new List[] {Arrays.asList("b", 2)});
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+
+ helpProcess(plan, dataManager, expected);
+ }
+
private static final boolean DEBUG = false;
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -25,6 +25,8 @@
import static org.teiid.query.processor.TestProcessor.*;
import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
@@ -349,6 +351,16 @@
processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("udf.xmi")));
}
+ @Test public void testXmlParseBlobWithEncoding() throws Exception {
+ String sql = "select xmlparse(document cast(? as blob)) x"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList(ObjectConverterUtil.convertToString(new InputStreamReader(new FileInputStream(UnitTestUtil.getTestDataFile("encoding.xml")), Charset.forName("ISO-8859-1")))),
+ };
+
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("encoding.xml")));
+ }
+
@Test public void testXmlTableTypes() throws Exception {
String sql = "select * from xmltable('/a' passing xmlparse(document '<a>2000-01-01T01:01:00.2-06:00</a>') columns x timestamp path 'xs:dateTime(./text())', y timestamp path '.') as x"; //$NON-NLS-1$
Timestamp ts = TimestampUtil.createTimestamp(100, 0, 1, 1, 1, 0, 200000000);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -2655,7 +2655,7 @@
String userQuery = "EXEC TEIIDSP7(1)"; //$NON-NLS-1$
HardcodedDataManager dataMgr = new HardcodedDataManager();
ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
- dataMgr.addData("VARIABLES.x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
+ dataMgr.addData("x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
dataMgr.addData("EXEC spTest11(3, null)", new List[] {Arrays.asList("1", 1, null), Arrays.asList(null, null, 4)});
List[] expected = new List[] {Arrays.asList("34")};
helpTestProcess(plan, expected, dataMgr, metadata);
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -350,7 +350,7 @@
* @param expectedParameterExpressions
* @since 4.3
*/
- private void helpResolveExec(String sql, Object[] expectedParameterExpressions) {
+ private StoredProcedure helpResolveExec(String sql, Object[] expectedParameterExpressions) {
StoredProcedure proc = (StoredProcedure)helpResolve(sql);
@@ -375,6 +375,8 @@
assertEquals(expectedParameterExpressions[i], param.getExpression());
}
}
+
+ return proc;
}
@@ -1093,7 +1095,8 @@
/** test omitting a required parameter that has a default value */
@Test public void testExecNamedParamsOmitRequiredParamWithDefaultValue() {
Object[] expectedParameterExpressions = new Object[] {new Constant("xyz"), new Constant(new Integer(666)), new Constant("YYZ")};//$NON-NLS-1$ //$NON-NLS-2$
- helpResolveExec("EXEC pm1.sq3b(\"in\" = 'xyz', in2 = 666)", expectedParameterExpressions);//$NON-NLS-1$
+ StoredProcedure sp = helpResolveExec("EXEC pm1.sq3b(\"in\" = 'xyz', in2 = 666)", expectedParameterExpressions);//$NON-NLS-1$
+ assertEquals("EXEC pm1.sq3b(\"in\" => 'xyz', in2 => 666)", sp.toString());
}
@Test public void testExecNamedParamsOptionalParamWithDefaults() {
Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -687,8 +687,12 @@
@Test public void testUpdate2() {
helpValidate("UPDATE test.group SET e0=1, e0=2", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
+ @Test public void testUpdateSubqueryCriteria() {
+ helpValidate("UPDATE vm1.g1 SET e1=1 WHERE exists (select * from vm1.g1)" , new String[] {"EXISTS (SELECT * FROM vm1.g1)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
@Test public void testUpdate3() throws Exception {
QueryMetadataInterface metadata = exampleMetadata();
Copied: trunk/engine/src/test/resources/encoding.xml (from rev 2681, branches/7.1.x/engine/src/test/resources/encoding.xml)
===================================================================
--- trunk/engine/src/test/resources/encoding.xml (rev 0)
+++ trunk/engine/src/test/resources/encoding.xml 2010-10-26 14:11:06 UTC (rev 2682)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<name>���</name>
Modified: trunk/metadata/src/main/resources/System.vdb
===================================================================
(Binary files differ)
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -42,7 +42,6 @@
import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
-import org.teiid.core.CoreConstants;
import org.teiid.core.util.FileUtils;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -106,7 +106,7 @@
return new VDBKey(vdb.getName(), vdb.getVersion());
}
- public VDBMetaData getVDB(String vdbName) throws VirtualDatabaseException {
+ public VDBMetaData getVDB(String vdbName) {
int latestVersion = 0;
for (VDBKey key:this.vdbRepo.tailMap(new VDBKey(vdbName, 0)).keySet()) {
if(!key.getName().equalsIgnoreCase(vdbName)) {
@@ -125,7 +125,7 @@
}
}
if(latestVersion == 0) {
- throw new VirtualDatabaseException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, "latest")); //$NON-NLS-1$ //$NON-NLS-2$
+ return null;
}
return getVDB(vdbName, latestVersion);
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-10-26 14:11:06 UTC (rev 2682)
@@ -48,7 +48,6 @@
import org.teiid.client.security.SessionToken;
import org.teiid.core.util.ArgCheck;
import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.dqp.service.SessionService;
import org.teiid.dqp.service.SessionServiceException;
@@ -221,19 +220,20 @@
else {
vdb = this.vdbRepository.getVDB(vdbName, Integer.parseInt(vdbVersion));
}
- } catch (VirtualDatabaseException e) {
- throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
} catch (NumberFormatException e) {
- throw new SessionServiceException(e, RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
+ throw new SessionServiceException(e, RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._3", vdbVersion)); //$NON-NLS-1$
}
if (vdb == null) {
throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._1", vdbName, vdbVersion)); //$NON-NLS-1$
}
- if (vdb.getStatus() != VDB.Status.ACTIVE || vdb.getConnectionType() == ConnectionType.NONE) {
+ if (vdb.getStatus() != VDB.Status.ACTIVE) {
throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
}
+ if (vdb.getConnectionType() == ConnectionType.NONE) {
+ throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._4", vdbName, vdbVersion)); //$NON-NLS-1$
+ }
return vdb;
}
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-10-26 14:11:06 UTC (rev 2682)
@@ -25,7 +25,9 @@
LocalBufferService.Failed_initializing_buffer_manager._8=Failed initializing buffer manager.
VDBService.VDB_does_not_exist._1=VDB \"{0}\" version \"{1}\" does not exist.
-VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not in "active" status.
+VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not in the "active" status.
+VDBService.VDB_does_not_exist._4=VDB \"{0}\" version \"{1}\" is not accepting connections.
+VDBService.VDB_does_not_exist._3=Invalid VDB version \"{0}\" - must be a positive integer.
# session service
SessionServiceImpl.invalid_session=The specified session ID "{0}" is invalid. It cannot be found in the userbase.
Modified: trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestCase3473/testGetTables.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -12,6 +12,7 @@
test SYS Tables SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
test SYS VirtualDatabases SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
test SYSADMIN MatViews SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
+test SYSADMIN VDBResources SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
test pg_catalog pg_am SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
test pg_catalog pg_attrdef SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
test pg_catalog pg_attribute SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
@@ -23,7 +24,6 @@
test pg_catalog pg_trigger SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
test pg_catalog pg_type SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
test pg_catalog pg_user SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
-test SYSADMIN VDBResources TABLE <null> <null> <null> <null> <null> <null> true
test test all_databases TABLE <null> <null> <null> <null> <null> <null> false
test test all_models TABLE <null> <null> <null> <null> <null> <null> false
test test all_tables TABLE <null> <null> <null> <null> <null> <null> false
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -30,6 +30,7 @@
QT_Ora9DS SYS Tables SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS SYS VirtualDatabases SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS SYSADMIN MatViews SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
+QT_Ora9DS SYSADMIN VDBResources SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS pg_catalog pg_am SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS pg_catalog pg_attrdef SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS pg_catalog pg_attribute SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
@@ -57,7 +58,6 @@
QT_Ora9DS BQT2 MediumB TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallA TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallB TABLE <null> <null> <null> <null> <null> <null> true
-QT_Ora9DS SYSADMIN VDBResources TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS VQT Base.Agg1 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg2 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg3 TABLE <null> <null> <null> <null> <null> <null> false
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_allTables.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -30,6 +30,7 @@
QT_Ora9DS SYS Tables SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS SYS VirtualDatabases SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS SYSADMIN MatViews SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
+QT_Ora9DS SYSADMIN VDBResources SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS pg_catalog pg_am SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS pg_catalog pg_attrdef SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS pg_catalog pg_attribute SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
@@ -57,7 +58,6 @@
QT_Ora9DS BQT2 MediumB TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallA TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallB TABLE <null> <null> <null> <null> <null> <null> true
-QT_Ora9DS SYSADMIN VDBResources TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS VQT Base.Agg1 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg2 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg3 TABLE <null> <null> <null> <null> <null> <null> false
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableMultipleTypes.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -16,7 +16,6 @@
QT_Ora9DS BQT2 MediumB TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallA TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallB TABLE <null> <null> <null> <null> <null> <null> true
-QT_Ora9DS SYSADMIN VDBResources TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS VQT Base.Agg1 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg2 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg3 TABLE <null> <null> <null> <null> <null> <null> false
@@ -50,7 +49,7 @@
QT_Ora9DS VQT Union.U9 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS XQT xqtData TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS XQT xqtFullData TABLE <null> <null> <null> <null> <null> <null> false
-Row Count : 50
+Row Count : 49
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
TABLE_CAT 12 QT_Ora9DS java.lang.String TABLE_CAT string SYS Tables 255 255 0 false true false true 1 false true true true
TABLE_SCHEM 12 QT_Ora9DS java.lang.String TABLE_SCHEM string SYS Tables 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetTables_specificTableTypes.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -16,7 +16,6 @@
QT_Ora9DS BQT2 MediumB TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallA TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS BQT2 SmallB TABLE <null> <null> <null> <null> <null> <null> true
-QT_Ora9DS SYSADMIN VDBResources TABLE <null> <null> <null> <null> <null> <null> true
QT_Ora9DS VQT Base.Agg1 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg2 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS VQT Base.Agg3 TABLE <null> <null> <null> <null> <null> <null> false
@@ -50,7 +49,7 @@
QT_Ora9DS VQT Union.U9 TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS XQT xqtData TABLE <null> <null> <null> <null> <null> <null> false
QT_Ora9DS XQT xqtFullData TABLE <null> <null> <null> <null> <null> <null> false
-Row Count : 50
+Row Count : 49
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
TABLE_CAT 12 QT_Ora9DS java.lang.String TABLE_CAT string SYS Tables 255 255 0 false true false true 1 false true true true
TABLE_SCHEM 12 QT_Ora9DS java.lang.String TABLE_SCHEM string SYS Tables 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testTables.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -12,6 +12,7 @@
PartsSupplier SYS Tables SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
PartsSupplier SYS VirtualDatabases SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
PartsSupplier SYSADMIN MatViews SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
+PartsSupplier SYSADMIN VDBResources SYSTEM TABLE <null> <null> <null> <null> <null> <null> true
PartsSupplier pg_catalog pg_am SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
PartsSupplier pg_catalog pg_attrdef SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
PartsSupplier pg_catalog pg_attribute SYSTEM TABLE <null> <null> <null> <null> <null> <null> false
@@ -28,7 +29,6 @@
PartsSupplier PartsSupplier PARTSSUPPLIER.STATUS TABLE <null> <null> <null> <null> <null> <null> true
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER TABLE <null> <null> <null> <null> <null> <null> true
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER_PARTS TABLE <null> <null> <null> <null> <null> <null> true
-PartsSupplier SYSADMIN VDBResources TABLE <null> <null> <null> <null> <null> <null> true
Row Count : 29
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
TABLE_CAT 12 PartsSupplier java.lang.String TABLE_CAT string SYS Tables 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -1,7 +1,7 @@
string string string string integer string string integer integer boolean boolean boolean boolean boolean boolean boolean string string string string string string string integer integer integer string !
string integer
VDBName SchemaName TableName Name Position NameInSource DataType Scale Length IsLengthFixed SupportsSelect SupportsUpdates IsCaseSensitive IsSigned IsCurrency IsAutoIncremented NullType MinRange MaxRange SearchType Format DefaultValue JavaClass Precision CharOctetLength Radix UID !
Description OID
PartsSupplier SYS DataTypes BaseType 17 <null> string 0 64 true true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 64 64 10 mmuuid:03beb57c-968b-4821-a6ae-cb1154cfadee !
<null> 73
-PartsSupplier SYSADMIN MatViews Cardinality 9 <null> integer 0 10 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:abe699b0-b6bc-4413-9172-0a21ca9664d2 !
<null> 25
+PartsSupplier SYSADMIN MatViews Cardinality 9 <null> integer 0 10 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:abe699b0-b6bc-4413-9172-0a21ca9664d2 !
<null> 25
PartsSupplier SYS Tables Cardinality 9 <null> integer 0 10 false true false true true false false No Nulls <null> <null> All Except Like <null> <null> java.lang.Integer 10 10 10 mmuuid:24cdad3a-e8f7-4376-bb32-79f8bc8eeed2 !
<null> 154
PartsSupplier SYS Columns CharOctetLength 25 <null> integer 0 10 true true false false false false false Nullable <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:de5def94-2804-4c91-91ed-26d630ce8afe !
<null> 52
PartsSupplier SYS ReferenceKeyColumns DEFERRABILITY 14 <null> integer 0 10 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:88380f55-2cbd-4325-b9a3-9dcaa88a690e !
<null> 138
@@ -43,10 +43,10 @@
PartsSupplier SYS KeyColumns KeyName 5 <null> string 0 255 true true false false false false false Nullable <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:da4bef58-83f4-4b88-8bb0-2dc8990be539 !
<null> 80
PartsSupplier SYS KeyColumns KeyType 6 <null> string 0 20 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 20 20 10 mmuuid:df9e15e6-ab77-486d-bfe0-0adc378aa99d !
<null> 81
PartsSupplier SYS Columns Length 9 <null> integer 0 10 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:b36ea0f6-cbff-4049-bc9c-8ec9928be048 !
<null> 36
-PartsSupplier SYSADMIN MatViews LoadState 7 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:c67365c3-f252-40f4-aae6-8971d3b1b153 !
<null> 23
+PartsSupplier SYSADMIN MatViews LoadState 7 <null> string 0 255 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:c67365c3-f252-40f4-aae6-8971d3b1b153 !
<null> 23
PartsSupplier SYS Columns MaxRange 19 <null> string 0 50 true true false false false false false Nullable <null> <null> Searchable <null> <null> java.lang.String 50 50 10 mmuuid:0b0df4a5-7de5-4315-94f7-22c84958302e !
<null> 46
PartsSupplier SYS Columns MinRange 18 <null> string 0 50 true true false false false false false Nullable <null> <null> Searchable <null> <null> java.lang.String 50 50 10 mmuuid:dba0f97d-fab5-45f6-a1eb-3459ab3fcc74 !
<null> 45
-PartsSupplier SYSADMIN MatViews Name 3 <null> string 0 255 false true true true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:0f56d35c-e450-4b4f-86b0-bdb4f1015c57 !
<null> 19
+PartsSupplier SYSADMIN MatViews Name 3 <null> string 0 255 false true false true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:0f56d35c-e450-4b4f-86b0-bdb4f1015c57 !
<null> 19
PartsSupplier SYS Columns Name 4 <null> string 0 255 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:d1f44a6d-3e39-4251-b873-1280c2b035b3 !
<null> 31
PartsSupplier SYS DataTypes Name 1 <null> string 0 100 true true false true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 100 100 10 mmuuid:17f7de33-e6f0-4b9c-b55e-a87f6b7bb9b3 !
<null> 57
PartsSupplier SYS KeyColumns Name 4 <null> string 0 255 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:08bda0c7-5f66-4fed-8285-d74b63eeb0e2 !
<null> 79
@@ -114,7 +114,7 @@
PartsSupplier SYS Columns Scale 8 <null> integer 0 10 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:cc6c6113-8d70-40c8-84c0-94e17c14e22e !
<null> 35
PartsSupplier SYS DataTypes Scale 6 <null> integer 0 10 true true false false false false false Nullable <null> <null> Searchable <null> (0) java.lang.Integer 10 10 10 mmuuid:e8655204-e97a-45cd-909b-1e37731e9546 !
<null> 62
PartsSupplier SYS ProcedureParams Scale 11 <null> integer 0 10 true true true false false false false No Nulls <null> <null> Searchable <null> (0) java.lang.Integer 10 10 10 mmuuid:360c8b1d-4b3d-42fd-952c-bf5763cad69e !
<null> 107
-PartsSupplier SYSADMIN MatViews SchemaName 2 <null> string 0 255 false true true true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:2738c484-d24d-4c40-b0b7-e734afb03450 !
<null> 18
+PartsSupplier SYSADMIN MatViews SchemaName 2 <null> string 0 255 false true false true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:2738c484-d24d-4c40-b0b7-e734afb03450 !
<null> 18
PartsSupplier SYS Columns SchemaName 2 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:859288c9-cd78-4407-90fc-61b5d310e2ab !
<null> 29
PartsSupplier SYS KeyColumns SchemaName 2 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:787be966-cf12-4956-907f-a8e6dc1009dc !
<null> 77
PartsSupplier SYS Keys SchemaName 2 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:4a7fc059-208e-4f98-b6ef-cb7c6102a327 !
<null> 87
@@ -129,8 +129,8 @@
PartsSupplier SYS Columns TableName 3 <null> string 0 255 true true false true false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:2c09c9d1-2f25-45de-81cf-eeb2a5157d34 !
<null> 30
PartsSupplier SYS KeyColumns TableName 3 <null> string 0 2048 true true false true false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 2048 2048 10 mmuuid:c24fad72-0c0d-4260-96ae-f188ad77b137 !
<null> 78
PartsSupplier SYS Keys TableName 3 <null> string 0 2048 true true false true false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 2048 2048 10 mmuuid:7d9540bd-b51f-4206-8c33-b39c5ba8bb8b !
<null> 88
-PartsSupplier SYSADMIN MatViews TargetName 5 <null> string 0 4000 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 4000 10 mmuuid:d2831595-d6f5-4cca-aa5d-2ff2530d0ab1 !
<null> 21
-PartsSupplier SYSADMIN MatViews TargetSchemaName 4 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:a95dba1c-283e-4f48-9671-34cecdb7d0e3 !
<null> 20
+PartsSupplier SYSADMIN MatViews TargetName 5 <null> string 0 4000 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 4000 10 mmuuid:d2831595-d6f5-4cca-aa5d-2ff2530d0ab1 !
<null> 21
+PartsSupplier SYSADMIN MatViews TargetSchemaName 4 <null> string 0 255 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:a95dba1c-283e-4f48-9671-34cecdb7d0e3 !
<null> 20
PartsSupplier SYS Keys Type 7 <null> string 0 20 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 20 20 10 mmuuid:29e73c18-afec-43a9-81ab-7378d6daf20b !
<null> 92
PartsSupplier SYS ProcedureParams Type 7 <null> string 0 100 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 100 100 10 mmuuid:76a1981b-1226-4a55-9acf-82a061cc8642 !
<null> 103
PartsSupplier SYS Tables Type 4 <null> string 0 20 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 20 20 10 mmuuid:4814a0af-4e8f-4f55-9b25-3148d90d3d9b !
<null> 149
@@ -147,8 +147,8 @@
PartsSupplier SYS Schemas UID 4 <null> string 0 50 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 50 50 10 mmuuid:ad232e4d-9c01-4d0c-bc57-0459d9db918a !
<null> 142
PartsSupplier SYS Tables UID 8 <null> string 0 50 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 50 50 10 mmuuid:6afe3737-26f9-43a8-88db-86531b5dc66c !
<null> 153
PartsSupplier SYS ReferenceKeyColumns UPDATE_RULE 10 <null> integer 0 10 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.Integer 10 10 10 mmuuid:30d5ae74-b19e-4186-97e1-aeff5801e44f !
<null> 134
-PartsSupplier SYSADMIN MatViews Updated 8 <null> timestamp 0 0 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.sql.Timestamp 0 0 10 mmuuid:33970a66-7ad4-411f-a6c4-545746747fe6 !
<null> 24
-PartsSupplier SYSADMIN MatViews VDBName 1 <null> string 0 255 false true true true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:c1ce9841-e272-4839-8c78-777a5f68d241 !
<null> 17
+PartsSupplier SYSADMIN MatViews Updated 8 <null> timestamp 0 0 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.sql.Timestamp 0 0 10 mmuuid:33970a66-7ad4-411f-a6c4-545746747fe6 !
<null> 24
+PartsSupplier SYSADMIN MatViews VDBName 1 <null> string 0 255 false true false true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:c1ce9841-e272-4839-8c78-777a5f68d241 !
<null> 17
PartsSupplier SYS Columns VDBName 1 <null> string 0 255 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:83f19a81-1243-4751-8c99-daddbf37b1d7 !
<null> 28
PartsSupplier SYS KeyColumns VDBName 1 <null> string 0 255 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:f062eb9c-4854-47fb-b7bd-a4e23c782b62 !
<null> 76
PartsSupplier SYS Keys VDBName 1 <null> string 0 255 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:5785b523-7da3-42c1-8920-66daa1f7fa1d !
<null> 86
@@ -156,7 +156,7 @@
PartsSupplier SYS Procedures VDBName 1 <null> string 0 255 true true false false false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:1d664747-4a95-4605-8b28-381bed3121f1 !
<null> 113
PartsSupplier SYS Schemas VDBName 1 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:73dbf95b-a283-4f0a-81b9-9b98e09c2906 !
<null> 139
PartsSupplier SYS Tables VDBName 1 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:58de905f-9d64-4831-a985-da6d082ff709 !
<null> 146
-PartsSupplier SYSADMIN MatViews Valid 6 <null> boolean 0 0 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.Boolean 0 0 10 mmuuid:13098912-bce2-4842-9ea9-b162fcd7383e !
<null> 22
+PartsSupplier SYSADMIN MatViews Valid 6 <null> boolean 0 0 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.Boolean 0 0 10 mmuuid:13098912-bce2-4842-9ea9-b162fcd7383e !
<null> 22
PartsSupplier SYS Properties Value 2 <null> string 0 255 true true false true true false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 255 255 10 mmuuid:c917257d-06b7-41dd-a6cb-44c0ff0f897e !
<null> 122
PartsSupplier SYS VirtualDatabases Version 2 <null> string 0 50 true true false true false false false No Nulls <null> <null> Searchable <null> <null> java.lang.String 50 50 10 mmuuid:c876d749-a512-4810-9910-3034ca524c45 !
<null> 160
PartsSupplier pg_catalog pg_attrdef adnum 4 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:e22c521a-e208-4181-9dbd-89f5de7014b9 !
<null> 222
@@ -172,7 +172,7 @@
PartsSupplier pg_catalog pg_attribute attrelid 2 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:3be6b5de-2287-4279-93f3-4f5064799118 !
<null> 173
PartsSupplier pg_catalog pg_attribute atttypid 4 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:99782493-1cce-4e14-9c1b-4de7ce50e2c8 !
<null> 175
PartsSupplier pg_catalog pg_attribute atttypmod 7 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:2e2bae3c-ab93-49f5-b96c-7a7b9d66782d !
<null> 178
-PartsSupplier SYSADMIN VDBResources contents 2 <null> blob 0 0 false true true true true false false Nullable <null> <null> Searchable <null> <null> org.teiid.core.types.BlobType 0 0 10 mmuuid:f9421669-3564-451d-9293-96c1e5e72c4f !
<null> 27
+PartsSupplier SYSADMIN VDBResources contents 2 <null> blob 0 0 false true false true true false false Nullable <null> <null> Searchable <null> <null> org.teiid.core.types.BlobType 0 0 10 mmuuid:f9421669-3564-451d-9293-96c1e5e72c4f !
<null> 27
PartsSupplier pg_catalog pg_database datacl 7 <null> object 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Object 0 0 0 mmuid:4b5beb14-03a0-4652-9d6f-5f8cc74d470c !
<null> 229
PartsSupplier pg_catalog pg_database datallowconn 5 <null> char 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Character 0 0 0 mmuid:c2bdf40c-ec58-439c-a403-7adf604ceadd !
<null> 227
PartsSupplier pg_catalog pg_database datconfig 6 <null> object 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Object 0 0 0 mmuid:5c9d54b2-433f-443a-85ce-821f42ed109e !
<null> 228
@@ -217,7 +217,7 @@
PartsSupplier pg_catalog pg_class relnamespace 3 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:4591ef08-bff8-4f3b-9de7-420f9c7f9d2b !
<null> 165
PartsSupplier pg_catalog pg_class relpages 7 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:44dee7d6-b6ae-44c7-85f2-e87364d8d059 !
<null> 169
PartsSupplier pg_catalog pg_class reltuples 6 <null> float 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Float 0 0 0 mmuid:b9ed4b49-5a7b-4ba4-863a-37fd95b2a34c !
<null> 168
-PartsSupplier SYSADMIN VDBResources resourcePath 1 <null> string 0 255 false true true true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:b1bc5150-3dcc-452e-9e75-4a506997f612 !
<null> 26
+PartsSupplier SYSADMIN VDBResources resourcePath 1 <null> string 0 255 false true false true true false false Nullable <null> <null> Searchable <null> <null> java.lang.String 0 255 10 mmuuid:b1bc5150-3dcc-452e-9e75-4a506997f612 !
<null> 26
PartsSupplier pg_catalog pg_trigger tgargs 4 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:250d7c06-728a-4b2a-b557-91f2a69bb184 !
<null> 213
PartsSupplier pg_catalog pg_trigger tgconstrname 8 <null> string 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.String 0 0 0 mmuid:da4b59ca-ebff-45a8-ad68-9777bc587813 !
<null> 217
PartsSupplier pg_catalog pg_trigger tgconstrrelid 2 <null> integer 0 0 false true false false false false false Unknown <null> <null> Searchable <null> <null> java.lang.Integer 0 0 0 mmuid:635b6634-632c-43c9-8cc7-bcaa016133e8 !
<null> 211
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTableIsSystem.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -5,7 +5,6 @@
PARTSSUPPLIER.STATUS
PARTSSUPPLIER.SUPPLIER
PARTSSUPPLIER.SUPPLIER_PARTS
-VDBResources
-Row Count : 6
+Row Count : 5
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
Name 12 PartsSupplier java.lang.String Name string SYS Tables 255 255 0 false true false false 0 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -4,7 +4,7 @@
PartsSupplier SYS DataTypes Table <null> true false mmuuid:9a8794f9-66f8-49e8-8576-89d212d0f957 0 <null> true false 8
PartsSupplier SYS KeyColumns Table <null> true false mmuuid:14946083-3bd5-42d5-8283-1c0694347c29 0 <null> true false 9
PartsSupplier SYS Keys Table <null> true false mmuuid:1e5135dc-ce5d-4b25-a8ff-63f5440b3108 0 <null> true false 10
-PartsSupplier SYSADMIN MatViews Table <null> true true mmuuid:520ba1e8-3553-460f-8d18-9b43f089e256 0 <null> true false 5
+PartsSupplier SYSADMIN MatViews Table <null> true false mmuuid:520ba1e8-3553-460f-8d18-9b43f089e256 0 <null> true false 5
PartsSupplier PartsSupplier PARTSSUPPLIER.PARTS Table PARTS true true mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590 16 <null> false false 0
PartsSupplier PartsSupplier PARTSSUPPLIER.SHIP_VIA Table SHIP_VIA true true mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590 4 <null> false false 1
PartsSupplier PartsSupplier PARTSSUPPLIER.STATUS Table STATUS true true mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590 3 <null> false false 2
@@ -16,7 +16,7 @@
PartsSupplier SYS ReferenceKeyColumns Table <null> true false mmuuid:6a9653e8-a337-41b2-86fa-77b98f409a29 0 <null> true false 14
PartsSupplier SYS Schemas Table <null> true false mmuuid:8648a554-b2ad-4e8e-84ca-2ec618b311a9 0 <null> true false 15
PartsSupplier SYS Tables Table <null> true false mmuuid:8551b3bd-11cc-4049-9bcf-fe91a0eb7ba7 0 <null> true false 16
-PartsSupplier SYSADMIN VDBResources Table <null> true true mmuuid:1785804d-beaf-4831-9531-e59164fedd49 0 <null> false false 6
+PartsSupplier SYSADMIN VDBResources Table <null> true false mmuuid:1785804d-beaf-4831-9531-e59164fedd49 0 <null> true false 6
PartsSupplier SYS VirtualDatabases Table <null> true false mmuuid:47297c72-d621-4f4e-af4e-74060ac5f489 0 <null> true false 17
PartsSupplier pg_catalog pg_am Table <null> false false mmuid:1462b28e-0bab-436f-9654-013821506337 0 <null> true false 23
PartsSupplier pg_catalog pg_attrdef Table <null> false false mmuid:71091853-c65e-46a9-9947-aa024f806e2d 0 <null> true false 26
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected 2010-10-26 03:49:27 UTC (rev 2681)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testVDBResources.expected 2010-10-26 14:11:06 UTC (rev 2682)
@@ -22,5 +22,5 @@
/runtime-inf/VDBS.INDEX Blob[24924]
Row Count : 20
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
-resourcePath 12 PartsSupplier java.lang.String resourcePath string SYSADMIN VDBResources 255 255 0 false true false true 1 false true true true
-contents 2004 PartsSupplier java.sql.Blob contents blob SYSADMIN VDBResources 2147483647 2147483647 0 false true false true 1 false true true true
+resourcePath 12 PartsSupplier java.lang.String resourcePath string SYSADMIN VDBResources 255 255 0 false true false false 1 true true true false
+contents 2004 PartsSupplier java.sql.Blob contents blob SYSADMIN VDBResources 2147483647 2147483647 0 false true false false 1 true true true false
14 years, 4 months
teiid SVN: r2681 - in branches/7.1.x/engine/src: main/java/org/teiid/query/optimizer/relational and 12 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-25 23:49:27 -0400 (Mon, 25 Oct 2010)
New Revision: 2681
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java
branches/7.1.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
Log:
TEIID-1322 shoring up subquery validation and processing with non-query commands
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -631,10 +631,8 @@
}
}
Class<?> returnType = null;
- List parameters = sp.getParameters();
List<Argument> translatedParameters = new ArrayList<Argument>();
- for (Iterator i = parameters.iterator(); i.hasNext();) {
- SPParameter param = (SPParameter)i.next();
+ for (SPParameter param : sp.getParameters()) {
Direction direction = Direction.IN;
switch(param.getParameterType()) {
case ParameterInfo.IN:
@@ -650,13 +648,15 @@
continue; //already part of the metadata
case ParameterInfo.RETURN_VALUE:
returnType = param.getClassType();
- break;
-
+ continue;
}
ProcedureParameter metadataParam = metadataFactory.getParameter(param);
//we can assume for now that all arguments will be literals, which may be multivalued
- Literal value = (Literal)translate(param.getExpression());
+ Literal value = null;
+ if (direction != Direction.OUT) {
+ value = (Literal)translate(param.getExpression());
+ }
Argument arg = new Argument(direction, value, param.getClassType(), metadataParam);
translatedParameters.add(arg);
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -82,6 +82,7 @@
import org.teiid.query.sql.lang.JoinType;
import org.teiid.query.sql.lang.OrderBy;
import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.TableFunctionReference;
import org.teiid.query.sql.lang.TextTable;
@@ -319,13 +320,15 @@
aNode.setShouldEvaluateExpressions(EvaluatableVisitor.needsProcessingEvaluation(command));
}
- try {
- command = (Command)command.clone();
- boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
- boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
- command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
- } catch (QueryMetadataException err) {
- throw new TeiidComponentException(err);
+ if (command instanceof QueryCommand) {
+ try {
+ command = (Command)command.clone();
+ boolean aliasGroups = modelID != null && CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder);
+ boolean aliasColumns = modelID != null && CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder);
+ command.acceptVisitor(new AliasGenerator(aliasGroups, !aliasColumns));
+ } catch (QueryMetadataException err) {
+ throw new TeiidComponentException(err);
+ }
}
aNode.setCommand(command);
aNode.setModelName(getRoutingName(node));
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -58,6 +58,8 @@
import org.teiid.query.optimizer.relational.plantree.NodeFactory;
import org.teiid.query.optimizer.relational.plantree.PlanNode;
import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
+import org.teiid.query.optimizer.relational.rules.CriteriaCapabilityValidatorVisitor;
+import org.teiid.query.optimizer.relational.rules.RuleCollapseSource;
import org.teiid.query.optimizer.relational.rules.RuleConstants;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.ProcessorPlan;
@@ -460,12 +462,6 @@
private void addNestedProcedure(PlanNode sourceNode,
ProcedureContainer container) throws TeiidComponentException,
QueryMetadataException, TeiidProcessingException {
- //plan any subqueries in criteria/parameters/values
- for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
- ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
- subqueryContainer.getCommand().setProcessorPlan(plan);
- }
-
String cacheString = "transformation/" + container.getClass().getSimpleName(); //$NON-NLS-1$
Command c = (Command)metadata.getFromMetadataCache(container.getGroup().getMetadataID(), cacheString);
if (c == null) {
@@ -501,6 +497,20 @@
//so that we know what the determinism level is.
addNestedCommand(sourceNode, container.getGroup(), container, c, false);
}
+ //plan any subqueries in criteria/parameters/values
+ for (SubqueryContainer subqueryContainer : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(container)) {
+ ProcessorPlan plan = QueryOptimizer.optimizePlan(subqueryContainer.getCommand(), metadata, null, capFinder, analysisRecord, context);
+ subqueryContainer.getCommand().setProcessorPlan(plan);
+
+ if (c == null) {
+ RuleCollapseSource.replaceCorrelatedReferences(subqueryContainer);
+ }
+ }
+
+ if (c == null && !container.getGroup().isTempGroupSymbol() &&
+ !CriteriaCapabilityValidatorVisitor.canPushLanguageObject(container, metadata.getModelID(container.getGroup().getMetadataID()), metadata, capFinder, analysisRecord)) {
+ throw new QueryPlannerException(QueryPlugin.Util.getString("RelationalPlanner.nonpushdown_command", container)); //$NON-NLS-1$
+ }
}
PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException {
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -226,7 +226,7 @@
return;
}
if (! CapabilitiesUtil.supportsScalarFunction(modelID, obj, metadata, capFinder)) {
- markInvalid(obj, obj.isImplicit()?"":"(implicit) convert" + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ markInvalid(obj, (obj.isImplicit()?"(implicit) convert":"") + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
} catch(QueryMetadataException e) {
handleException(new TeiidComponentException(e));
@@ -446,7 +446,7 @@
* @return
* @throws TeiidComponentException
*/
- static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
+ public static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
ProcessorPlan plan = subqueryContainer.getCommand().getProcessorPlan();
if (plan != null) {
if(!(plan instanceof RelationalPlan)) {
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -348,35 +348,39 @@
private void replaceCorrelatedReferences(List<SubqueryContainer> containers) {
for (SubqueryContainer container : containers) {
- RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
- if (subqueryPlan == null || !(subqueryPlan.getRootNode() instanceof AccessNode)) {
- continue;
- }
- AccessNode child = (AccessNode)subqueryPlan.getRootNode();
- Command command = child.getCommand();
- final SymbolMap map = container.getCommand().getCorrelatedReferences();
- if (map != null) {
- ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(null) {
- @Override
- public Expression replaceExpression(
- Expression element) {
- if (element instanceof Reference) {
- Reference ref = (Reference)element;
- Expression replacement = map.getMappedExpression(ref.getExpression());
- if (replacement != null) {
- return replacement;
- }
- }
- return element;
- }
- };
- DeepPostOrderNavigator.doVisit(command, visitor);
- }
- command.setProcessorPlan(container.getCommand().getProcessorPlan());
- container.setCommand(command);
+ replaceCorrelatedReferences(container);
}
}
+ public static void replaceCorrelatedReferences(SubqueryContainer container) {
+ RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
+ if (subqueryPlan == null || !(subqueryPlan.getRootNode() instanceof AccessNode)) {
+ return;
+ }
+ AccessNode child = (AccessNode)subqueryPlan.getRootNode();
+ Command command = child.getCommand();
+ final SymbolMap map = container.getCommand().getCorrelatedReferences();
+ if (map != null) {
+ ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(null) {
+ @Override
+ public Expression replaceExpression(
+ Expression element) {
+ if (element instanceof Reference) {
+ Reference ref = (Reference)element;
+ Expression replacement = map.getMappedExpression(ref.getExpression());
+ if (replacement != null) {
+ return replacement;
+ }
+ }
+ return element;
+ }
+ };
+ DeepPostOrderNavigator.doVisit(command, visitor);
+ }
+ command.setProcessorPlan(container.getCommand().getProcessorPlan());
+ container.setCommand(command);
+ }
+
private void processLimit(PlanNode node,
QueryCommand query, QueryMetadataInterface metadata) {
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -58,8 +58,10 @@
import org.teiid.query.sql.lang.GroupContext;
import org.teiid.query.sql.lang.ProcedureContainer;
import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.SubqueryContainer;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
/**
@@ -291,5 +293,15 @@
return Collections.EMPTY_MAP;
}
+
+ public static void resolveSubqueries(Command command,
+ TempMetadataAdapter metadata, AnalysisRecord analysis)
+ throws QueryResolverException, TeiidComponentException {
+ for (SubqueryContainer container : ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(command)) {
+ QueryResolver.setChildMetadata(container.getCommand(), command);
+
+ QueryResolver.resolveCommand(container.getCommand(), Collections.EMPTY_MAP, metadata.getMetadata(), analysis);
+ }
+ }
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/DeleteResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -33,6 +33,7 @@
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.resolver.ProcedureContainerResolver;
+import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Delete;
@@ -58,7 +59,7 @@
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(delete.getGroup());
ResolverVisitor.resolveLanguageObject(delete, groups, delete.getExternalGroupContexts(), metadata);
-
+ QueryResolver.resolveSubqueries(command, metadata, analysis);
}
/**
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -71,13 +71,14 @@
public void resolveProceduralCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis)
throws QueryMetadataException, QueryResolverException, TeiidComponentException {
-
// Cast to known type
Insert insert = (Insert) command;
- //variables and values must be resolved separately to account for implicitly defined temp groups
- resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
-
+ if (insert.getValues() != null) {
+ QueryResolver.resolveSubqueries(command, metadata, analysis);
+ //variables and values must be resolved separately to account for implicitly defined temp groups
+ resolveList(insert.getValues(), metadata, insert.getExternalGroupContexts(), null);
+ }
//resolve subquery if there
if(insert.getQueryExpression() != null) {
QueryResolver.setChildMetadata(insert.getQueryExpression(), command);
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/resolver/command/UpdateResolver.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -39,6 +39,7 @@
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.resolver.ProcedureContainerResolver;
+import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.resolver.VariableResolver;
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.resolver.util.ResolverVisitor;
@@ -69,6 +70,7 @@
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(update.getGroup());
ResolverVisitor.resolveLanguageObject(update, groups, update.getExternalGroupContexts(), metadata);
+ QueryResolver.resolveSubqueries(command, metadata, analysis);
}
/**
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -2330,9 +2330,12 @@
//After this method, no longer need to display named parameters
storedProcedure.setDisplayNamedParameters(false);
- for (Iterator i = storedProcedure.getInputParameters().iterator(); i.hasNext();) {
- SPParameter param = (SPParameter)i.next();
- param.setExpression(rewriteExpressionDirect(param.getExpression()));
+ for (SPParameter param : storedProcedure.getInputParameters()) {
+ if (!processing) {
+ param.setExpression(rewriteExpressionDirect(param.getExpression()));
+ } else if (!(param.getExpression() instanceof Constant)) {
+ param.setExpression(new Constant(this.evaluator.evaluate(param.getExpression(), null), param.getClassType()));
+ }
}
return storedProcedure;
}
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/sql/visitor/EvaluatableVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -34,6 +34,7 @@
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.lang.DependentSetCriteria;
import org.teiid.query.sql.lang.ExistsCriteria;
+import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.SubqueryCompareCriteria;
import org.teiid.query.sql.lang.SubquerySetCriteria;
@@ -127,6 +128,11 @@
public void visit(StoredProcedure proc){
evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
+ for (SPParameter param : proc.getInputParameters()) {
+ if (!(param.getExpression() instanceof Constant)) {
+ evaluationNotPossible(EvaluationLevel.PROCESSING);
+ }
+ }
}
public void visit(ScalarSubquery obj){
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -39,6 +39,7 @@
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.EquivalenceUtil;
@@ -192,9 +193,27 @@
public void visit(Delete obj) {
validateNoXMLUpdates(obj);
validateHasProjectedSymbols(obj);
- validateGroupSupportsUpdate(obj.getGroup());
+ GroupSymbol group = obj.getGroup();
+ validateGroupSupportsUpdate(group);
+ Criteria crit = obj.getCriteria();
+ validateVirtualUpdate(group, crit);
}
+ private void validateVirtualUpdate(GroupSymbol group,
+ Criteria crit) {
+ if (crit == null) {
+ return;
+ }
+ try {
+ if (getMetadata().isVirtualGroup(group.getMetadataID()) &&
+ !ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit).isEmpty()) {
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.virtual_update_subquery"), crit); //$NON-NLS-1$
+ }
+ } catch (TeiidException e) {
+ handleException(e);
+ }
+ }
+
public void visit(GroupBy obj) {
// Get list of all group by IDs
List groupBySymbols = obj.getSymbols();
@@ -300,6 +319,7 @@
validateHasProjectedSymbols(obj);
validateGroupSupportsUpdate(obj.getGroup());
validateUpdate(obj);
+ validateVirtualUpdate(obj.getGroup(), obj.getCriteria());
}
public void visit(Into obj) {
@@ -836,7 +856,7 @@
protected void validateSetClauseList(SetClauseList list) {
Set<ElementSymbol> dups = new HashSet<ElementSymbol>();
- HashSet changeVars = new HashSet();
+ HashSet<ElementSymbol> changeVars = new HashSet<ElementSymbol>();
for (SetClause clause : list.getClauses()) {
ElementSymbol elementID = clause.getSymbol();
if (!changeVars.add(elementID)) {
Modified: branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-26 03:49:27 UTC (rev 2681)
@@ -193,6 +193,7 @@
ValidationVisitor.limit_not_valid_for_xml=The limit clause cannot be used on an XML document query.
ValidationVisitor.translated_or=Translated user criteria must not contain OR criteria
ValidationVisitor.union_insert = Select into is not allowed under a set operation: {0}.
+ValidationVisitor.virtual_update_subquery = Subqueries are not allowed in the criteria for a virtual UPDATE/DELETE: {0}
ERR.015.012.0029 = INSERT, UPDATE, and DELETE not allowed on XML documents
ERR.015.012.0030 = Commands used in stored procedure language not allowed on XML documents
ERR.015.012.0031 = Queries against XML documents can not have a GROUP By clause
@@ -868,7 +869,9 @@
translator_not_found=Translator {0} not accessible.
datasource_not_found=Data Source {0} not accessible.
-RequestWorkItem.cache_nondeterministic=Caching command '{0}'' at a session level, but less deterministic functions were evaluated.
+RequestWorkItem.cache_nondeterministic=Caching command "{0}" at a session level, but less deterministic functions were evaluated.
not_found_cache=Results not found in cache
failed_to_unwrap_connection=Failed to unwrap the source connection.
-connection_factory_not_found=Failed to find the Connection Factory with JNDI name {0}. Please check the name or deploy the Connection Factory with specified name.
\ No newline at end of file
+connection_factory_not_found=Failed to find the Connection Factory with JNDI name {0}. Please check the name or deploy the Connection Factory with specified name.
+
+RelationalPlanner.nonpushdown_command=Source command "{0}" contains non-pushdown constructs.
\ No newline at end of file
Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -381,7 +381,7 @@
List<String> values = Arrays.asList("aa "); //$NON-NLS-1$
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData2b(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, false, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, TestOptimizer.getGenericFinder(), FakeMetadataFactory.example1Cached(), null, false, false, false, FakeMetadataFactory.example1VDB());
}
@Test(expected=QueryValidatorException.class) public void testLimitValidation() throws Exception {
Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -29,6 +29,7 @@
import java.util.List;
import org.junit.Test;
+import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -59,7 +60,7 @@
dataManager.addData("UPDATE pm1.g1 SET e1 = ?, e3 = ? WHERE pm1.g1.e2 = ?", new List[] {Arrays.asList(4)}); //$NON-NLS-1$
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -122,7 +123,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -218,7 +219,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -311,7 +312,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -434,7 +435,7 @@
// Source capabilities must support batched updates
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- BasicSourceCapabilities caps = new BasicSourceCapabilities();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -35,11 +35,11 @@
import org.teiid.dqp.internal.datamgr.ConnectorWorkItem;
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.dqp.message.AtomicResultsMessage;
-import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.translator.DataNotAvailableException;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.DataNotAvailableException;
/**
@@ -56,7 +56,7 @@
public AutoGenDataService() {
super("FakeConnector","FakeConnector"); //$NON-NLS-1$ //$NON-NLS-2$
- caps = new BasicSourceCapabilities();
+ caps = TestOptimizer.getTypicalCapabilities();
}
public void setRows(int rows) {
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -792,14 +792,20 @@
new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e3 = TRUE"} ); //$NON-NLS-1$
}
- @Test public void testUpdate2() {
+ @Test public void testUpdate2() throws Exception {
+ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+ bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+ DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e2= convert(pm1.g1.e4, integer)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"} ); //$NON-NLS-1$
+ new String[] { "UPDATE pm1.g1 SET e1 = 'MyString', e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
}
- @Test public void testDelete() {
+ @Test public void testDelete() throws Exception {
+ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+ bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
+ DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
helpPlan("Delete from pm1.g1 where pm1.g1.e1 = cast(pm1.g1.e2 AS string)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = cast(pm1.g1.e2 AS string)"} ); //$NON-NLS-1$
+ new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = convert(pm1.g1.e2, string)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
}
// ############################# TESTS ON EXAMPLE 1 ############################
@@ -4605,11 +4611,10 @@
checkNodeTypes(plan, FULL_PUSHDOWN);
}
- @Test public void testUpdateWithElement() {
+ @Test public void testUpdateWithElement() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
- caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
- caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
+ caps.setFunctionSupport(SourceSystemFunctions.ADD_OP, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
String sql = "UPDATE BQT1.SmallA SET IntKey = IntKey + 1"; //$NON-NLS-1$
@@ -4618,7 +4623,7 @@
FakeMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"UPDATE BQT1.SmallA SET IntKey = (IntKey + 1)"}, //$NON-NLS-1$
- SHOULD_SUCCEED );
+ ComparisonMode.EXACT_COMMAND_STRING );
checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -6729,6 +6734,11 @@
new String[] { "SELECT g_0.e1 FROM pm2.g2 AS g_0 WHERE g_0.e1 = pm2.g1.e1", "SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e2 IN (1, 2)" }, capFinder, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {1}, new Class[] {NestedTableJoinStrategy.class});
}
+
+ @Test public void testUpdatePushdownFails() {
+ helpPlan("update pm1.g1 set e1 = 1 where exists (select 1 from pm1.g2)", FakeMetadataFactory.example1Cached(), null, //$NON-NLS-1$
+ null, null, false); //$NON-NLS-1$
+ }
public static final boolean DEBUG = false;
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -22,6 +22,7 @@
import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.FakeMetadataObject;
import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.translator.SourceSystemFunctions;
public class TestInsertProcessing {
@@ -33,6 +34,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
+ caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
@@ -155,8 +157,8 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
-
- caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+ caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+ caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
@@ -195,10 +197,9 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
-
caps.setCapabilitySupport(Capability.BULK_UPDATE, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
+ caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.FLOAT});
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -22,14 +22,8 @@
package org.teiid.query.processor;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.teiid.query.optimizer.TestOptimizer.FULL_PUSHDOWN;
-import static org.teiid.query.optimizer.TestOptimizer.checkNodeTypes;
-import static org.teiid.query.optimizer.TestOptimizer.getTypicalCapabilities;
-import static org.teiid.query.optimizer.TestOptimizer.helpPlan;
+import static org.junit.Assert.*;
+import static org.teiid.query.optimizer.TestOptimizer.*;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -89,7 +83,6 @@
import org.teiid.query.processor.relational.RelationalNode;
import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.resolver.QueryResolver;
-import org.teiid.query.resolver.util.BindVariableVisitor;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.SPParameter;
@@ -122,29 +115,20 @@
}
}
- public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata) {
- return helpGetPlan(sql, metadata, null);
+ public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata) {
+ return helpGetPlan(sql, metadata, new DefaultCapabilitiesFinder());
}
-
- public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata, String[] bindings) {
- if(DEBUG) System.out.println("\n####################################\n" + sql); //$NON-NLS-1$
+
+ public static ProcessorPlan helpGetPlan(String sql, QueryMetadataInterface metadata, CapabilitiesFinder finder) {
+ if(DEBUG) System.out.println("\n####################################\n" + sql); //$NON-NLS-1$
Command command = helpParse(sql);
- // attach bindings
- if(bindings != null) {
- try {
- BindVariableVisitor.bindReferences(command, Arrays.asList(bindings), metadata);
- } catch(Throwable e) {
- throw new TeiidRuntimeException(e);
- }
- }
+ ProcessorPlan process = helpGetPlan(command, metadata, finder);
- ProcessorPlan process = helpGetPlan(command, metadata);
-
return process;
}
-
+
static ProcessorPlan helpGetPlan(Command command, QueryMetadataInterface metadata) {
return helpGetPlan(command, metadata, new DefaultCapabilitiesFinder());
}
@@ -6238,11 +6222,11 @@
String sql = "update vm1.g39 set e2=3"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
// Construct data manager with data
HardcodedDataManager dataManager = new HardcodedDataManager();
- dataManager.addData("SELECT pm1.g1.e2 FROM pm1.g1", //$NON-NLS-1$
+ dataManager.addData("SELECT g_0.e2 FROM pm1.g1 AS g_0 WHERE g_0.e2 = 3", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(3) } )});
dataManager.addData("UPDATE pm1.g1 SET e2 = 3 WHERE pm1.g1.e2 = 3", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) } )});
@@ -7580,6 +7564,21 @@
helpProcess(plan, hdm, expected);
}
-
+
+ @Test public void testStoredProcedureSubqueryInput() {
+ String sql = "exec pm1.sp2((select e2 from pm1.g1 order by e1 limit 1))"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList("b", 2),
+ };
+
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1", new List[] {Arrays.asList(1, "2"), Arrays.asList(3, "4")});
+ dataManager.addData("EXEC pm1.sp2(1)", new List[] {Arrays.asList("b", 2)});
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+
+ helpProcess(plan, dataManager, expected);
+ }
+
private static final boolean DEBUG = false;
}
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-25 18:30:04 UTC (rev 2680)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2010-10-26 03:49:27 UTC (rev 2681)
@@ -686,8 +686,12 @@
@Test public void testUpdate2() {
helpValidate("UPDATE test.group SET e0=1, e0=2", new String[] {"e0"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
+ @Test public void testUpdateSubqueryCriteria() {
+ helpValidate("UPDATE vm1.g1 SET e1=1 WHERE exists (select * from vm1.g1)" , new String[] {"EXISTS (SELECT * FROM vm1.g1)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
@Test public void testUpdate3() throws Exception {
QueryMetadataInterface metadata = exampleMetadata();
14 years, 4 months
teiid SVN: r2680 - in branches/7.1.x/runtime/src/main: java/org/teiid/services and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-25 14:30:04 -0400 (Mon, 25 Oct 2010)
New Revision: 2680
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-1321 separating out the exception cases when getting a particular vdb version.
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-10-25 16:56:38 UTC (rev 2679)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-10-25 18:30:04 UTC (rev 2680)
@@ -106,7 +106,7 @@
return new VDBKey(vdb.getName(), vdb.getVersion());
}
- public VDBMetaData getVDB(String vdbName) throws VirtualDatabaseException {
+ public VDBMetaData getVDB(String vdbName) {
int latestVersion = 0;
for (VDBKey key:this.vdbRepo.tailMap(new VDBKey(vdbName, 0)).keySet()) {
if(!key.getName().equalsIgnoreCase(vdbName)) {
@@ -125,7 +125,7 @@
}
}
if(latestVersion == 0) {
- throw new VirtualDatabaseException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, "latest")); //$NON-NLS-1$ //$NON-NLS-2$
+ return null;
}
return getVDB(vdbName, latestVersion);
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-10-25 16:56:38 UTC (rev 2679)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-10-25 18:30:04 UTC (rev 2680)
@@ -48,7 +48,6 @@
import org.teiid.client.security.SessionToken;
import org.teiid.core.util.ArgCheck;
import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.dqp.service.SessionService;
import org.teiid.dqp.service.SessionServiceException;
@@ -221,19 +220,20 @@
else {
vdb = this.vdbRepository.getVDB(vdbName, Integer.parseInt(vdbVersion));
}
- } catch (VirtualDatabaseException e) {
- throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
} catch (NumberFormatException e) {
- throw new SessionServiceException(e, RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
+ throw new SessionServiceException(e, RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._3", vdbVersion)); //$NON-NLS-1$
}
if (vdb == null) {
throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._1", vdbName, vdbVersion)); //$NON-NLS-1$
}
- if (vdb.getStatus() != VDB.Status.ACTIVE || vdb.getConnectionType() == ConnectionType.NONE) {
+ if (vdb.getStatus() != VDB.Status.ACTIVE) {
throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
}
+ if (vdb.getConnectionType() == ConnectionType.NONE) {
+ throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._4", vdbName, vdbVersion)); //$NON-NLS-1$
+ }
return vdb;
}
Modified: branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-10-25 16:56:38 UTC (rev 2679)
+++ branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-10-25 18:30:04 UTC (rev 2680)
@@ -25,7 +25,9 @@
LocalBufferService.Failed_initializing_buffer_manager._8=Failed initializing buffer manager.
VDBService.VDB_does_not_exist._1=VDB \"{0}\" version \"{1}\" does not exist.
-VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not in "active" status.
+VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not in the "active" status.
+VDBService.VDB_does_not_exist._4=VDB \"{0}\" version \"{1}\" is not accepting connections.
+VDBService.VDB_does_not_exist._3=Invalid VDB version \"{0}\" - must be a positive integer.
# session service
SessionServiceImpl.invalid_session=The specified session ID "{0}" is invalid. It cannot be found in the userbase.
14 years, 4 months
teiid SVN: r2679 - in trunk: api/src/main/java/org/teiid/translator and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-25 12:56:38 -0400 (Mon, 25 Oct 2010)
New Revision: 2679
Modified:
trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
trunk/engine/pom.xml
trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java
trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java
trunk/pom.xml
Log:
TEIID-1306 adding json to xml support for json integration. this adds the asl 2 json simple library from google code.
Modified: trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java 2010-10-25 16:56:38 UTC (rev 2679)
@@ -142,5 +142,7 @@
public static final String XMLCONCAT = "xmlconcat"; //$NON-NLS-1$
public static final String XMLCOMMENT = "xmlcomment"; //$NON-NLS-1$
public static final String XMLPI = "xmlpi"; //$NON-NLS-1$
+
+ public static final String JSONTOXML = "jsontoxml"; //$NON-NLS-1$
}
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-10-25 16:56:38 UTC (rev 2679)
@@ -31,6 +31,7 @@
<LI><B>Non-Recursive Common Table Expressions</B> - The WITH clause (and associated pushdown) for non-recursive queries is now supported.
<LI><B>Explicit Table Syntax</B> - TABLE x can now be used as a shortcut for SELECT * FROM x
</UL>
+ <LI><B>JSON Support</B> - JSON, which could be obtained through the ws-translator using http calls or other methods, can be converted to XML using the system function jsonToXml. XMLTABLE and other integration logic can then be used on the JSON results.
<LI><B>Transaction Statements</B> - JDBC/ODBC now accepts START TRANSACTION, COMMIT, and ROLLBACK statements to control local transactions.
<LI><B>Procedure Result Caching</B> - virtual procedure definitions may use a cache hint to cache results in the result set cache.
<LI><B>Improved Plan Caching</B> - plans used by internal materialization and stored procedure plans will be automatically cached in the prepared plan cache. Improvements were also made to reduce the memory footprint of the plans.
@@ -52,7 +53,7 @@
<h4>from 7.1</h4>
<ul>
<li>Subqueries are no longer allowed to be SELECT INTO.
- <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "integer_var = UPDATE ...; SELECT integer_var;".
+ <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "UPDATE ...; SELECT VARIABLES.ROWCOUNT;".
<li>The SYSADMIN schema was created to hold procedures and tables that should not be generally accessible. SYS and pg_catalog are now always accessible - permissions do not apply to these schemas. The SYS.getBinaryVDBResource, SYS.getCharacterVDBResource, and SYS.getVDBResourcePaths have been replaced with the
SYSADMIN.VDBResources table. The Matviews table and the refreshMatView/refreshMatViewRow procedures were also moved into SYSADMIN.
<li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
@@ -60,8 +61,8 @@
<li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
<li>Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods were removed.
<li>By default the "ENV" system function is now turned off. To enable it, edit the teiid-jboss-beans.xml configuration file.
- <li>The use of VARIABLES.ROWCOUNT is now reserved. Use a different
- <li>Direct assignments in virtual procedures using stored procedures (e.g. var = EXEC foo()) are only valid if the procedure has a return parameter and no result set.
+ <li>The use of VARIABLES.ROWCOUNT is now reserved.
+ <li>Exec statements of the form "var = EXEC foo()" are only valid if the procedure foo has a return parameter.
</ul>
<h4>from 7.0</h4>
<ul>
@@ -144,6 +145,7 @@
The following components have been updated:
<h4>From 7.1</h4>
<ul>
+ <li>json-simple 1.1 was added.
<li>Netty was upgraded to 3.2.1
</ul>
<h4>From 7.0</h4>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2010-10-25 16:56:38 UTC (rev 2679)
@@ -1916,6 +1916,44 @@
<title>XML Functions</title>
<para>XML functions provide functionality for working with XML data. </para>
<section>
+ <title>JSONTOXML</title>
+ <para>Returns an xml document from JSON.</para>
+ <para><synopsis>JSONTOXML(rootElementName, json)</synopsis></para>
+ <para>rootElementName is a string, json is in {clob, blob}. Return value is xml.</para>
+ <para>The appropriate UTF encoding (8, 16LE. 16BE, 32LE, 32BE) will be detected for JSON blobs. If another encoding is used, see the to_chars function.</para>
+ <para>The result is always a well-formed XML document.</para>
+ <para>The mapping to XML uses the following rules:
+ <itemizedlist>
+ <listitem>
+ <para>The current element name is initially the rootElementName, and becomes the object value name as the JSON structure is traversed.</para>
+ </listitem>
+ <listitem>
+ <para>All element names must be valid xml 1.1 names. Invalid names are fully escaped according to the SQLXML specification.</para>
+ </listitem>
+ <listitem>
+ <para>Each object or primitive value will be enclosed in an element with the current name.</para>
+ </listitem>
+ <listitem>
+ <para>Unless an array value is the root, it will not be enclosed in an additional element.</para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <example>
+ <title>Sample JSON to XML for jsonToXml('person', x)</title>
+ <para>JSON:</para>
+ <programlisting language="JSON">{ "firstName" : "John" , "children" : [ "Randy", "Judy" ] }</programlisting>
+ <para>XML:</para>
+ <programlisting language="XML"><![CDATA[<?xml version="1.0" ?><person><firstName>John</firstName><children>Randy</children><children>Judy<children></person>]]></programlisting>
+ </example>
+ <example>
+ <title>Sample JSON to XML for jsonToXml('person', x) with a root array.</title>
+ <para>JSON:</para>
+ <programlisting language="JSON">[{ "firstName" : "George" }, { "firstName" : "Jerry" }]</programlisting>
+ <para>XML (Notice there is an extra "person" wrapping element to keep the XML well-formed):</para>
+ <programlisting language="XML"><![CDATA[<?xml version="1.0" ?><person><person><firstName>George</firstName></person><person><firstName>Jerry</firstName></person></person>]]></programlisting>
+ </example>
+ </section>
+ <section>
<title>XMLCOMMENT</title>
<para>Returns an xml comment.</para>
<para><synopsis>XMLCOMMENT(comment)</synopsis></para>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/engine/pom.xml 2010-10-25 16:56:38 UTC (rev 2679)
@@ -86,6 +86,11 @@
<classifier>dom</classifier>
<artifactId>saxon</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ </dependency>
</dependencies>
Modified: trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java 2010-10-25 16:56:38 UTC (rev 2679)
@@ -179,6 +179,7 @@
addXmlConcat();
addXmlComment();
addXmlPi();
+ addJsonToXml();
addSecurityFunctions();
@@ -970,6 +971,19 @@
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.XML, QueryPlugin.Util.getString("SystemSource.xmlpi_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
+ private void addJsonToXml() {
+ functions.add(new FunctionMethod(SourceSystemFunctions.JSONTOXML, QueryPlugin.Util.getString("SystemSource.jsonToXml_description"), XML, XML_FUNCTION_CLASS, "jsonToXml", //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter[] {
+ new FunctionParameter("rootElementName", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.jsonToXml_param1")), //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("json", DataTypeManager.DefaultDataTypes.CLOB, QueryPlugin.Util.getString("SystemSource.jsonToXml_param2"))}, //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result", DataTypeManager.DefaultDataTypes.XML, QueryPlugin.Util.getString("SystemSource.jsonToXml_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ functions.add(new FunctionMethod(SourceSystemFunctions.JSONTOXML, QueryPlugin.Util.getString("SystemSource.jsonToXml_description"), XML, XML_FUNCTION_CLASS, "jsonToXml", //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter[] {
+ new FunctionParameter("rootElementName", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.jsonToXml_param1")), //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("json", DataTypeManager.DefaultDataTypes.BLOB, QueryPlugin.Util.getString("SystemSource.jsonToXml_param2"))}, //$NON-NLS-1$ //$NON-NLS-2$
+ new FunctionParameter("result", DataTypeManager.DefaultDataTypes.XML, QueryPlugin.Util.getString("SystemSource.jsonToXml_result")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
private void addXmlConcat() {
functions.add(new FunctionMethod(SourceSystemFunctions.XMLCONCAT, QueryPlugin.Util.getString("SystemSource.xmlconcat_description"), XML, FunctionMethod.CAN_PUSHDOWN, XML_FUNCTION_CLASS, "xmlConcat", //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter[] {
Modified: trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-10-25 16:56:38 UTC (rev 2679)
@@ -24,10 +24,14 @@
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PushbackInputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;
import java.nio.CharBuffer;
+import java.nio.charset.Charset;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
@@ -36,6 +40,7 @@
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.XMLConstants;
@@ -48,6 +53,7 @@
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.events.XMLEvent;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
@@ -69,6 +75,9 @@
import net.sf.saxon.value.DayTimeDurationValue;
import net.sf.saxon.value.TimeValue;
+import org.json.simple.parser.ContentHandler;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.ClobImpl;
@@ -91,6 +100,135 @@
*/
public class XMLSystemFunctions {
+ private static final Charset UTF_32BE = Charset.forName("UTF-32BE"); //$NON-NLS-1$
+ private static final Charset UTF_16BE = Charset.forName("UTF-16BE"); //$NON-NLS-1$
+ private static final Charset UTF_32LE = Charset.forName("UTF-32LE"); //$NON-NLS-1$
+ private static final Charset UTF_16LE = Charset.forName("UTF-16LE"); //$NON-NLS-1$
+ private static final Charset UTF_8 = Charset.forName("UTF-8"); //$NON-NLS-1$
+
+ //TODO: this could be done fully streaming without holding the intermediate xml output
+ private static final class JsonToXmlContentHandler implements
+ ContentHandler {
+ private final XMLStreamWriter streamWriter;
+ private String currentName;
+ private LinkedList<Boolean> inArray = new LinkedList<Boolean>();
+
+ private JsonToXmlContentHandler(String rootName,
+ XMLStreamWriter streamWriter) {
+ this.streamWriter = streamWriter;
+ this.currentName = rootName;
+ }
+
+ @Override
+ public boolean startObjectEntry(String key)
+ throws org.json.simple.parser.ParseException, IOException {
+ currentName = key;
+ start();
+ return true;
+ }
+
+ @Override
+ public boolean startObject() throws org.json.simple.parser.ParseException,
+ IOException {
+ if (inArray.peek()) {
+ start();
+ }
+ inArray.push(false);
+ return true;
+ }
+
+ private void start()
+ throws IOException {
+ try {
+ streamWriter.writeStartElement(escapeName(currentName, true));
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
+ }
+ }
+
+ @Override
+ public void startJSON() throws org.json.simple.parser.ParseException,
+ IOException {
+ try {
+ streamWriter.writeStartDocument();
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
+ }
+ inArray.push(false);
+ start();
+ }
+
+ @Override
+ public boolean startArray() throws org.json.simple.parser.ParseException,
+ IOException {
+ inArray.push(true);
+ return true;
+ }
+
+ @Override
+ public boolean primitive(Object value)
+ throws org.json.simple.parser.ParseException, IOException {
+ if (inArray.peek()) {
+ start();
+ }
+ if (value != null) {
+ try {
+ streamWriter.writeCharacters(value.toString());
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
+ }
+ }
+ if (inArray.peek()) {
+ end();
+ }
+ return true;
+ }
+
+ private void end()
+ throws IOException {
+ try {
+ streamWriter.writeEndElement();
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
+ }
+ }
+
+ @Override
+ public boolean endObjectEntry()
+ throws org.json.simple.parser.ParseException, IOException {
+ end();
+ return true;
+ }
+
+ @Override
+ public boolean endObject() throws org.json.simple.parser.ParseException,
+ IOException {
+ inArray.pop();
+ if (inArray.peek()) {
+ end();
+ }
+ return true;
+ }
+
+ @Override
+ public void endJSON() throws org.json.simple.parser.ParseException,
+ IOException {
+ end();
+ try {
+ streamWriter.writeEndDocument();
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
+ }
+ }
+
+ @Override
+ public boolean endArray() throws org.json.simple.parser.ParseException,
+ IOException {
+ inArray.pop();
+ return true;
+ }
+ }
+
private static final String P_OUTPUT_VALIDATE_STRUCTURE = "com.ctc.wstx.outputValidateStructure"; //$NON-NLS-1$
public static ClobType xslTransform(CommandContext context, Object xml, Object styleSheet) throws Exception {
@@ -496,5 +634,72 @@
CharsetUtils.toHex(cb, (byte)chr);
return cb.append("_").flip().toString(); //$NON-NLS-1$
}
+
+ public static SQLXML jsonToXml(CommandContext context, final String rootName, final Blob json) throws TeiidComponentException, TeiidProcessingException, SQLException, IOException {
+ InputStream is = json.getBinaryStream();
+ PushbackInputStream pStream = new PushbackInputStream(is, 4);
+ byte[] encoding = new byte[3];
+ int read = pStream.read(encoding);
+ pStream.unread(encoding, 0, read);
+ Charset charset = UTF_8;
+ if (read > 2) {
+ if (encoding[0] == 0) {
+ if (encoding[1] == 0) {
+ charset = UTF_32BE;
+ } else {
+ charset = UTF_16BE;
+ }
+ } else if (encoding[1] == 0) {
+ if (encoding[2] == 0) {
+ charset = UTF_32LE;
+ } else {
+ charset = UTF_16LE;
+ }
+ }
+ }
+ Reader r = new InputStreamReader(pStream, charset);
+ return jsonToXml(context, rootName, r);
+ }
+ public static SQLXML jsonToXml(CommandContext context, final String rootName, final Clob json) throws TeiidComponentException, TeiidProcessingException, SQLException {
+ return jsonToXml(context, rootName, json.getCharacterStream());
+ }
+
+ private static SQLXML jsonToXml(CommandContext context,
+ final String rootName, final Reader r) throws TeiidComponentException,
+ TeiidProcessingException {
+ XMLType result = new XMLType(XMLUtil.saveToBufferManager(context.getBufferManager(), new XMLTranslator() {
+
+ @Override
+ public void translate(Writer writer) throws TransformerException,
+ IOException {
+ try {
+ JSONParser parser = new JSONParser();
+ XMLOutputFactory factory = getOutputFactory();
+ final XMLStreamWriter streamWriter = factory.createXMLStreamWriter(writer);
+
+ parser.parse(r, new JsonToXmlContentHandler(escapeName(rootName, true), streamWriter));
+
+ streamWriter.flush(); //woodstox needs a flush rather than a close
+ } catch (XMLStreamException e) {
+ throw new TransformerException(e);
+ } catch (ParseException e) {
+ throw new TransformerException(e);
+ } finally {
+ try {
+ r.close();
+ } catch (IOException e) {
+
+ }
+ }
+ }
+ }));
+ result.setType(Type.DOCUMENT);
+ return result;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(Charset.availableCharsets());
+ }
+
}
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-25 16:56:38 UTC (rev 2679)
@@ -593,6 +593,10 @@
SystemSource.xmlpi_param1=Target
SystemSource.xmlpi_param2=Content
SystemSource.xmlpi_result=XML result
+SystemSource.jsonToXml_description=Create an XML document representing the given JSON.
+SystemSource.jsonToXml_param1=Root element name
+SystemSource.jsonToXml_param2=JSON
+SystemSource.jsonToXml_result=XML result
SystemSource.modifyTimeZone_description=Modify the time zone of this timestamp by adding or subtracting time
SystemSource.modifyTimeZone_param1=Timestamp
SystemSource.modifyTimeZone_param2=Starting time zone
Modified: trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java 2010-10-25 16:56:38 UTC (rev 2679)
@@ -26,19 +26,29 @@
import java.io.File;
import java.io.IOException;
+import java.nio.charset.Charset;
+import java.sql.SQLException;
+import java.sql.SQLXML;
import java.util.TimeZone;
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialException;
+
import net.sf.saxon.trans.XPathException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.SQLXMLImpl;
import org.teiid.core.types.XMLType;
import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.unittest.TimestampUtil;
+import org.teiid.query.util.CommandContext;
@SuppressWarnings("nls")
public class TestXMLSystemFunctions {
@@ -182,6 +192,32 @@
assertEquals("_u000A_", XMLSystemFunctions.escapeName(new String(new char[] {10}), true));
}
+ @Test public void testJsonToXml() throws Exception {
+ String json = "[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
+ String expected = "<?xml version=\"1.0\" ?><Array><Array>0</Array><Array><_u0031_><_u0032_><_u0033_><_u0034_><_u0034_>5</_u0034_><_u0034_><_u0036_>7</_u0036_></_u0034_></_u0034_></_u0033_></_u0032_></_u0031_></Array></Array>";
+ helpTestJson(json, "Array", expected);
+ }
+
+ private void helpTestJson(String json, String rootName, String expected)
+ throws SQLException, TeiidComponentException,
+ TeiidProcessingException, SerialException, IOException {
+ CommandContext cc = new CommandContext();
+ cc.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
+ SQLXML xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialClob(json.toCharArray()));
+ assertEquals(expected, xml.getString());
+ xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialBlob(json.getBytes(Charset.forName("UTF-8"))));
+ assertEquals(expected, xml.getString());
+ xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialBlob(json.getBytes(Charset.forName("UTF-32BE"))));
+ assertEquals(expected, xml.getString());
+ }
+
+ @Test public void testJsonToXml1() throws Exception {
+ String json = "{ \"firstName\": \"John\", \"lastName\": \"Smith\", \"age\": 25, \"address\": { \"streetAddress\": \"21 2nd Street\", \"city\": \"New York\", \"state\": \"NY\", "+
+ "\"postalCode\": \"10021\" }, \"phoneNumber\": [ { \"type\": \"home\", \"number\": \"212 555-1234\" }, { \"type\": \"fax\", \"number\": \"646 555-4567\" } ] }";
+ String expected = "<?xml version=\"1.0\" ?><Person><firstName>John</firstName><lastName>Smith</lastName><age>25</age><address><streetAddress>21 2nd Street</streetAddress><city>New York</city><state>NY</state><postalCode>10021</postalCode></address><phoneNumber><phoneNumber><type>home</type><number>212 555-1234</number></phoneNumber><number><type>fax</type><number>646 555-4567</number></number></phoneNumber></Person>";
+ helpTestJson(json, "Person", expected);
+ }
+
@BeforeClass static public void setUpOnce() {
TimeZone.setDefault(TimeZone.getTimeZone("GMT-6:00"));
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-10-25 16:31:58 UTC (rev 2678)
+++ trunk/pom.xml 2010-10-25 16:56:38 UTC (rev 2679)
@@ -456,6 +456,11 @@
<artifactId>ant</artifactId>
<version>${ant.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<modules>
14 years, 4 months