teiid SVN: r3285 - in branches/7.4.x/engine/src: main/java/org/teiid/query/validator and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-28 15:58:01 -0400 (Tue, 28 Jun 2011)
New Revision: 3285
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java
branches/7.4.x/engine/src/main/java/org/teiid/query/validator/AggregateValidationVisitor.java
branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties
branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
Log:
TEIID-1661 fix for aggregate validation
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java 2011-06-28 14:44:55 UTC (rev 3284)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/sql/symbol/QueryString.java 2011-06-28 19:58:01 UTC (rev 3285)
@@ -30,7 +30,7 @@
import org.teiid.query.sql.visitor.SQLStringVisitor;
/**
- * Represents XMLATTRIBUTES name value pairs
+ * Represents query string name value pairs
*/
public class QueryString implements Expression {
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/validator/AggregateValidationVisitor.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/validator/AggregateValidationVisitor.java 2011-06-28 14:44:55 UTC (rev 3284)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/validator/AggregateValidationVisitor.java 2011-06-28 19:58:01 UTC (rev 3285)
@@ -28,6 +28,13 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.query.QueryPlugin;
import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.lang.BetweenCriteria;
+import org.teiid.query.sql.lang.CompareCriteria;
+import org.teiid.query.sql.lang.CompoundCriteria;
+import org.teiid.query.sql.lang.IsNullCriteria;
+import org.teiid.query.sql.lang.MatchCriteria;
+import org.teiid.query.sql.lang.NotCriteria;
+import org.teiid.query.sql.lang.SetCriteria;
import org.teiid.query.sql.navigator.PreOrderNavigator;
import org.teiid.query.sql.symbol.AggregateSymbol;
import org.teiid.query.sql.symbol.CaseExpression;
@@ -35,7 +42,13 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.ExpressionSymbol;
import org.teiid.query.sql.symbol.Function;
+import org.teiid.query.sql.symbol.QueryString;
import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.symbol.XMLElement;
+import org.teiid.query.sql.symbol.XMLForest;
+import org.teiid.query.sql.symbol.XMLParse;
+import org.teiid.query.sql.symbol.XMLQuery;
+import org.teiid.query.sql.symbol.XMLSerialize;
import org.teiid.query.sql.symbol.AggregateSymbol.Type;
import org.teiid.query.sql.visitor.AggregateSymbolCollectorVisitor;
import org.teiid.query.sql.visitor.ElementCollectorVisitor;
@@ -112,6 +125,70 @@
validateExpression(obj);
}
+ public void visit(NotCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(CompoundCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(CompareCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(SetCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(IsNullCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(MatchCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(BetweenCriteria obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(QueryString obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(XMLElement obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(XMLForest obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(XMLParse obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(XMLQuery obj) {
+ validateExpression(obj);
+ }
+
+ @Override
+ public void visit(XMLSerialize obj) {
+ validateExpression(obj);
+ }
+
private void validateExpression(Expression symbol) {
if (ElementCollectorVisitor.getElements(symbol, false).isEmpty()) {
validateBelow = false;
Modified: branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-28 14:44:55 UTC (rev 3284)
+++ branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-28 19:58:01 UTC (rev 3285)
@@ -204,8 +204,8 @@
ERR.015.012.0033 = Metadata does not allow updates on the group: {0}
ERR.015.012.0034 = Queries involving UNIONs, INTERSECTs and EXCEPTs not allowed on XML documents
ERR.015.012.0035 = Queries combined with the set operator {0} must have the same number of output elements.
-ERR.015.012.0037 = Invalid symbol: {0}. When an aggregate function is used in the SELECT clause and no GROUP BY clause is specified, the SELECT clause may contain only aggregate functions and constants.
-ERR.015.012.0038 = Invalid symbol: {0}. When a GROUP BY clause is used, all elements in the SELECT clause must be declared in the GROUP BY clause.
+ERR.015.012.0037 = Non-constant, non-aggregate expression {0} cannot be mixed with aggregate functions and implicit grouping.
+ERR.015.012.0038 = Non-constant, non-aggregate expression {0} is not declared in the GROUP BY clause.
ERR.015.012.0039 = Nested aggregate expressions are not allowed: {0}
ERR.015.012.0041 = The aggregate function {0} cannot be used with non-numeric expressions: {1}
AggregateValidationVisitor.non_comparable = The aggregate function {0} cannot be used with non-comparable expressions: {1}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-06-28 14:44:55 UTC (rev 3284)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-06-28 19:58:01 UTC (rev 3285)
@@ -419,6 +419,14 @@
new String[] {"COUNT(DISTINCT ObjectValue)"}, RealMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
}
+ /**
+ * previously failed on stringkey, which is not entirely correct
+ */
+ @Test public void testInvalidAggregate10() {
+ helpValidate("SELECT xmlparse(document stringkey) FROM BQT1.SmallA GROUP BY xmlparse(document stringkey)", //$NON-NLS-1$
+ new String[] {"XMLPARSE(DOCUMENT stringkey)"}, RealMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
+ }
+
@Test public void testInvalidAggregateIssue190644() {
helpValidate("SELECT e3 + 1 from pm1.g1 GROUP BY e2 + 1 HAVING e2 + 1 = 5", new String[] {"e3"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -436,6 +444,11 @@
"FROM BQT1.SmallA GROUP BY case when IntKey>=5000 then '5000 +' else '0-999' end", //$NON-NLS-1$
new String[] {}, RealMetadataFactory.exampleBQTCached());
}
+
+ @Test public void testValidAggregate4() {
+ helpValidate("SELECT max(e1), e2 is null from pm1.g1 GROUP BY e2 is null", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
+ }
+
@Test public void testInvalidHaving1() {
helpValidate("SELECT e3 FROM test.group HAVING e3 > 0", new String[] {"e3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
}
13 years, 5 months
teiid SVN: r3284 - in trunk: adminshell and 37 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-28 10:44:55 -0400 (Tue, 28 Jun 2011)
New Revision: 3284
Modified:
trunk/adminshell/pom.xml
trunk/api/pom.xml
trunk/build/pom.xml
trunk/cache-jbosscache/pom.xml
trunk/client-jdk15/pom.xml
trunk/client/pom.xml
trunk/common-core/pom.xml
trunk/connectors/connector-file/pom.xml
trunk/connectors/connector-ldap/pom.xml
trunk/connectors/connector-salesforce/pom.xml
trunk/connectors/connector-ws/pom.xml
trunk/connectors/pom.xml
trunk/connectors/salesforce-api/pom.xml
trunk/connectors/sandbox/pom.xml
trunk/connectors/sandbox/translator-yahoo/pom.xml
trunk/connectors/translator-file/pom.xml
trunk/connectors/translator-jdbc/pom.xml
trunk/connectors/translator-ldap/pom.xml
trunk/connectors/translator-loopback/pom.xml
trunk/connectors/translator-olap/pom.xml
trunk/connectors/translator-salesforce/pom.xml
trunk/connectors/translator-ws/pom.xml
trunk/console/pom.xml
trunk/documentation/admin-guide/pom.xml
trunk/documentation/caching-guide/pom.xml
trunk/documentation/client-developers-guide/pom.xml
trunk/documentation/developer-guide/pom.xml
trunk/documentation/pom.xml
trunk/documentation/quick-start-example/pom.xml
trunk/documentation/reference/pom.xml
trunk/engine/pom.xml
trunk/hibernate-dialect/pom.xml
trunk/jboss-integration/pom.xml
trunk/metadata/pom.xml
trunk/pom.xml
trunk/runtime/pom.xml
trunk/test-integration/common/pom.xml
trunk/test-integration/db/pom.xml
trunk/test-integration/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/adminshell/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: trunk/api/pom.xml
===================================================================
--- trunk/api/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/api/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/build/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: trunk/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/cache-jbosscache/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/client/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: trunk/client-jdk15/pom.xml
===================================================================
--- trunk/client-jdk15/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/client-jdk15/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: trunk/common-core/pom.xml
===================================================================
--- trunk/common-core/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/common-core/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: trunk/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-file/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/connector-file/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: trunk/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/connector-ldap/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: trunk/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/connector-salesforce/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: trunk/connectors/connector-ws/pom.xml
===================================================================
--- trunk/connectors/connector-ws/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/connector-ws/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/connectors/salesforce-api/pom.xml
===================================================================
--- trunk/connectors/salesforce-api/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/salesforce-api/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: trunk/connectors/sandbox/pom.xml
===================================================================
--- trunk/connectors/sandbox/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/sandbox/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: trunk/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: trunk/connectors/translator-file/pom.xml
===================================================================
--- trunk/connectors/translator-file/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-file/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: trunk/connectors/translator-jdbc/pom.xml
===================================================================
--- trunk/connectors/translator-jdbc/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-jdbc/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: trunk/connectors/translator-ldap/pom.xml
===================================================================
--- trunk/connectors/translator-ldap/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-ldap/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: trunk/connectors/translator-loopback/pom.xml
===================================================================
--- trunk/connectors/translator-loopback/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-loopback/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: trunk/connectors/translator-olap/pom.xml
===================================================================
--- trunk/connectors/translator-olap/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-olap/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: trunk/connectors/translator-salesforce/pom.xml
===================================================================
--- trunk/connectors/translator-salesforce/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-salesforce/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: trunk/connectors/translator-ws/pom.xml
===================================================================
--- trunk/connectors/translator-ws/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/connectors/translator-ws/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/console/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/documentation/admin-guide/pom.xml
===================================================================
--- trunk/documentation/admin-guide/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/admin-guide/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: trunk/documentation/caching-guide/pom.xml
===================================================================
--- trunk/documentation/caching-guide/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/caching-guide/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>caching-guide</artifactId>
Modified: trunk/documentation/client-developers-guide/pom.xml
===================================================================
--- trunk/documentation/client-developers-guide/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/client-developers-guide/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: trunk/documentation/developer-guide/pom.xml
===================================================================
--- trunk/documentation/developer-guide/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/developer-guide/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: trunk/documentation/pom.xml
===================================================================
--- trunk/documentation/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/documentation/quick-start-example/pom.xml
===================================================================
--- trunk/documentation/quick-start-example/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/quick-start-example/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: trunk/documentation/reference/pom.xml
===================================================================
--- trunk/documentation/reference/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/documentation/reference/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/engine/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: trunk/hibernate-dialect/pom.xml
===================================================================
--- trunk/hibernate-dialect/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/hibernate-dialect/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/jboss-integration/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/metadata/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -5,15 +5,15 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.5.0.Beta1</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-7.5.0.Beta1</developerConnection>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
</scm>
<licenses>
<license>
Modified: trunk/runtime/pom.xml
===================================================================
--- trunk/runtime/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/runtime/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/test-integration/common/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/test-integration/db/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2011-06-28 14:44:10 UTC (rev 3283)
+++ trunk/test-integration/pom.xml 2011-06-28 14:44:55 UTC (rev 3284)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Beta1</version>
+ <version>7.5.0.Beta2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
13 years, 6 months
teiid SVN: r3283 - tags.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-28 10:44:10 -0400 (Tue, 28 Jun 2011)
New Revision: 3283
Added:
tags/teiid-parent-7.5.0.Beta1/
Log:
[maven-release-plugin] copy for tag teiid-parent-7.5.0.Beta1
13 years, 6 months
teiid SVN: r3282 - in trunk: adminshell and 37 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-28 10:43:50 -0400 (Tue, 28 Jun 2011)
New Revision: 3282
Modified:
trunk/adminshell/pom.xml
trunk/api/pom.xml
trunk/build/pom.xml
trunk/cache-jbosscache/pom.xml
trunk/client-jdk15/pom.xml
trunk/client/pom.xml
trunk/common-core/pom.xml
trunk/connectors/connector-file/pom.xml
trunk/connectors/connector-ldap/pom.xml
trunk/connectors/connector-salesforce/pom.xml
trunk/connectors/connector-ws/pom.xml
trunk/connectors/pom.xml
trunk/connectors/salesforce-api/pom.xml
trunk/connectors/sandbox/pom.xml
trunk/connectors/sandbox/translator-yahoo/pom.xml
trunk/connectors/translator-file/pom.xml
trunk/connectors/translator-jdbc/pom.xml
trunk/connectors/translator-ldap/pom.xml
trunk/connectors/translator-loopback/pom.xml
trunk/connectors/translator-olap/pom.xml
trunk/connectors/translator-salesforce/pom.xml
trunk/connectors/translator-ws/pom.xml
trunk/console/pom.xml
trunk/documentation/admin-guide/pom.xml
trunk/documentation/caching-guide/pom.xml
trunk/documentation/client-developers-guide/pom.xml
trunk/documentation/developer-guide/pom.xml
trunk/documentation/pom.xml
trunk/documentation/quick-start-example/pom.xml
trunk/documentation/reference/pom.xml
trunk/engine/pom.xml
trunk/hibernate-dialect/pom.xml
trunk/jboss-integration/pom.xml
trunk/metadata/pom.xml
trunk/pom.xml
trunk/runtime/pom.xml
trunk/test-integration/common/pom.xml
trunk/test-integration/db/pom.xml
trunk/test-integration/pom.xml
Log:
[maven-release-plugin] prepare release teiid-parent-7.5.0.Beta1
Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/adminshell/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: trunk/api/pom.xml
===================================================================
--- trunk/api/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/api/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/build/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: trunk/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/cache-jbosscache/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/client/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: trunk/client-jdk15/pom.xml
===================================================================
--- trunk/client-jdk15/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/client-jdk15/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: trunk/common-core/pom.xml
===================================================================
--- trunk/common-core/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/common-core/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: trunk/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-file/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/connector-file/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: trunk/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/connector-ldap/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: trunk/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/connector-salesforce/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: trunk/connectors/connector-ws/pom.xml
===================================================================
--- trunk/connectors/connector-ws/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/connector-ws/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/connectors/salesforce-api/pom.xml
===================================================================
--- trunk/connectors/salesforce-api/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/salesforce-api/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: trunk/connectors/sandbox/pom.xml
===================================================================
--- trunk/connectors/sandbox/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/sandbox/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: trunk/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: trunk/connectors/translator-file/pom.xml
===================================================================
--- trunk/connectors/translator-file/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-file/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: trunk/connectors/translator-jdbc/pom.xml
===================================================================
--- trunk/connectors/translator-jdbc/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-jdbc/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: trunk/connectors/translator-ldap/pom.xml
===================================================================
--- trunk/connectors/translator-ldap/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-ldap/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: trunk/connectors/translator-loopback/pom.xml
===================================================================
--- trunk/connectors/translator-loopback/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-loopback/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: trunk/connectors/translator-olap/pom.xml
===================================================================
--- trunk/connectors/translator-olap/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-olap/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: trunk/connectors/translator-salesforce/pom.xml
===================================================================
--- trunk/connectors/translator-salesforce/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-salesforce/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: trunk/connectors/translator-ws/pom.xml
===================================================================
--- trunk/connectors/translator-ws/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/connectors/translator-ws/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/console/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/documentation/admin-guide/pom.xml
===================================================================
--- trunk/documentation/admin-guide/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/admin-guide/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: trunk/documentation/caching-guide/pom.xml
===================================================================
--- trunk/documentation/caching-guide/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/caching-guide/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>caching-guide</artifactId>
Modified: trunk/documentation/client-developers-guide/pom.xml
===================================================================
--- trunk/documentation/client-developers-guide/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/client-developers-guide/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: trunk/documentation/developer-guide/pom.xml
===================================================================
--- trunk/documentation/developer-guide/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/developer-guide/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: trunk/documentation/pom.xml
===================================================================
--- trunk/documentation/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/documentation/quick-start-example/pom.xml
===================================================================
--- trunk/documentation/quick-start-example/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/quick-start-example/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: trunk/documentation/reference/pom.xml
===================================================================
--- trunk/documentation/reference/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/documentation/reference/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/engine/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: trunk/hibernate-dialect/pom.xml
===================================================================
--- trunk/hibernate-dialect/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/hibernate-dialect/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/jboss-integration/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/metadata/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -5,15 +5,15 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.5.0.Beta1</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-7.5.0.Beta1</developerConnection>
</scm>
<licenses>
<license>
Modified: trunk/runtime/pom.xml
===================================================================
--- trunk/runtime/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/runtime/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/test-integration/common/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/test-integration/db/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2011-06-28 14:21:51 UTC (rev 3281)
+++ trunk/test-integration/pom.xml 2011-06-28 14:43:50 UTC (rev 3282)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha2-SNAPSHOT</version>
+ <version>7.5.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
13 years, 6 months
teiid SVN: r3281 - in branches/7.4.x: build/kits/jboss-container and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-28 10:21:51 -0400 (Tue, 28 Jun 2011)
New Revision: 3281
Modified:
branches/7.4.x/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
Log:
TEIID-1616 switching teradata to use positional ordering
Modified: branches/7.4.x/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
===================================================================
--- branches/7.4.x/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java 2011-06-28 03:47:29 UTC (rev 3280)
+++ branches/7.4.x/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java 2011-06-28 14:21:51 UTC (rev 3281)
@@ -272,8 +272,7 @@
if(elementID != null) {
elemShortName = getName(elementID);
} else {
- String elementName = obj.getName();
- elemShortName = getShortName(elementName);
+ elemShortName = obj.getName();
}
// Check whether a subclass wants to replace the element name to use in special circumstances
Modified: branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2011-06-28 03:47:29 UTC (rev 3280)
+++ branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2011-06-28 14:21:51 UTC (rev 3281)
@@ -71,6 +71,11 @@
<li>Support for using the FROM clause post item hints MAKEDEP/MAKENOTDEP has been deprecated. Use the pre item comment hint syntax instead, e.g. /*+ MAKEDEP */ tbl
</ul>
+<h4>from 7.4</h4>
+<ul>
+ <li>ColumnReference.getName will always return just the element name. Previously it inconsistently returned the qualified and unqualified form depending upon where the ColumnReference appeared.
+</ul>
+
<h4>from 7.3</h4>
<ul>
<li>SYS.PROPERTIES has a new column, ClobValue, to get values exceeding the max string length
Modified: branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java 2011-06-28 03:47:29 UTC (rev 3280)
+++ branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java 2011-06-28 14:21:51 UTC (rev 3281)
@@ -29,13 +29,21 @@
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.teiid.language.ColumnReference;
+import org.teiid.language.Command;
+import org.teiid.language.DerivedColumn;
import org.teiid.language.Expression;
import org.teiid.language.Function;
import org.teiid.language.LanguageFactory;
import org.teiid.language.Literal;
+import org.teiid.language.QueryExpression;
+import org.teiid.language.Select;
+import org.teiid.language.SortSpecification;
+import org.teiid.translator.ExecutionContext;
import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorException;
@@ -292,8 +300,37 @@
}
@Override
- public boolean supportsSetQueryOrderBy() {
- return false;
+ public List<?> translateCommand(Command command, ExecutionContext context) {
+ if (command instanceof QueryExpression) {
+ QueryExpression qe = (QueryExpression)command;
+ //teradata prefers positional ordering
+ if (qe.getOrderBy() != null) {
+ Select select = qe.getProjectedQuery();
+ List<DerivedColumn> derivedColumns = select.getDerivedColumns();
+ Map<String, Integer> positions = new HashMap<String, Integer>();
+ int i = 1;
+ for (DerivedColumn derivedColumn : derivedColumns) {
+ String name = derivedColumn.getAlias();
+ if (name == null && derivedColumn.getExpression() instanceof ColumnReference) {
+ ColumnReference cr = (ColumnReference)derivedColumn.getExpression();
+ name = cr.toString();
+ }
+ positions.put(name, i++);
+ }
+ for (SortSpecification ss : qe.getOrderBy().getSortSpecifications()) {
+ Expression ex = ss.getExpression();
+ if (!(ex instanceof ColumnReference)) {
+ continue;
+ }
+ ColumnReference cr = (ColumnReference)ex;
+ Integer position = positions.get(cr.toString());
+ if (position != null) {
+ ss.setExpression(new Literal(position, TypeFacility.RUNTIME_TYPES.INTEGER));
+ }
+ }
+ }
+ }
+ return super.translateCommand(command, context);
}
public static class LocateModifier extends FunctionModifier {
Modified: branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java 2011-06-28 03:47:29 UTC (rev 3280)
+++ branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java 2011-06-28 14:21:51 UTC (rev 3281)
@@ -21,7 +21,7 @@
*/
package org.teiid.translator.jdbc.teradata;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import java.sql.Date;
import java.sql.Timestamp;
@@ -31,6 +31,8 @@
import org.junit.BeforeClass;
import org.junit.Test;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.language.Command;
import org.teiid.language.Expression;
import org.teiid.language.Function;
import org.teiid.language.In;
@@ -88,29 +90,55 @@
@Test public void testSubString() throws Exception {
String input = "SELECT intkey FROM BQT1.SmallA WHERE SUBSTRING(BQT1.SmallA.IntKey, 1) = '1' ORDER BY intkey";
- String output = "SELECT SmallA.IntKey FROM SmallA WHERE substr(cast(SmallA.IntKey AS varchar(100)),1) = '1' ORDER BY SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey FROM SmallA WHERE substr(cast(SmallA.IntKey AS varchar(100)),1) = '1' ORDER BY 1";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
@Test public void testSubString2() throws Exception {
String input = "SELECT intkey FROM BQT1.SmallA WHERE SUBSTRING(BQT1.SmallA.IntKey, 1, 2) = '1' ORDER BY intkey";
- String output = "SELECT SmallA.IntKey FROM SmallA WHERE substr(cast(SmallA.IntKey AS varchar(100)),1,2) = '1' ORDER BY SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey FROM SmallA WHERE substr(cast(SmallA.IntKey AS varchar(100)),1,2) = '1' ORDER BY 1";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
@Test public void testDateToString() throws Exception {
String input = "SELECT intkey, UPPER(timevalue) AS UPPER FROM BQT1.SmallA ORDER BY intkey";
- String output = "SELECT SmallA.IntKey, UPPER(cast(cast(SmallA.TimeValue AS FORMAT 'HH:MI:SS') AS VARCHAR(9))) AS UPPER FROM SmallA ORDER BY SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey, UPPER(cast(cast(SmallA.TimeValue AS FORMAT 'HH:MI:SS') AS VARCHAR(9))) AS UPPER FROM SmallA ORDER BY 1";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
@Test public void testLocate() throws Exception {
String input = "SELECT INTKEY, BIGDECIMALVALUE FROM BQT1.SmallA WHERE LOCATE('-', BIGDECIMALVALUE) = 1 ORDER BY intkey";
- String output = "SELECT SmallA.IntKey, SmallA.BigDecimalValue FROM SmallA WHERE position('-' in cast(SmallA.BigDecimalValue AS varchar(100))) = 1 ORDER BY SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey, SmallA.BigDecimalValue FROM SmallA WHERE position('-' in cast(SmallA.BigDecimalValue AS varchar(100))) = 1 ORDER BY 1";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
+ @Test public void testPositionalOrderBy() throws Exception {
+ String input = "SELECT INTKEY, BIGDECIMALVALUE FROM BQT1.SmallA ORDER BY intkey";
+ String output = "SELECT g_0.IntKey AS c_0, g_0.BigDecimalValue AS c_1 FROM SmallA AS g_0 ORDER BY 1";
+
+ TranslationUtility tu = TranslationHelper.getTranslationUtility(TranslationHelper.BQT_VDB, null);
+ Command command = tu.parseCommand(input, true, true);
+ TranslationHelper.helpTestVisitor(output, TRANSLATOR, command);
+ }
+ @Test public void testPositionalOrderByUnion() throws Exception {
+ String input = "SELECT a as b, b as a from (SELECT intkey as a, stringkey as b from BQT1.smalla union SELECT intkey as a, stringkey as b from BQT1.smalla) as x order by a";
+ String output = "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_1.IntKey AS c_0, g_1.StringKey AS c_1 FROM SmallA AS g_1 UNION SELECT g_0.IntKey AS c_0, g_0.StringKey AS c_1 FROM SmallA AS g_0) AS v_0 ORDER BY 2";
+
+ TranslationUtility tu = TranslationHelper.getTranslationUtility(TranslationHelper.BQT_VDB, null);
+ Command command = tu.parseCommand(input, true, true);
+ TranslationHelper.helpTestVisitor(output, TRANSLATOR, command);
+ }
+
+ @Test public void testPositionalOrderByUnion1() throws Exception {
+ String input = "SELECT a as b from (SELECT intkey as a, stringkey as b from BQT1.smalla union SELECT intkey as a, stringkey as b from BQT1.smalla) as x order by x.b";
+ String output = "SELECT v_0.c_0 FROM (SELECT g_1.IntKey AS c_0, g_1.StringKey AS c_1 FROM SmallA AS g_1 UNION SELECT g_0.IntKey AS c_0, g_0.StringKey AS c_1 FROM SmallA AS g_0) AS v_0 ORDER BY v_0.c_1";
+
+ TranslationUtility tu = TranslationHelper.getTranslationUtility(TranslationHelper.BQT_VDB, null);
+ Command command = tu.parseCommand(input, true, true);
+ TranslationHelper.helpTestVisitor(output, TRANSLATOR, command);
+ }
+
@Test public void testByteToString() throws Exception {
helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "cast(1 AS varchar(4000))");
}
@@ -194,13 +222,13 @@
@Test public void testRightFunction() throws Exception {
String input = "SELECT INTKEY, FLOATNUM FROM BQT1.SmallA WHERE right(FLOATNUM, 2) <> 0 ORDER BY INTKEY";
- String out = "SELECT SmallA.IntKey, SmallA.FloatNum FROM SmallA WHERE substr(cast(SmallA.FloatNum AS varchar(100)),(character_length(cast(SmallA.FloatNum AS varchar(100)))-2+1)) <> '0' ORDER BY SmallA.IntKey";
+ String out = "SELECT SmallA.IntKey, SmallA.FloatNum FROM SmallA WHERE substr(cast(SmallA.FloatNum AS varchar(100)),(character_length(cast(SmallA.FloatNum AS varchar(100)))-2+1)) <> '0' ORDER BY 1";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null, input, out, TRANSLATOR);
}
@Test public void testLocateFunction() throws Exception {
String input = "SELECT INTKEY, STRINGKEY, SHORTVALUE FROM BQT1.SmallA WHERE (LOCATE(0, STRINGKEY) = 2) OR (LOCATE(2, SHORTVALUE, 4) = 6) ORDER BY intkey";
- String out = "SELECT SmallA.IntKey, SmallA.StringKey, SmallA.ShortValue FROM SmallA WHERE position('0' in SmallA.StringKey) = 2 OR position('2' in substr(cast(SmallA.ShortValue AS varchar(100)),4)) = 6 ORDER BY SmallA.IntKey";
+ String out = "SELECT SmallA.IntKey, SmallA.StringKey, SmallA.ShortValue FROM SmallA WHERE position('0' in SmallA.StringKey) = 2 OR position('2' in substr(cast(SmallA.ShortValue AS varchar(100)),4)) = 6 ORDER BY 1";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null, input, out, TRANSLATOR);
}
}
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2011-06-28 03:47:29 UTC (rev 3280)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2011-06-28 14:21:51 UTC (rev 3281)
@@ -115,6 +115,7 @@
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.symbol.ScalarSubquery;
import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.symbol.SelectSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.translator.TranslatorException;
@@ -179,9 +180,9 @@
/* Query */
Select translate(Query query) {
- List symbols = query.getSelect().getSymbols();
+ List<SelectSymbol> symbols = query.getSelect().getSymbols();
List<DerivedColumn> translatedSymbols = new ArrayList<DerivedColumn>(symbols.size());
- for (Iterator i = symbols.iterator(); i.hasNext();) {
+ for (Iterator<SelectSymbol> i = symbols.iterator(); i.hasNext();) {
SingleElementSymbol symbol = (SingleElementSymbol)i.next();
String alias = null;
if(symbol instanceof AliasSymbol) {
@@ -375,7 +376,7 @@
In translate(SetCriteria criteria) {
Collection expressions = criteria.getValues();
- List translatedExpressions = new ArrayList();
+ List<org.teiid.language.Expression> translatedExpressions = new ArrayList<org.teiid.language.Expression>();
for (Iterator i = expressions.iterator(); i.hasNext();) {
translatedExpressions.add(translate((Expression)i.next()));
}
@@ -423,13 +424,13 @@
return new SubqueryComparison(translate(criteria.getLeftExpression()),
operator,
quantifier,
- translate((QueryCommand)criteria.getCommand()));
+ translate(criteria.getCommand()));
}
SubqueryIn translate(SubquerySetCriteria criteria) {
return new SubqueryIn(translate(criteria.getExpression()),
criteria.isNegated(),
- translate((QueryCommand)criteria.getCommand()));
+ translate(criteria.getCommand()));
}
Not translate(NotCriteria criteria) {
@@ -462,7 +463,7 @@
if(items.get(i).isUnrelated() || (!set && symbol instanceof ElementSymbol)){
orderByItem = new SortSpecification(direction, translate(symbol));
} else {
- orderByItem = new SortSpecification(direction, new ColumnReference(null, symbol.getOutputName(), null, symbol.getType()));
+ orderByItem = new SortSpecification(direction, new ColumnReference(null, SingleElementSymbol.getShortName(symbol.getOutputName()), null, symbol.getType()));
}
orderByItem.setNullOrdering(items.get(i).getNullOrdering());
translatedItems.add(orderByItem);
@@ -558,7 +559,7 @@
}
ColumnReference translate(ElementSymbol symbol) {
- ColumnReference element = new ColumnReference(translate(symbol.getGroupSymbol()), symbol.getOutputName(), null, symbol.getType());
+ ColumnReference element = new ColumnReference(translate(symbol.getGroupSymbol()), SingleElementSymbol.getShortName(symbol.getOutputName()), null, symbol.getType());
if (element.getTable().getMetadataObject() == null) {
return element;
}
@@ -744,10 +745,10 @@
/* Batched Updates */
BatchedUpdates translate(BatchedUpdateCommand command) {
- List updates = command.getUpdateCommands();
+ List<Command> updates = command.getUpdateCommands();
List<org.teiid.language.Command> translatedUpdates = new ArrayList<org.teiid.language.Command>(updates.size());
- for (Iterator i = updates.iterator(); i.hasNext();) {
- translatedUpdates.add(translate((Command)i.next()));
+ for (Iterator<Command> i = updates.iterator(); i.hasNext();) {
+ translatedUpdates.add(translate(i.next()));
}
return new BatchedUpdates(translatedUpdates);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java 2011-06-28 03:47:29 UTC (rev 3280)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java 2011-06-28 14:21:51 UTC (rev 3281)
@@ -72,7 +72,7 @@
public void testGetName() throws Exception {
Object metadataID = TstLanguageBridgeFactory.metadata.getElementID("pm1.g1.e1"); //$NON-NLS-1$
- assertEquals("pm1.g1.e1", example("pm1.g1", "e1", metadataID).getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("e1", example("pm1.g1", "e1", metadataID).getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testGetGroup() throws Exception {
13 years, 6 months
teiid SVN: r3280 - in trunk: build/kits/jboss-container and 54 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-27 23:47:29 -0400 (Mon, 27 Jun 2011)
New Revision: 3280
Added:
trunk/api/src/main/java/org/teiid/PolicyDecider.java
trunk/build/kits/jboss-container/teiid-docs/licenses/MPL-1.0.html
trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRolePolicyDecider.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java
trunk/engine/src/main/java/org/teiid/query/xquery/saxon/DocumentWrapper.java
trunk/engine/src/main/java/org/teiid/query/xquery/saxon/NodeWrapper.java
trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java
trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSizeUtility.java
trunk/metadata/DATATYPES.INDEX
Removed:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/NodeTestUtil.java
Modified:
trunk/api/src/main/java/org/teiid/CommandContext.java
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java
trunk/client/src/main/java/org/teiid/jdbc/SQLStates.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java
trunk/client/src/test/java/org/teiid/jdbc/TestSQLException.java
trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
trunk/common-core/src/main/java/org/teiid/core/TeiidException.java
trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java
trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
trunk/documentation/developer-guide/src/main/docbook/en-US/content/security.xml
trunk/documentation/reference/src/main/docbook/en-US/content/architecture.xml
trunk/documentation/reference/src/main/docbook/en-US/content/dataroles.xml
trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
trunk/engine/pom.xml
trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/main/java/org/teiid/query/xquery/saxon/PathMapFilter.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/common/buffer/BufferManagerFactory.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.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/relational/TestGroupingNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestUnionAllNode.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
trunk/metadata/src/main/resources/System.vdb
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractMMQueryTestCase.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractQueryTest.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedures.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProceduresWithEscape.expected
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected
trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedures.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected
trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java
Log:
forward merge from 7.4.1
Modified: trunk/api/src/main/java/org/teiid/CommandContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/CommandContext.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/api/src/main/java/org/teiid/CommandContext.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -23,12 +23,15 @@
package org.teiid;
import java.io.Serializable;
+import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
import javax.security.auth.Subject;
+import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Session;
+import org.teiid.adminapi.VDB;
/**
* Context information for the currently executing command.
@@ -117,5 +120,17 @@
* @return
*/
String getRequestId();
+
+ /**
+ * Get the user's data policies, never null
+ * @return
+ */
+ Map<String, DataPolicy> getAllowedDataPolicies();
+
+ /**
+ * Get the current vdb
+ * @return
+ */
+ VDB getVdb();
}
Copied: trunk/api/src/main/java/org/teiid/PolicyDecider.java (from rev 3275, branches/7.4.x/api/src/main/java/org/teiid/PolicyDecider.java)
===================================================================
--- trunk/api/src/main/java/org/teiid/PolicyDecider.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/PolicyDecider.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+import java.util.Set;
+
+import org.teiid.adminapi.DataPolicy.Context;
+import org.teiid.adminapi.DataPolicy.PermissionType;
+
+/**
+ * A policy decider that reports authorization decisions for further action.
+ * A decider may be called many times for a single user command. Typically there will be 1 call for every
+ * command/subquery/temp table access/function call.
+ */
+public interface PolicyDecider {
+
+ /**
+ * Called by the system hasRole function to determine role membership.
+ * @param roleName
+ * @param context
+ * @return true if the user has the given role name, otherwise false
+ */
+ boolean hasRole(String roleName, CommandContext context);
+
+ /**
+ * Returns the set of resources not allowed to be accessed by the current user.
+ * Resource names are given based upon the FQNs (NOTE these are non-SQL names - identifiers are not quoted).
+ * @param action
+ * @param resources
+ * @param context in which the action is performed.
+ * For example you can have a context of {@link Context#UPDATE} for a {@link PermissionType#READ} for columns used in an UPDATE condition.
+ * @param commandContext
+ * @return the set of inaccessible resources, never null
+ */
+ Set<String> getInaccessibleResources(PermissionType action,
+ Set<String> resources, Context context,
+ CommandContext commandContext);
+
+ /**
+ * Checks if the given temp table is accessible. Typically as long as temp tables can be created, all operations are allowed.
+ * Resource names are given based upon the FQNs (NOTE these are non-SQL names - identifiers are not quoted).
+ * @param action
+ * @param resource
+ * @param context in which the action is performed.
+ * For example you can have a context of {@link Context#UPDATE} for a {@link PermissionType#READ} for columns used in an UPDATE condition.
+ * @param commandContext
+ * @return true if the access is allowed, otherwise false
+ */
+ boolean isTempAccessable(PermissionType action, String resource,
+ Context context, CommandContext commandContext);
+
+ /**
+ * Determines if an authorization check should proceed
+ * @param commandContext
+ * @return
+ */
+ boolean validateCommand(CommandContext commandContext);
+
+}
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -25,15 +25,15 @@
<!-- The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024) -->
<property name="connectorBatchSize">1024</property>
<!--
- The number of batch columns to allow in buffer memory. -1 means to automatically calculate a value (default -1).
+ The approximate amount of buffer memory in kilobytes allowable for a single processing operation (sort, grouping, etc.) regardless of existing memory commitments. -1 means to automatically calculate a value (default -1).
See the admin guide for more.
-->
- <property name="maxReserveBatchColumns">-1</property>
+ <property name="maxReserveKb">-1</property>
<!--
- The number of batch columns guaranteed to a processing operation. -1 means to automatically calculate a value (default -1).
+ The approximate amount of memory in kilobytes allowed to be held by the buffer manager. -1 means to automatically calculate a value (default -1).
See the admin guide for more.
-->
- <property name="maxProcessingBatchesColumns">-1</property>
+ <property name="maxProcessingKb">-1</property>
<!-- Max File size in MB (default 2GB)-->
<property name="maxFileSize">2048</property>
<!-- Max storage space, in MB, to be used for buffer files (default 50G) -->
@@ -101,7 +101,7 @@
<property name="cacheFactory"><inject bean="CacheFactory"/></property>
<property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></property>
<property name="preparedPlanCacheConfig"><inject bean="PreparedPlanCacheConfig"/></property>
-
+ <property name="authorizationValidator"><inject bean="AuthorizationValidator"/></property>
<!-- Process pool maximum thread count. (default 64) -->
<property name="maxThreads">64</property>
<!-- Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts. -->
@@ -117,12 +117,6 @@
<property name="maxRowsFetchSize">20480</property>
<!-- The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default) -->
<property name="lobChunkSizeInKB">100</property>
- <!-- Turn on role checking based upon the data roles defined in VDBs. (default true) -->
- <property name="useDataRoles">true</property>
- <!-- Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true) -->
- <property name="allowCreateTemporaryTablesByDefault">true</property>
- <!-- Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true) -->
- <property name="allowFunctionCallsByDefault">true</property>
<!-- Long running query threshold, after which a alert can be generated by tooling if configured-->
<property name="queryThresholdInSecs">600</property>
<!-- Maximum rows allowed from a source query. -1 indicates no limit. (default -1)-->
@@ -136,6 +130,24 @@
<!-- Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true) -->
<property name="detectingChangeEvents">true</property>
</bean>
+
+ <!-- An authorization validator that by default uses data role information stored in VDBs -->
+ <bean name="AuthorizationValidator" class="org.teiid.dqp.internal.process.DefaultAuthorizationValidator">
+ <!-- Turn on authorization checking (default true) -->
+ <property name="enabled">true</property>
+ <!-- The policy decider to use. (default AuthorizationValidator).
+ This instance may be changed to another org.teiid.PolicyDecider if needed.
+ -->
+ <property name="policyDecider"><inject bean="PolicyDecider"/></property>
+ </bean>
+
+ <!-- A policy decider that uses data role information stored in VDBs -->
+ <bean name="PolicyDecider" class="org.teiid.dqp.internal.process.DataRolePolicyDecider">
+ <!-- Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true) -->
+ <property name="allowCreateTemporaryTablesByDefault">true</property>
+ <!-- Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true) -->
+ <property name="allowFunctionCallsByDefault">true</property>
+ </bean>
<!-- JDBC Socket connection properties (SSL see below) -->
<bean name="JdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
Copied: trunk/build/kits/jboss-container/teiid-docs/licenses/MPL-1.0.html (from rev 3275, branches/7.4.x/build/kits/jboss-container/teiid-docs/licenses/MPL-1.0.html)
===================================================================
--- trunk/build/kits/jboss-container/teiid-docs/licenses/MPL-1.0.html (rev 0)
+++ trunk/build/kits/jboss-container/teiid-docs/licenses/MPL-1.0.html 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,421 @@
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Mozilla Public License version 1.0</title>
+</head><body link="#0000ee" text="#000000" vlink="#551a8b" alink="#ff0000" bgcolor="#ffffff">
+
+<p align="CENTER">
+ <font size="+2"><b>MOZILLA PUBLIC LICENSE</b></font><br>
+ <b>Version 1.0</b>
+</p>
+
+<p></p><hr width="20%"><p>
+
+</p><p><b>1. Definitions.</b>
+</p><ul>
+
+ <b>1.1. ``Contributor''</b> means each entity that creates or contributes
+ to the creation of Modifications.
+
+ <p><b>1.2. ``Contributor Version''</b> means the combination of the
+ Original Code, prior Modifications used by a Contributor, and the
+ Modifications made by that particular Contributor.
+
+ </p><p><b>1.3. ``Covered Code''</b> means the Original Code or Modifications
+ or the combination of the Original Code and Modifications, in each case
+ including portions thereof<b>.</b>
+
+ </p><p><b>1.4. ``Electronic Distribution Mechanism''</b> means a mechanism
+ generally accepted in the software development community for the
+ electronic transfer of data.
+
+ </p><p><b>1.5. ``Executable''</b> means Covered Code in any form other than
+ Source Code.
+
+ </p><p><b>1.6. ``Initial Developer''</b> means the individual or entity
+ identified as the Initial Developer in the Source Code notice required by
+ <b>Exhibit A</b>.
+
+ </p><p><b>1.7. ``Larger Work''</b> means a work which combines Covered Code
+ or portions thereof with code not governed by the terms of this License.
+
+ </p><p><b>1.8. ``License''</b> means this document.
+
+ </p><p><b>1.9. ``Modifications''</b> means any addition to or deletion from
+ the substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+
+ </p><ul>
+
+ <p><b>A.</b> Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ </p><p><b>B.</b> Any new file that contains any part of the Original
+ Code or previous Modifications.
+
+ </p></ul>
+
+ <p><b>1.10. ``Original Code''</b> means Source Code of computer software
+ code which is described in the Source Code notice required by <b>Exhibit
+ A</b> as Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ </p><p><b>1.11. ``Source Code''</b> means the preferred form of the Covered
+ Code for making modifications to it, including all modules it contains,
+ plus any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or a list of source code
+ differential comparisons against either the Original Code or another well
+ known, available Covered Code of the Contributor's choice. The Source
+ Code can be in a compressed or archival form, provided the appropriate
+ decompression or de-archiving software is widely available for no charge.
+
+ </p><p><b>1.12. ``You''</b> means an individual or a legal entity exercising
+ rights under, and complying with all of the terms of, this License or a
+ future version of this License issued under Section 6.1. For legal
+ entities, ``You'' includes any entity which controls, is controlled by,
+ or is under common control with You. For purposes of this definition,
+ ``control'' means (a) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or otherwise,
+ or (b) ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+</p></ul>
+<b>2. Source Code License.</b>
+<ul>
+
+ <b>2.1. The Initial Developer Grant.</b>
+
+ <br>The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+
+ <ul>
+
+ <p><b>(a)</b> to use, reproduce, modify, display, perform, sublicense
+ and distribute the Original Code (or portions thereof) with or
+ without Modifications, or as part of a Larger Work; and
+
+ </p><p><b>(b)</b> under patents now or hereafter owned or controlled by
+ Initial Developer, to make, have made, use and sell (``Utilize'') the
+ Original Code (or portions thereof), but solely to the extent that
+ any such patent is reasonably necessary to enable You to Utilize the
+ Original Code (or portions thereof) and not to any greater extent
+ that may be necessary to Utilize further Modifications or
+ combinations.
+ </p></ul>
+
+ <p><b>2.2. Contributor Grant.</b>
+
+ <br>Each Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+
+ </p><ul>
+
+ <p><b>(a)</b> to use, reproduce, modify, display, perform, sublicense and
+ distribute the Modifications created by such Contributor (or portions
+ thereof) either on an unmodified basis, with other Modifications, as
+ Covered Code or as part of a Larger Work; and
+
+ </p><p><b>(b)</b> under patents now or hereafter owned or controlled by
+ Contributor, to Utilize the Contributor Version (or portions thereof),
+ but solely to the extent that any such patent is reasonably necessary to
+ enable You to Utilize the Contributor Version (or portions thereof), and
+ not to any greater extent that may be necessary to Utilize further
+ Modifications or combinations.
+
+ </p></ul>
+
+</ul>
+<b>3. Distribution Obligations.</b>
+<ul>
+
+ <b>3.1. Application of License.</b>
+
+ <br>The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section <b>2.2</b>. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version of
+ this License released under Section <b>6.1</b>, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this License
+ or the recipients' rights hereunder. However, You may include an
+ additional document offering the additional rights described in Section
+ <b>3.5</b>.
+
+ <p><b>3.2. Availability of Source Code.</b>
+
+ <br>Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License either
+ on the same media as an Executable version or via an accepted Electronic
+ Distribution Mechanism to anyone to whom you made an Executable version
+ available; and if made available via Electronic Distribution Mechanism,
+ must remain available for at least twelve (12) months after the date it
+ initially became available, or at least six (6) months after a subsequent
+ version of that particular Modification has been made available to such
+ recipients. You are responsible for ensuring that the Source Code version
+ remains available even if the Electronic Distribution Mechanism is
+ maintained by a third party.
+
+ </p><p><b>3.3. Description of Modifications.</b>
+
+ <br>You must cause all Covered Code to which you contribute to contain a
+ file documenting the changes You made to create that Covered Code and the
+ date of any change. You must include a prominent statement that the
+ Modification is derived, directly or indirectly, from Original Code
+ provided by the Initial Developer and including the name of the Initial
+ Developer in (a) the Source Code, and (b) in any notice in an Executable
+ version or related documentation in which You describe the origin or
+ ownership of the Covered Code.
+
+ </p><p><b>3.4. Intellectual Property Matters</b>
+ </p><ul>
+
+ <p><b>(a) Third Party Claims</b>.
+
+ <br>If You have knowledge that a party claims an intellectual
+ property right in particular functionality or code (or its
+ utilization under this License), you must include a text file with
+ the source code distribution titled ``LEGAL'' which describes the
+ claim and the party making the claim in sufficient detail that a
+ recipient will know whom to contact. If you obtain such knowledge
+ after You make Your Modification available as described in Section
+ <b>3.2</b>, You shall promptly modify the LEGAL file in all copies
+ You make available thereafter and shall take other steps (such as
+ notifying appropriate mailing lists or newsgroups) reasonably
+ calculated to inform those who received the Covered Code that new
+ knowledge has been obtained.
+
+ </p><p><b>(b) Contributor APIs</b>.
+
+ <br>If Your Modification is an application programming interface and
+ You own or control patents which are reasonably necessary to
+ implement that API, you must also include this information in the
+ LEGAL file.
+
+ </p></ul>
+
+ <p><b>3.5. Required Notices.</b>
+
+ <br>You must duplicate the notice in <b>Exhibit A</b> in each file of the
+ Source Code, and this License in any documentation for the Source Code,
+ where You describe recipients' rights relating to Covered Code. If You
+ created one or more Modification(s), You may add your name as a
+ Contributor to the notice described in <b>Exhibit A</b>. If it is not
+ possible to put such notice in a particular Source Code file due to its
+ structure, then you must include such notice in a location (such as a
+ relevant directory file) where a user would be likely to look for such a
+ notice. You may choose to offer, and to charge a fee for, warranty,
+ support, indemnity or liability obligations to one or more recipients of
+ Covered Code. However, You may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You must make it
+ absolutely clear than any such warranty, support, indemnity or liability
+ obligation is offered by You alone, and You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty, support,
+ indemnity or liability terms You offer.
+
+ </p><p><b>3.6. Distribution of Executable Versions.</b>
+
+ <br>You may distribute Covered Code in Executable form only if the
+ requirements of Section <b>3.1-3.5</b> have been met for that Covered
+ Code, and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License, including
+ a description of how and where You have fulfilled the obligations of
+ Section <b>3.2</b>. The notice must be conspicuously included in any
+ notice in an Executable version, related documentation or collateral in
+ which You describe recipients' rights relating to the Covered Code. You
+ may distribute the Executable version of Covered Code under a license of
+ Your choice, which may contain terms different from this License,
+ provided that You are in compliance with the terms of this License and
+ that the license for the Executable version does not attempt to limit or
+ alter the recipient's rights in the Source Code version from the rights
+ set forth in this License. If You distribute the Executable version under
+ a different license You must make it absolutely clear that any terms
+ which differ from this License are offered by You alone, not by the
+ Initial Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of any such terms You
+ offer.
+
+ </p><p><b>3.7. Larger Works.</b>
+
+ <br>You may create a Larger Work by combining Covered Code with other
+ code not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+</p></ul>
+<b>4. Inability to Comply Due to Statute or Regulation.</b>
+<ul>
+
+ <p>If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to statute or
+ regulation then You must: (a) comply with the terms of this License to
+ the maximum extent possible; and (b) describe the limitations and the
+ code they affect. Such description must be included in the LEGAL file
+ described in Section <b>3.4</b> and must be included with all
+ distributions of the Source Code. Except to the extent prohibited by
+ statute or regulation, such description must be sufficiently detailed for
+ a recipient of ordinary skill
+ to be able to understand it.
+
+</p></ul>
+<b>5. Application of this License.</b>
+<ul>
+
+ This License applies to code to which the Initial Developer has attached
+ the notice in <b>Exhibit A</b>, and to related Covered Code.
+
+</ul>
+<b>6. Versions of the License.</b>
+<ul>
+
+ <b>6.1. New Versions</b>.
+
+ <br>Netscape Communications Corporation (``Netscape'') may publish
+ revised and/or new versions of the License from time to time. Each
+ version will be given a distinguishing version number.
+
+ <p><b>6.2. Effect of New Versions</b>.
+
+ <br>Once Covered Code has been published under a particular version of
+ the License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms of
+ any subsequent version of the License published by Netscape. No one other
+ than Netscape has the right to modify the terms applicable to Covered
+ Code created under this License.
+
+ </p><p><b>6.3. Derivative Works</b>.
+
+ <br>If you create or use a modified version of this License (which you
+ may only do in order to apply it to code which is not already Covered
+ Code governed by this License), you must (a) rename Your license so that
+ the phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL''
+ or any confusingly similar phrase do not appear anywhere in your license
+ and (b) otherwise make it clear that your version of the license contains
+ terms which differ from the Mozilla Public License and Netscape Public
+ License. (Filling in the name of the Initial Developer, Original Code or
+ Contributor in the notice described in <b>Exhibit A</b> shall not of
+ themselves be deemed to be modifications of this License.)
+
+</p></ul>
+<b>7. DISCLAIMER OF WARRANTY.</b>
+<ul>
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS,
+ MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE
+ RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH
+ YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
+ NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY
+ CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE
+ IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+</ul>
+<b>8. TERMINATION.</b>
+<ul>
+
+ This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall survive
+ any termination of this License. Provisions which, by their nature, must
+ remain in effect beyond the termination of this License shall survive.
+
+</ul>
+<b>9. LIMITATION OF LIABILITY.</b>
+<ul>
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
+ NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY
+ OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF
+ ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
+ INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER
+ INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED
+ OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL
+ NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
+ PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
+ LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION
+ OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION
+ MAY NOT APPLY TO YOU.
+
+</ul>
+<b>10. U.S. GOVERNMENT END USERS.</b>
+<ul>
+
+ The Covered Code is a ``commercial item,'' as that term is defined in 48
+ C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer software''
+ and ``commercial computer software documentation,'' as such terms are
+ used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212
+ and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all
+ U.S. Government End Users acquire Covered Code with only those rights set
+ forth herein.
+
+</ul>
+<b>11. MISCELLANEOUS.</b>
+<ul>
+
+ This License represents the complete agreement concerning subject matter
+ hereof. If any provision of this License is held to be unenforceable,
+ such provision shall be reformed only to the extent necessary to make it
+ enforceable. This License shall be governed by California law provisions
+ (except to the extent applicable law, if any, provides otherwise),
+ excluding its conflict-of-law provisions. With respect to disputes in
+ which at least one party is a citizen of, or an entity chartered or
+ registered to do business in, the United States of America: (a) unless
+ otherwise agreed in writing, all disputes relating to this License
+ (excepting any dispute relating to intellectual property rights) shall be
+ subject to final and binding arbitration, with the losing party paying
+ all costs of arbitration; (b) any arbitration relating to this Agreement
+ shall be held in Santa Clara County, California, under the auspices of
+ JAMS/EndDispute; and (c) any litigation relating to this Agreement shall
+ be subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys fees and
+ expenses. The application of the United Nations Convention on Contracts
+ for the International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall be
+ construed against the drafter shall not apply to this License.
+
+</ul>
+<b>12. RESPONSIBILITY FOR CLAIMS.</b>
+<ul>
+
+ Except in cases where another Contributor has failed to comply with
+ Section <b>3.4</b>, You are responsible for damages arising, directly or
+ indirectly, out of Your utilization of rights under this License, based
+ on the number of copies of Covered Code you made available, the revenues
+ you received from utilizing such rights, and other relevant factors. You
+ agree to work with affected parties to distribute responsibility on an
+ equitable basis.
+
+</ul>
+<b>EXHIBIT A.</b>
+<ul>
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.0 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ <p>Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations under
+ the License.
+
+ </p><p>The Original Code is ______________________________________.
+
+ </p><p>The Initial Developer of the Original Code is
+ ________________________. Portions created by ______________________ are
+ Copyright (C) ______ _______________________. All Rights Reserved.
+
+ </p><p>Contributor(s): ______________________________________.''
+
+</p></ul>
+</body></html>
\ No newline at end of file
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-06-28 03:47:29 UTC (rev 3280)
@@ -30,6 +30,9 @@
<LI><B>MAKEIND Hint</B> - The MAKEIND hint can be used to indicate that the other side of the join should be made dependent.
<LI><B>ODBC SSL</B> - added support for SSL encrypted ODBC connections.
<LI><B>Reauthentication Statement</B> - SET SESSION AUTHORIZATION can now be used to perform a reauthentication via JDBC or ODBC.
+ <LI><B>Pluggable Authorization</B> - an alternative PolicyDecider can be defined in the teiid-jboss-beans.xml file to customize authorization decisions.
+ <LI><B>Streaming XQuery</B> - in situations where document projection applies if the XMLQUERY/XMLTABLE path expressions meet certain conditions, then the incoming document will not only be projected, but the independent subtrees will be processed without loading the entire document. This allows for nearly arbitrarily large XML documents to be processed. See the Reference for more.
+ <LI><B>Logging Procedures</B> - added SYSADMIN.isLoggable and SYSADMIN.logMsg to aid in debugging procedure logic.
<LI><B>ANSI OFFSET/FETCH FIRST</B> - instead of the limit clause, a standard OFFSET and/or FETCH FIRST/NEXT clause can be used to limit results.
</UL>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
@@ -105,6 +108,12 @@
See the <a href="teiid-docs/teiid_admin_guide.pdf">Admin Guide</a> for more on configuration and installation.
+<h4>from 7.4</h4>
+<ul>
+ <LI>The configuration for authorization has been moved off of the RuntimeEngineDeployer bean and onto separate AuthorizationValidator and PolicyDecider beans.
+ <LI>The configuration for the buffer manager has been simplified to refer to memory sizes in KB, rather than batch columns.
+</ul>
+
<h4>from 7.3</h4>
<ul>
<LI>The default value for the JDBC dynamic vdb importer setting importer.useFullSchemaName is now true, which matches the expected behavior from the documentation.
@@ -159,7 +168,8 @@
<li>TEIID-1008 - Most versions of Oracle and MySQL do not support deeply nested correlated references. There is currently no workaround for this issue.
<li>For compatibility with the 7.0 release if a stored procedure parameter list begins with identifier=, then it will be parsed as a named parameter invocation even if the intent was to use a comparison predicate
as the first parameter value. The workaround is to use nesting parens, e.g. call proc((identifier=value), ...), which clarifies that this is positional value. This workaround will not be needed in later releases.
- <li><a url="https://issues.jboss.org/browse/TEIID-1511">TEIID-1511<a/> - When a VDB is deployed and undeployed a socket is left open, which may lead to "too manay open files". Check the defect comments for details.
+ <li><a url="https://issues.jboss.org/browse/TEIID-1511">TEIID-1511<a/> - When a VDB is deployed and undeployed a socket is left open, which may lead to "too manay open files". Check the defect comments for details.
+ <li>TEIID-1648 - Teradata lobs can only be consistently read from an embedded client (with the default option to use the calling thread) and in single threaded mode (transactional or userRequestSourceConcurrency=1). Usage of Teradata lobs under any other configuration is unlikely to work.
</ul>
<h4>from 7.0</h4>
<ul>
@@ -175,6 +185,11 @@
<h2><a name="LibraryUpdates">Thirdparty Library Updates</a></h2>
The following components have been updated:
+
+<h4>From 7.4</h4>
+<ul>
+ <li>nux 1.6, and xom 1.2 were added.
+</ul>
<h4>From 7.1</h4>
<ul>
<li>json-simple 1.1 was added.
Modified: trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -25,8 +25,20 @@
public interface DataPolicy {
- public enum PermissionType {CREATE, READ, UPDATE, DELETE, ALTER, EXECUTE};
+ public enum Context {
+ CREATE,
+ DROP,
+ QUERY,
+ INSERT,
+ UPDATE,
+ DELETE,
+ FUNCTION,
+ ALTER,
+ STORED_PROCEDURE;
+ }
+ public enum PermissionType {CREATE, READ, UPDATE, DELETE, ALTER, EXECUTE, DROP};
+
/**
* Get the Name of the Data Policy
* @return
Modified: trunk/client/src/main/java/org/teiid/jdbc/SQLStates.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/SQLStates.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/client/src/main/java/org/teiid/jdbc/SQLStates.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -82,6 +82,8 @@
* conforms to the subclass DataDirect uses for SocketExceptions.
*/
public static final String CONNECTION_EXCEPTION_STALE_CONNECTION = "08S01"; //$NON-NLS-1$
+
+ public static final String QUERY_CANCELED = "57014"; //$NON-NLS-1$
// Class 28 - invalid authorization specification
Property changes on: trunk/client/src/main/java/org/teiid/jdbc/SQLStates.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/client/src/main/java/org/teiid/jdbc/SQLStates.java:3220-3275
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -149,7 +149,7 @@
private Serializable payload;
/** List of INSERT, UPDATE, DELETE AND SELECT INTO commands */
- private List batchedUpdates;
+ private List<String> batchedUpdates;
/** Array of update counts as returned by executeBatch() */
protected int[] updateCounts;
@@ -200,7 +200,7 @@
String queryTimeoutStr = this.execProps.getProperty(ExecutionProperties.QUERYTIMEOUT);
if(queryTimeoutStr != null) {
try {
- this.queryTimeoutMS = Integer.parseInt(fetchSizeStr)*1000;
+ this.queryTimeoutMS = Integer.parseInt(queryTimeoutStr)*1000;
} catch(Exception e) {
// silently failover to default
}
@@ -240,26 +240,18 @@
this.batchedUpdates = null;
this.updateCounts = null;
this.outParamIndexMap.clear();
+ this.commandStatus = State.RUNNING;
}
- /**
- * Adds sql to this statement object's current list of commands.
- * @param sql statement to be added to the batch
- */
public void addBatch(String sql) throws SQLException {
//Check to see the statement is closed and throw an exception
checkStatement();
if (batchedUpdates == null) {
- batchedUpdates = new ArrayList();
+ batchedUpdates = new ArrayList<String>();
}
batchedUpdates.add(sql);
}
- /**
- * This method can be used by one thread to cancel a statement that is being
- * executed by another thread.
- * @throws SQLException should never occur.
- */
public void cancel() throws SQLException {
/* Defect 19848 - Mark the statement cancelled before sending the CANCEL request.
* Otherwise, it's possible get into a race where the server response is quicker
@@ -271,10 +263,6 @@
cancelRequest();
}
- /**
- * Warning could be schema validation errors or partial results warnings.
- * @throws SQLException should never occur.
- */
public void clearWarnings() throws SQLException {
//Check to see the statement is closed and throw an exception
checkStatement();
@@ -283,22 +271,12 @@
serverWarnings = null;
}
- /**
- * Makes the set of commands in the current batch empty.
- *
- * @throws SQLException if a database access error occurs or the
- * driver does not support batch statements
- */
public void clearBatch() throws SQLException {
- batchedUpdates.clear();
+ if (batchedUpdates != null) {
+ batchedUpdates.clear();
+ }
}
- /**
- * In many cases, it is desirable to immediately release a Statements's database
- * and JDBC resources instead of waiting for this to happen when it is automatically
- * closed; the close method provides this immediate release.
- * @throws SQLException should never occur.
- */
public void close() throws SQLException {
if ( isClosed ) {
return;
@@ -345,7 +323,7 @@
if (batchedUpdates == null || batchedUpdates.isEmpty()) {
return new int[0];
}
- String[] commands = (String[])batchedUpdates.toArray(new String[batchedUpdates.size()]);
+ String[] commands = batchedUpdates.toArray(new String[batchedUpdates.size()]);
executeSql(commands, true, ResultsMode.UPDATECOUNT, true);
return updateCounts;
}
Property changes on: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java:3149-3217
+ /branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java:3149-3217,3220-3275
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -32,6 +32,7 @@
import org.teiid.client.ProcedureErrorInstructionException;
import org.teiid.client.security.InvalidSessionException;
import org.teiid.client.security.LogonException;
+import org.teiid.client.util.ExceptionUtil;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidRuntimeException;
@@ -102,10 +103,13 @@
return new TeiidSQLException((SQLException) exception, message, true);
}
String sqlState = SQLStates.DEFAULT;
-
- exception = findRootException(exception);
-
- sqlState = determineSQLState(exception, sqlState);
+ TeiidException te = ExceptionUtil.getExceptionOfType(exception, TeiidException.class);
+ if (te != null && te.getCode() != null) {
+ sqlState = te.getCode();
+ } else {
+ exception = findRootException(exception);
+ sqlState = determineSQLState(exception, sqlState);
+ }
return new TeiidSQLException(origException, message, sqlState);
}
Property changes on: trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java:3220-3275
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestSQLException.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestSQLException.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestSQLException.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -22,6 +22,8 @@
package org.teiid.jdbc;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.net.ConnectException;
import java.net.MalformedURLException;
@@ -31,23 +33,21 @@
import java.net.UnknownHostException;
import java.sql.SQLException;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.teiid.client.ProcedureErrorInstructionException;
-import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidException;
-import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
-public class TestSQLException extends TestCase {
+public class TestSQLException {
/*
* Test method for 'com.metamatrix.jdbc.MMSQLException.MMSQLException()'
*/
- public void testMMSQLException() {
+ @Test public void testMMSQLException() {
TeiidSQLException e = new TeiidSQLException();
String sqlState = e.getSQLState();
Throwable cause = e.getCause();
@@ -82,7 +82,7 @@
* Tests various simple exceptions to see if the expected SQLState is
* returend.
*/
- public void testCreateThrowable_01() {
+ @Test public void testCreateThrowable_01() {
testCreateThrowable(new CommunicationException(
"A test MM Communication Exception"), //$NON-NLS-1$
SQLStates.CONNECTION_EXCEPTION_STALE_CONNECTION);
@@ -133,7 +133,7 @@
* Tests various nested exceptions to see if the expected SQLState is
* returend.
*/
- public void testCreateThrowable_02() {
+ @Test public void testCreateThrowable_02() {
testCreateThrowable(
new CommunicationException(new ConnectException(
"A test java.net.ConnectException"), //$NON-NLS-1$
@@ -150,7 +150,7 @@
SQLStates.CONNECTION_EXCEPTION_STALE_CONNECTION);
}
- public void testCreateThrowable3() {
+ @Test public void testCreateThrowable3() {
TeiidSQLException e = testCreateThrowable(
new TeiidException(
new TeiidRuntimeException(
@@ -180,31 +180,15 @@
Throwable nestedException = e.getCause();
SQLException nextException = e.getNextException();
- assertTrue("Expected MMSQLException.getSQLState() to return \"" //$NON-NLS-1$
- + esqlState + "\" but got \"" + sqlState + "\" instead.", //$NON-NLS-1$ //$NON-NLS-2$
- sqlState.compareTo(esqlState) == 0);
- assertTrue("Expected MMSQLException.getCause() to return [" //$NON-NLS-1$
- + (ecause != null ? ecause.getClass().getName() : "<null>") //$NON-NLS-1$
- + "] but got [" //$NON-NLS-1$
- + (cause != null ? cause.getClass().getName() : "<unknown>") //$NON-NLS-1$
- + "] instead.", cause == ecause); //$NON-NLS-1$
- assertTrue(
- "Expected MMSQLException.getErrorCode() to return [0] but got [" //$NON-NLS-1$
- + errorCode + "] instead.", errorCode == 0); //$NON-NLS-1$
- assertTrue("Expected MMSQLException.getNestedException() to return [" //$NON-NLS-1$
- + (ecause != null ? ecause.getClass().getName() : "<null>") //$NON-NLS-1$
- + "] but got [" //$NON-NLS-1$
- + (nestedException != null ? nestedException.getClass()
- .getName() : "<unknown>") + "] instead.", //$NON-NLS-1$ //$NON-NLS-2$
- nestedException == ecause);
- assertTrue(
- "Expected MMSQLException.getNextException() to return <null> but got a SQLException with message \"" //$NON-NLS-1$
- + (nextException != null ? nextException.getMessage()
- : "") + "\" instead.", nextException == null); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(esqlState, sqlState);
+ assertEquals(ecause, cause);
+ assertEquals(0, errorCode);
+ assertEquals(nestedException, ecause);
+ assertNull(nextException);
return e;
}
- public void testCreate() {
+ @Test public void testCreate() {
TeiidSQLException exception = TeiidSQLException.create(new Exception());
assertEquals(exception.getMessage(), Exception.class.getName());
@@ -214,7 +198,7 @@
assertEquals(exception, TeiidSQLException.create(exception));
}
- public void testCreateFromSQLException() {
+ @Test public void testCreateFromSQLException() {
SQLException sqlexception = new SQLException("foo", "21"); //$NON-NLS-1$ //$NON-NLS-2$
SQLException nested = new SQLException("bar"); //$NON-NLS-1$
@@ -230,5 +214,15 @@
assertEquals(exception.getNextException().getMessage(), sqlexception.getMessage());
assertEquals(exception.getNextException().getNextException().getMessage(), nested.getMessage());
}
+
+ @Test public void testCodeAsSQLState() {
+ TeiidException sqlexception = new TeiidException("foo", "21"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ String message = "top level message"; //$NON-NLS-1$
+
+ TeiidSQLException exception = TeiidSQLException.create(sqlexception, message);
+
+ assertEquals(sqlexception.getCode(), exception.getSQLState());
+ }
}
Property changes on: trunk/client/src/test/java/org/teiid/jdbc/TestSQLException.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestSQLException.java:3220-3275
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -50,6 +50,7 @@
results.getResultsReceiver().receiveResults(rm);
Mockito.stub(conn.getDQP()).toReturn(dqp);
StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ statement.clearBatch(); //previously caused npe
statement.addBatch("delete from table"); //$NON-NLS-1$
statement.addBatch("delete from table1"); //$NON-NLS-1$
assertTrue(Arrays.equals(new int[] {1, 2}, statement.executeBatch()));
@@ -129,6 +130,19 @@
statement.submitExecute("select 'hello world'");
Thread.sleep(100);
Mockito.verify(dqp).cancelRequest(0);
+ statement.setQueryTimeoutMS(1);
+ statement.submitExecute("select 'hello world'");
+ Thread.sleep(100);
+ Mockito.verify(dqp, Mockito.times(2)).cancelRequest(0);
}
+ @Test public void testTimeoutProperty() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Properties p = new Properties();
+ p.setProperty(ExecutionProperties.QUERYTIMEOUT, "2");
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ assertEquals(2, statement.getQueryTimeout());
+ }
+
}
Property changes on: trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java:3149-3217
+ /branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java:3149-3217,3220-3275
Modified: trunk/common-core/src/main/java/org/teiid/core/TeiidException.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/TeiidException.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/common-core/src/main/java/org/teiid/core/TeiidException.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -58,7 +58,7 @@
public TeiidException(Throwable e, String message) {
super(message, e);
- setCode(e);
+ setCode(getCode(e));
}
public TeiidException(Throwable e, String errorCode, String message) {
@@ -82,14 +82,15 @@
this.originalType = originalType;
}
- private void setCode(Throwable e) {
+ static String getCode(Throwable e) {
if (e instanceof TeiidException) {
- this.code = (((TeiidException) e).getCode());
+ return (((TeiidException) e).getCode());
} else if (e instanceof TeiidRuntimeException) {
- this.code = ((TeiidRuntimeException) e).getCode();
+ return ((TeiidRuntimeException) e).getCode();
} else if (e instanceof SQLException) {
- this.code = Integer.toString(((SQLException)e).getErrorCode());
+ return ((SQLException)e).getSQLState();
}
+ return null;
}
public String getMessage() {
Property changes on: trunk/common-core/src/main/java/org/teiid/core/TeiidException.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/common-core/src/main/java/org/teiid/core/TeiidException.java:3220-3275
Modified: trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -22,10 +22,6 @@
package org.teiid.core;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.sql.SQLException;
-
import org.teiid.core.util.ExceptionUtil;
@@ -40,26 +36,9 @@
public class TeiidRuntimeException extends RuntimeException {
public static final long serialVersionUID = -4035276728007979320L;
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
public static final String CAUSED_BY_STRING = CorePlugin.Util.getString("RuntimeException.Caused_by"); //$NON-NLS-1$
//############################################################################################################################
- //# Static Methods #
- //############################################################################################################################
-
- /**
- * Utility method to get the name of a class, without package information.
- *
- * @param cls The class to get the name of
- * @return The name of the class, without package info
- */
- public static String getClassShortName( Class cls ) {
- if ( cls == null ) return EMPTY_STRING;
- String className = cls.getName();
- return className.substring( className.lastIndexOf('.')+1 );
- }
-
- //############################################################################################################################
//# Variables #
//############################################################################################################################
@@ -86,19 +65,6 @@
super(message);
}
- /**
- * Construct an instance with the specified error code and message. If the message is actually a key, the actual message will
- * be retrieved from a resource bundle using the key, and the specified parameters will be substituted for placeholders within
- * the message.
- * @param code The error code
- * @param message The error message or a resource bundle key
- */
- public TeiidRuntimeException(final int code, final String message) {
- super(message);
- // The following setCode call should be executed after setting the message
- setCode(code);
- }
-
public TeiidRuntimeException(final String code, final String message) {
super(message);
// The following setCode call should be executed after setting the message
@@ -125,23 +91,10 @@
*/
public TeiidRuntimeException(final Throwable e, final String message) {
super(message, e);
- setCode(e);
+ setCode(TeiidException.getCode(e));
}
/**
- * Construct an instance with the linked exception, error code, and error message specified. If the message is actually a
- * key, the error message will be retrieved from a resource bundle using the key.
- * @param e The exception to chain to this exception
- * @param code The error code
- * @param message The error message or a resource bundle key
- */
- public TeiidRuntimeException(final Throwable e, final int code, final String message) {
- super(message, e);
- // The following setCode call should be executed after setting the message
- setCode(code);
- }
-
- /**
* Construct an instance with the linked exception, error code, and error message specified. If the specified
* exception is a {@link TeiidException} or a MetaMatrixRuntimeException, the code will
* be set to the exception's code.
@@ -164,6 +117,7 @@
* Get the exception which is linked to this exception.
*
* @return The linked exception
+ * @deprecated use {@link #getCause()} instead
*/
public Throwable getChild() {
return this.getCause();
@@ -175,47 +129,13 @@
* @return The error code
*/
public String getCode() {
- if (code == null) {
- return "0"; //$NON-NLS-1$
- }
return this.code;
}
- public int getIntCode() {
- if (code == null) {
- return 0;
- }
- try {
- return Integer.parseInt(code);
- } catch (NumberFormatException e) {
-
- }
- return 0;
- }
-
- /**
- * Set the error code.
- *
- * @param code The error code
- */
- private void setCode( int code ) {
- this.code = Integer.toString(code);
- }
-
private void setCode( String code ) {
this.code = code;
}
- private void setCode(Throwable e) {
- if (e instanceof TeiidException) {
- this.code = (((TeiidException) e).getCode());
- } else if (e instanceof TeiidRuntimeException) {
- this.code = ((TeiidRuntimeException) e).getCode();
- } else if (e instanceof SQLException) {
- this.code = Integer.toString(((SQLException)e).getErrorCode());
- }
- }
-
/**
* Returns a string representation of this class.
*
@@ -225,12 +145,4 @@
return ExceptionUtil.getLinkedMessages(this);
}
- public void superPrintStackTrace(PrintStream output) {
- super.printStackTrace(output);
- }
-
- public void superPrintStackTrace(PrintWriter output) {
- super.printStackTrace(output);
- }
-
}
Property changes on: trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java:3220-3275
Modified: trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -63,16 +63,16 @@
public void testMetaMatrixRuntimeExceptionWithNullThrowable() {
final TeiidRuntimeException err = new TeiidRuntimeException((Throwable)null);
- assertNull(err.getChild());
- assertEquals("0", err.getCode()); //$NON-NLS-1$
+ assertNull(err.getCause());
+ assertNull(err.getCode());
assertNull(err.getMessage());
}
public void testMetaMatrixRuntimeExceptionWithMessage() {
final TeiidRuntimeException err = new TeiidRuntimeException("Test"); //$NON-NLS-1$
- assertNull(err.getChild());
- assertEquals("0", err.getCode()); //$NON-NLS-1$
+ assertNull(err.getCause());
+ assertNull(err.getCode());
assertEquals("Test", err.getMessage()); //$NON-NLS-1$
}
@@ -80,7 +80,7 @@
public void testMetaMatrixRuntimeExceptionWithCodeAndMessage() {
final String code = "1234"; //$NON-NLS-1$
final TeiidRuntimeException err = new TeiidRuntimeException(code, "Test"); //$NON-NLS-1$
- assertNull(err.getChild());
+ assertNull(err.getCause());
assertEquals(code, err.getCode());
assertEquals("Test", err.getMessage()); //$NON-NLS-1$
@@ -90,7 +90,7 @@
final String code = "1234"; //$NON-NLS-1$
final TeiidRuntimeException child = new TeiidRuntimeException(code, "Child"); //$NON-NLS-1$
final TeiidRuntimeException err = new TeiidRuntimeException(child, "Test"); //$NON-NLS-1$
- assertSame(child, err.getChild());
+ assertSame(child, err.getCause());
assertEquals(code, err.getCode());
assertEquals("Test", err.getMessage()); //$NON-NLS-1$
@@ -100,7 +100,7 @@
final String code = "1234"; //$NON-NLS-1$
final TeiidRuntimeException child = new TeiidRuntimeException(code, "Child"); //$NON-NLS-1$
final TeiidRuntimeException err = new TeiidRuntimeException(child, "Code", "Test"); //$NON-NLS-1$ //$NON-NLS-2$
- assertSame(child, err.getChild());
+ assertSame(child, err.getCause());
assertEquals("Code", err.getCode()); //$NON-NLS-1$
assertEquals("Test", err.getMessage()); //$NON-NLS-1$
Property changes on: trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java:3220-3275
Modified: trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java
===================================================================
--- trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -46,6 +46,8 @@
import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.core.util.ReaderInputStream;
import org.teiid.language.Call;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.Procedure;
import org.teiid.metadata.ProcedureParameter;
@@ -79,6 +81,7 @@
@Override
public void execute() throws TranslatorException {
files = FileConnection.Util.getFiles((String)command.getArguments().get(0).getArgumentValue().getValue(), fc);
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Getting", files != null ? files.length : 0, "file(s)"); //$NON-NLS-1$ //$NON-NLS-2$
String name = command.getProcedureName();
if (name.equalsIgnoreCase(GETTEXTFILES)) {
isText = true;
@@ -104,6 +107,7 @@
}
ArrayList<Object> result = new ArrayList<Object>(2);
final File file = files[index++];
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Getting", file); //$NON-NLS-1$
FileInputStreamFactory isf = new FileInputStreamFactory(file);
isf.setLength(file.length());
Object value = null;
@@ -156,6 +160,7 @@
if (file == null || filePath == null) {
throw new TranslatorException(UTIL.getString("non_null")); //$NON-NLS-1$
}
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Saving", filePath); //$NON-NLS-1$
InputStream is = null;
try {
if (file instanceof SQLXML) {
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -85,6 +85,7 @@
private boolean widenUnsingedTypes = true;
private boolean quoteNameInSource = true;
private boolean useProcedureSpecificName;
+ private boolean useCatalogName = true;
private Set<String> unsignedTypes = new HashSet<String>();
private String quoteString;
@@ -422,14 +423,12 @@
if (schemaName != null && schemaName.length() > 0) {
fullName = (quoted?quoteName(schemaName):schemaName) + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
}
- if (catalogName != null && catalogName.length() > 0) {
+ if (useCatalogName && catalogName != null && catalogName.length() > 0) {
fullName = (quoted?quoteName(catalogName):catalogName) + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
}
return fullName;
}
-
-
public void setTableNamePattern(String tableNamePattern) {
this.tableNamePattern = tableNamePattern;
}
@@ -483,4 +482,8 @@
this.useProcedureSpecificName = useProcedureSpecificName;
}
+ public void setUseCatalogName(boolean useCatalog) {
+ this.useCatalogName = useCatalog;
+ }
+
}
Modified: trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java
===================================================================
--- trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -54,9 +54,9 @@
protected OlapExecutionFactory executionFactory;
private OlapStatement stmt;
private CellSet cellSet;
- private CellSetAxis cols;
+ private CellSetAxis columnsAxis;
private int colWidth;
- private ListIterator<Position> iterator;
+ private ListIterator<Position> rowPositionIterator;
public OlapQueryExecution(Command command, OlapConnection connection, ExecutionContext context, OlapExecutionFactory executionFactory) {
this.command = command;
@@ -74,10 +74,10 @@
stmt = this.connection.createStatement();
cellSet = stmt.executeOlapQuery(mdxQuery);
- CellSetAxis rows = this.cellSet.getAxes().get(Axis.ROWS.axisOrdinal());
- iterator = rows.iterator();
- cols = cellSet.getAxes().get(Axis.COLUMNS.axisOrdinal());
- colWidth = rows.getAxisMetaData().getHierarchies().size() + this.cols.getPositions().size();
+ CellSetAxis rowAxis = this.cellSet.getAxes().get(Axis.ROWS.axisOrdinal());
+ rowPositionIterator = rowAxis.iterator();
+ columnsAxis = cellSet.getAxes().get(Axis.COLUMNS.axisOrdinal());
+ colWidth = rowAxis.getAxisMetaData().getHierarchies().size() + this.columnsAxis.getPositions().size();
} catch (SQLException e) {
throw new TranslatorException(e);
}
@@ -109,22 +109,22 @@
@Override
public List<?> next() throws TranslatorException {
- if (!iterator.hasNext()) {
+ if (!rowPositionIterator.hasNext()) {
return null;
}
- Position nextRow = iterator.next();
+ Position rowPosition = rowPositionIterator.next();
Object[] result = new Object[colWidth];
int i = 0;
// add in rows axis
- List<Member> members = nextRow.getMembers();
+ List<Member> members = rowPosition.getMembers();
for (Member member:members) {
- String columnName = member.getHierarchy().getName();
+ String columnName = member.getName();
result[i++] = columnName;
}
// add col axis
- for (Position colPos : cols) {
- Cell cell = cellSet.getCell(colPos, nextRow);
+ for (Position colPos : columnsAxis) {
+ Cell cell = cellSet.getCell(colPos, rowPosition);
result[i++] = cell.getValue();
}
ArrayList<Object[]> results = new ArrayList<Object[]>();
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -387,16 +387,16 @@
displayName="Connector Batch Size"
description="The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024)"
required="false" readOnly="false" />
- <c:simple-property name="BufferService.maxProcessingBatchesColumns"
- displayName="Max Processing Batches Columns"
- description="The number of batch columns guarenteed to a processing operation. Set this value lower if the workload typically processes larger numbers of concurrent queries with large intermediate results from operations such as sorting, grouping, etc. (default 128)"
+ <c:simple-property name="BufferService.maxProcessingKb"
+ displayName="Max Processing Memory"
+ description="The approximate amount of buffer memory in kilobytes allowable for a single processing operation (sort, grouping, etc.) regardless of existing memory commitments. -1 means to automatically calculate a value (default -1)."
required="false" readOnly="false" />
<c:simple-property name="BufferService.maxFileSize" displayName="Max File Size"
description="Max file size for buffer files (default 2GB)"
required="false" readOnly="false" />
- <c:simple-property name="BufferService.maxReserveBatchColumns"
- displayName="Max Reserve Batch Columns"
- description="The number of batch columns to allow in memory (default 16384). This value should be set lower or higher depending on the available memory to Teiid in the VM. 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap."
+ <c:simple-property name="BufferService.maxReserveKb"
+ displayName="Max Reserve Memory"
+ description="The approximate amount of memory in kilobytes allowed to be held by the buffer manager. -1 means to automatically calculate a value (default -1)."
required="false" readOnly="false" />
</c:group>
<c:group name="JdbcSocketConfiguration" displayName="Jdbc Socket Configuration Properties" hiddenByDefault="false">
Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -18,12 +18,10 @@
accessing the Teiid server simultaneously.
</para>
<para>
- The <code>maxReserveBatchColumns</code>
- setting determines the total size of batches that can be held by the BufferManager in memory.
- This number does not include persistent batches held by soft (such as
+ The <code>maxReserveKb</code>
+ setting determines the total size in kilobytes of batches that can be held by the BufferManager in memory.
+ This number does not account for persistent batches held by soft (such as
index pages) or weak references.
- The value is treated internally as an approximation of bytes using the conversion
- <code>maxReserveBatchColumns</code> * <code>processorBatchSize</code> * (64bytes per column value).
The default value of -1 will auto-calculate a typical max based upon the max heap available to the VM.
The auto-calculated value assumes a 64bit architecture and will limit buffer usage to 50% of the first
gigabyte of memory beyond the first 300 megabytes (which are assumed for use by the AS and other Teiid purposes)
@@ -39,22 +37,21 @@
</para>
<note>
<para>Memory consumption can be significantly more or less than the nominal target
- depending upon actual column values and whether value caching is enabled. Large strings, bigintegers, bigdecimals, or values typed as object can exceed their default size estimate.
- If an out of memory errors occur, then set a lower the maxReserveBatchColumns value.
+ depending upon actual column values and whether value caching is enabled. Large non built-in type objects can exceed their default size estimate.
+ If an out of memory errors occur, then set a lower the maxReserveKb value. Also note that source lob values are held by memory references that are not cleared when a batch is persisted.
+ With heavy lob usage you should ensure that buffers of other memory associated with lob references are appropiately sized.
</para>
</note>
<para>
- The <code>maxProcessingBatchesColumns</code>
- setting determines the total size of batches that can be used by active plans regardless of the memory held based on <code>maxReserveBatchColumns</code>.
- The value is treated internally as an approximation of bytes using the conversion
- <code>maxProcessingBatchesColumns</code> * <code>processorBatchSize</code> * (64bytes per column value).
+ The <code>maxProcessingKb</code>
+ setting determines the total size in kilobytes of batches that can be used by active plans regardless of the memory held based on <code>maxReserveKb</code>.
The default value of -1 will auto-calculate a typical max based upon the max heap available to the VM and max active plans.
The auto-calculated value assumes a 64bit architecture and will limit processing batch usage to 10% of memory
beyond the first 300 megabytes (which are assumed for use by the AS and other Teiid purposes).
</para>
<para>
- In systems where large intermediate results are normal (scrolling cursors or sorting over millions of rows) you can consider increasing the <code>maxProcessingBatchColumns</code> and decreasing
- the <code>maxReserveBatchColumns</code> so that each request has access to an effectively smaller buffer space.
+ In systems where large intermediate results are normal (scrolling cursors or sorting over millions of rows) you can consider increasing the <code>maxProcessingKb</code> and decreasing
+ the <code>maxReserveKb</code> so that each request has access to an effectively smaller buffer space.
</para>
<para>
Each intermediate result buffer, temporary LOB, and temporary table
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/security.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/security.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/security.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="custom_login_modules">
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter>
+<title>Custom Security</title>
+<section id="custom_login_modules">
<title>Login Modules</title>
<para>The Teiid system provides a range of built-in and extensible security features to enable the
secure access of data. For details about how to configure the available security features check out
@@ -92,4 +97,27 @@
<para>If you are extending one of the built-in LoginModules, refer to
<ulink url="http://community.jboss.org/docs/DOC-9466"/>.</para>
</section>
+</section>
+<section>
+ <title>Custom Authorization</title>
+ <para>In situations where Teiid's built-in role mechanism is not sufficient, a custom
+ <code>org.teiid.PolicyDecider</code> can be installed via the &jboss-beans; configuration file under the "AuthorizationValidator" bean.
+ <example>
+ <title>Example Configuration Snippet</title>
+ <programlisting role="XML" language="XML"><![CDATA[
+ <bean name="AuthorizationValidator" class="org.teiid.dqp.internal.process.DefaultAuthorizationValidator">
+ <property name="enabled">true</property>
+ <property name="policyDecider"><inject bean="PolicyDecider"/></property>
+ </bean>
+
+ <bean name="PolicyDecider" class="com.company.CustomPolicyDecider">
+ <property name="someProperty">some value</property>
+ </bean>]]>
+ </programlisting>
+ </example>
+ Your custom <code>PolicyDecider</code> should be installed in a jar that is made available to the same classloader as Teiid, typically the profile lib directory.
+ A <code>PolicyDecider</code> may be consulted many times for a single user command, but it is only called to make decisions based upon resources that
+ appear in user queries. Any further access of resources through views or stored procedures, just as with data roles, is not checked against a <code>PolicyDecider.</code>
+ </para>
+</section>
</chapter>
\ No newline at end of file
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/architecture.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/architecture.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/architecture.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -131,7 +131,9 @@
specified timeout period, a ‘cancel’ command is issued to the
server for the request and no results are returned to the
client. The cancel command is issued by the JDBC API without the
- client’s intervention.</para>
+ client’s intervention. See the Client Developers Guide for more on setting
+ statement timeouts via the connection property "QUERYTIMEOUT" and see the Java JDBC API for setting
+ the query timeout via <code>java.sql.Statement.setQueryTimeout</code> method.</para>
</section>
</section>
<section>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/dataroles.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/dataroles.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/dataroles.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -168,4 +168,8 @@
<para>The <code>hasRole</code> system function will return true if the current user has the given data role.
The <code>hasRole</code> function can be used in procedure or view definitions to allow for a more dynamic application of security - which allows for things such as value masking or row level security.</para>
</section>
+ <section>
+ <title>Customizing</title>
+ <para>See the Developer's Guide Custom Security Chapter for details on using an alternative authorization scheme.</para>
+ </section>
</chapter>
\ No newline at end of file
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -377,6 +377,41 @@
</listitem>
</itemizedlist>
</section>
+ <section id="xquery_optimization">
+ <title>XQuery Optimization</title>
+ <para>A technique known as document projection is used to reduce the memory footprint of the context item document.
+ Document projection loads only the parts of the document needed by the relevant XQuery and path expressions.
+ Since document projection analysis uses all relevant path expressions, even 1 expression that could potentially use many nodes, e.g. //x rather than /a/b/x will cause a larger memory footprint.
+ With the relevant content removed the entire document will still be loaded into memory for processing.
+ Document projection will only be used when there is a context item (unnamed PASSING clause item) passed to XMLTABLE/XMLQUERY. A named variable will not have document projection performed.
+ In some cases the expressions used may be too complex for the optimizer to use document projection. You should check the SHOWPLAN DEBUG full plan output to see if the appropriate optimization has been performed.</para>
+ <para>With additional restrictions, simple context path expressions allow the processor to evaluate document subtrees independently - without loading the full document in memory.
+ A simple context path expression can be of the form "[/][ns:]root/[ns1:]elem/...", where a namespace prefix or element name can also be the * wild card. As with normal XQuery processing if namespace prefixes are used in the XQuery expression, they should be declared using the XMLNAMESPACES clause.</para>
+ <example>
+ <title>Streaming Eligible XMLQUERY</title>
+ <programlisting>XMLQUERY('/*:root/*:child' PASSING doc)</programlisting>
+ <para>Rather than loading the entire doc in-memory as a DOM tree, each child element will be independently added to the result.</para>
+ </example>
+ <example>
+ <title>Streaming Ineligible XMLQUERY</title>
+ <programlisting>XMLQUERY('//child' PASSING doc)</programlisting>
+ <para>The use of the descendent axis prevents the streaming optimization, but document projection can still be performed.</para>
+ </example>
+ <para>When using XMLTABLE, the COLUMN PATH expressions have additional restrictions.
+ They are allowed to reference any part of the element subtree formed by the context expression and they may use any attribute value from their direct parentage.
+ Any path expression where it is possible to reference a non-direct ancestor or sibling of the current context item prevent streaming from being used.
+ </para>
+ <example>
+ <title>Streaming Eligible XMLTABLE</title>
+ <programlisting>XMLTABLE('/*:root/*:child' PASSING doc COLUMNS fullchild XML PATH '.', parent_attr string PATH '../@attr', child_val integer)</programlisting>
+ <para>The context XQuery and the column path expression allow the streaming optimization, rather than loading the entire doc in-memory as a DOM tree, each child element will be independently added to the result.</para>
+ </example>
+ <example>
+ <title>Streaming Ineligible XMLTABLE</title>
+ <programlisting>XMLTABLE('/*:root/*:child' PASSING doc COLUMNS sibling_attr string PATH '../other_child/@attr')</programlisting>
+ <para>The reference of an element outside of the child subtree in the sibling_attr path prevents the streaming optimization from being used, but document projection can still be performed.</para>
+ </example>
+ </section>
<section>
<title>Federated Failure Modes</title>
<section>
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -2036,9 +2036,7 @@
<para>xquery in string. Return value is xml.</para>
<para>XMLQUERY is part of the SQL/XML 2006 specification.</para>
<para>See also <link linkend="xmltable">XMLTABLE</link></para>
- <note><para>A technique known as document projection is used to reduce the memory footprint of the context item document.
- Only the parts of the document needed by the XQuery path expressions will be loaded into memory. Since document projection analysis uses all relevant path expressions, even 1 expression that could potentially use many nodes, e.g. //x rather than /a/b/x will cause a larger memory footprint.</para></note>
-
+ <note><para>See also <xref linkend="xquery_optimization"/></para></note>
</section>
<section id="xmlserialize">
<title>XMLSERIALIZE</title>
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -108,6 +108,12 @@
resulting names are unambiguous in the context of the command.
Different forms of qualification can be mixed in the same query.
</para>
+ <section>
+ <title>Reserved Words</title>
+ <para>Teiid's reserved words include the standard SQL 2003 Foundation, SQL/MED, and SQL/XML reserved words, as well as Teiid specific words such as BIGINTEGER, BIGDECIMAL, or MAKEDEP.
+ See the <xref linkend="grammar"/> TOKENS section for all reserved words. They will appear as 'SMALLINT: "smallint"' where the quoted string is the actual lexical form.
+ </para>
+ </section>
</section>
<section>
<title>Expressions</title>
@@ -832,6 +838,7 @@
<para>See XMLELEMENT for the definition of NSP - <link linkend="xmlnamespaces">XMLNAMESPACES</link>.</para>
<para>See XMLQUERY for the definition of <link linkend="passing">PASSING</link>.</para>
<para>See also <link linkend="xmlquery">XMLQUERY</link></para>
+ <note><para>See also <xref linkend="xquery_optimization"/></para></note>
<itemizedlist>
<para>Parameters</para>
<listitem>
@@ -843,10 +850,21 @@
</para>
</listitem>
<listitem>
- <para>If COLUMNS is not specified, then that is the same as having the COLUMNS clause: "COLUMNS OBJECT_VALUE XML PATH '.'", which returns the entire item as an XML value. Each non-ordinality column specifies a type and optionally a PATH and a DEFAULT expression.
- If PATH is not specified, then the path will be the same as the column name. A FOR ORDINALITY column is typed as integer and will return the 1-based item number as its value.
+ <para>If COLUMNS is not specified, then that is the same as having the COLUMNS clause: "COLUMNS OBJECT_VALUE XML PATH '.'", which returns the entire item as an XML value.
</para>
</listitem>
+ <listitem>
+ <para>A FOR ORDINALITY column is typed as integer and will return the 1-based item number as its value.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Each non-ordinality column specifies a type and optionally a PATH and a DEFAULT expression.
+ </para>
+ </listitem>
+ <listitem>
+ <para>If PATH is not specified, then the path will be the same as the column name.
+ </para>
+ </listitem>
</itemizedlist>
<itemizedlist>
<para>Syntax Rules:
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1807,6 +1807,32 @@
<para><synopsis>SYS.getXMLSchemas(document in string) returns schema string</synopsis></para>
</section>
<section>
+ <title>SYSADMIN.logMsg</title>
+ <para>Log a message to the underlying logging system.</para>
+ <para><synopsis>SYSADMIN.logMsg(logged RETURN boolean, level IN string, context IN string, msg IN object)</synopsis></para>
+ <para>Returns true if the message was logged. level can be one of the log4j levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE. level defaults to 'DEBUG' and context defaults to 'org.teiid.PROCESSOR'</para>
+ <example lang="sql">
+ <title>Example logMsg</title>
+ <programlisting>CALL SYSADMIN.logMsg(msg=>'some debug', context=>'org.something')</programlisting>
+ <para>This will log the message 'some debug' at the default level DEBUG to the context org.something.</para>
+ </example>
+ </section>
+ <section>
+ <title>SYSADMIN.isLoggable</title>
+ <para>Tests if logging is enabled at the given level and context.</para>
+ <para><synopsis>SYSADMIN.isLoggable(loggable RETURN boolean, level IN string, context IN string)</synopsis></para>
+ <para>Returns true if logging is enabled. level can be one of the log4j levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE. level defaults to 'DEBUG' and context defaults to 'org.teiid.PROCESSOR'</para>
+ <example lang="sql">
+ <title>Example isLoggable</title>
+ <programlisting>IF ((CALL SYSADMIN.isLoggable(context=>'org.something'))
+BEGIN
+ DECLARE STRING msg;
+ // logic to build the message ...
+ CALL SYSADMIN.logMsg(msg=>msg, context=>'org.something')
+END</programlisting>
+ </example>
+ </section>
+ <section>
<title>SYSADMIN.refreshMatView</title>
<para>Returns integer RowsUpdated. -1 indicates a load is in progress, otherwise the cardinality of the table is returned. See the Caching Guide for more.</para>
<para><synopsis>SYSADMIN.refreshMatView(RowsUpdated return integer, ViewName in string, Invalidate in boolean)</synopsis></para>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -166,36 +166,37 @@
</tgroup>
</table>
- <para>There are file importer settings, but it does provide metadata for dynamic vdbs.</para>
-
<section>
<title>Usage</title>
<para>
- Retrieve all files as BLOBs with the given extension at the given path.
+ Retrieve all files as BLOBs with an optional extension at the given path.
</para>
<programlisting>call getFiles('path/*.ext')</programlisting>
<para>
+ If the extension path is specified, then it will filter all of the file in the directory referenced by the base path.
If the extension pattern is not specified and the path is a directory,
- then all files in the directory will be returned. If the path or filename
+ then all files in the directory will be returned. Otherwise the single file referenced will be returned. If the path
doesn't exist, then no results will be returned.
</para>
<para>
- Retrieve all files as CLOBs with the given extension at the given path.
+ Retrieve all files as CLOB(s) with the an optional extension at the given path.
</para>
<programlisting>call getTextFiles('path/*.ext')</programlisting>
<para>
- Save the CLOB, BLOB, or XML file to given path
+ All the same files a getFiles will be retrieved, the only difference is that
+ the results will be CLOB values using the encoding execution property as the character set.
</para>
- <programlisting>call saveFile('path', value)</programlisting>
<para>
- See the database metadata for full descriptions of the getFiles,
- getTextFiles, and saveFile procedures.
+ Save the CLOB, BLOB, or XML value to given path
</para>
+ <programlisting>call saveFile('path', value)</programlisting>
+
+ <para>The path should reference a new file location or an existing file to overwrite completely.</para>
</section>
<section>
@@ -467,6 +468,12 @@
<entry>true will allow the import of overloaded procedures (which will normally result in a duplicate procedure error) by using the unique procedure specific name as the Teiid name. This option will only work with JDBC 4.0 compatable drivers that report specific names.</entry>
<entry>false</entry>
</row>
+ <row>
+ <entry>useCatalogName</entry>
+ <entry>true will use any non-null/non-empty catalog name as part of the name in source, e.g. "catalog"."table"."column", and in the Teiid runtime name if useFullSchemaName is true.
+ false will not use the catalog name in either the name in source or the Teiid runtime name. Should be set to false for sources that do not fully support a catalog concept, but return a non-null catalog name in their metadata - such as HSQL.</entry>
+ <entry>true</entry>
+ </row>
</tbody>
</tgroup>
</table>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/pom.xml 2011-06-28 03:47:29 UTC (rev 3280)
@@ -91,7 +91,19 @@
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>nux</groupId>
+ <artifactId>nux</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ <version>1.2</version>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -67,8 +67,8 @@
public static int DEFAULT_CONNECTOR_BATCH_SIZE = 1024;
public static int DEFAULT_PROCESSOR_BATCH_SIZE = 512;
- public static int DEFAULT_MAX_PROCESSING_BATCHES = -1;
- public static int DEFAULT_RESERVE_BUFFERS = -1;
+ public static int DEFAULT_MAX_PROCESSING_KB = -1;
+ public static int DEFAULT_RESERVE_BUFFER_KB = -1;
/**
* Get the batch size to use during query processing.
Property changes on: trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/BufferManager.java:3220-3275
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -156,6 +156,10 @@
this.types = types;
}
+ public String[] getDataTypes() {
+ return types;
+ }
+
public boolean containsRow(int row) {
return rowOffset <= row && getEndRow() >= row;
}
Property changes on: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/TupleBatch.java:3220-3275
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -365,4 +365,8 @@
return prefersMemory;
}
+ public String[] getTypes() {
+ return types;
+ }
+
}
Property changes on: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java:3149-3217
+ /branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java:3149-3217,3220-3275
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -33,6 +33,7 @@
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
@@ -64,6 +65,7 @@
import org.teiid.dqp.internal.process.DQPConfiguration;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
import org.teiid.query.QueryPlugin;
import org.teiid.query.processor.relational.ListNestedSortComparator;
import org.teiid.query.sql.symbol.Expression;
@@ -87,25 +89,24 @@
*/
public class BufferManagerImpl implements BufferManager, StorageManager {
- public static final double KB_PER_VALUE = 64d/1024;
private static final int IO_BUFFER_SIZE = 1 << 14;
private static final int COMPACTION_THRESHOLD = 1 << 25; //start checking at 32 megs
private final class BatchManagerImpl implements BatchManager {
private final String id;
- private final int columnCount;
private volatile FileStore store;
private Map<Long, long[]> physicalMapping = new ConcurrentHashMap<Long, long[]>();
private ReadWriteLock compactionLock = new ReentrantReadWriteLock();
private AtomicLong unusedSpace = new AtomicLong();
private int[] lobIndexes;
+ private SizeUtility sizeUtility;
- private BatchManagerImpl(String newID, int columnCount, int[] lobIndexes) {
+ private BatchManagerImpl(String newID, int[] lobIndexes) {
this.id = newID;
- this.columnCount = columnCount;
this.store = createFileStore(id);
this.store.setCleanupReference(this);
this.lobIndexes = lobIndexes;
+ this.sizeUtility = new SizeUtility();
}
public FileStore createStorage(String prefix) {
@@ -185,7 +186,7 @@
ManagedBatchImpl removeBatch(int row) {
ManagedBatchImpl result = batches.remove(row);
if (result != null) {
- activeBatchColumnCount -= result.batchManager.columnCount;
+ activeBatchKB -= result.sizeEstimate;
}
return result;
}
@@ -200,17 +201,19 @@
private BatchManagerImpl batchManager;
private long id;
private LobManager lobManager;
+ private int sizeEstimate;
public ManagedBatchImpl(TupleBatch batch, BatchManagerImpl manager, boolean softCache) {
this.softCache = softCache;
id = batchAdded.incrementAndGet();
- LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "Add batch to BufferManager", id); //$NON-NLS-1$
this.activeBatch = batch;
this.beginRow = batch.getBeginRow();
this.batchManager = manager;
if (this.batchManager.lobIndexes != null) {
this.lobManager = new LobManager();
}
+ sizeEstimate = (int) Math.max(1, manager.sizeUtility.getBatchSize(batch) / 1024);
+ LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "Add batch to BufferManager", id, "with size estimate", sizeEstimate); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
@@ -225,7 +228,7 @@
if (batch == null) {
return; //already removed
}
- activeBatchColumnCount += batchManager.columnCount;
+ activeBatchKB += sizeEstimate;
TupleBufferInfo tbi = null;
if (update) {
tbi = activeBatches.remove(batchManager.id);
@@ -287,6 +290,7 @@
try {
this.batchManager.compactionLock.readLock().lock();
long[] info = batchManager.physicalMapping.get(this.id);
+ Assertion.isNotNull(info, "Invalid batch " + id); //$NON-NLS-1$
ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(batchManager.store.createInputStream(info[0]), IO_BUFFER_SIZE));
batch = new TupleBatch();
batch.setDataTypes(types);
@@ -341,7 +345,7 @@
}
if (softCache) {
this.batchReference = new SoftReference<TupleBatch>(batch);
- } else {
+ } else if (useWeakReferences) {
this.batchReference = new WeakReference<TupleBatch>(batch);
}
}
@@ -385,22 +389,21 @@
private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
//set to acceptable defaults for testing
- private int maxProcessingBatches = 128;
- private int maxReserveBatchColumns = 16384;
- private int maxProcessingKB;
- private int maxReserveBatchKB;
+ private int maxProcessingKB = 1 << 11;
+ private Integer maxProcessingKBOrig;
+ private int maxReserveKB = 1 << 25;
private volatile int reserveBatchKB;
private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS; //used as a hint to set the reserveBatchKB
+ private boolean useWeakReferences = true;
private ReentrantLock lock = new ReentrantLock(true);
private Condition batchesFreed = lock.newCondition();
- private volatile int activeBatchColumnCount = 0;
+ private volatile int activeBatchKB = 0;
private Map<String, TupleBufferInfo> activeBatches = new LinkedHashMap<String, TupleBufferInfo>();
private Map<String, TupleReference> tupleBufferMap = new ConcurrentHashMap<String, TupleReference>();
private ReferenceQueue<TupleBuffer> tupleBufferQueue = new ReferenceQueue<TupleBuffer>();
-
private StorageManager diskMgr;
private AtomicLong tsId = new AtomicLong();
@@ -431,10 +434,6 @@
return maxProcessingKB;
}
- public void setMaxProcessingBatchColumns(int maxProcessingBatches) {
- this.maxProcessingBatches = maxProcessingBatches;
- }
-
/**
* Get processor batch size
* @return Number of rows in a processor batch
@@ -480,17 +479,19 @@
TupleSourceType tupleSourceType) {
final String newID = String.valueOf(this.tsId.getAndIncrement());
int[] lobIndexes = LobManager.getLobIndexes(elements);
- BatchManager batchManager = new BatchManagerImpl(newID, elements.size(), lobIndexes);
+ BatchManager batchManager = new BatchManagerImpl(newID, lobIndexes);
TupleBuffer tupleBuffer = new TupleBuffer(batchManager, newID, elements, lobIndexes, getProcessorBatchSize());
- LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Creating TupleBuffer:", newID, "of type ", tupleSourceType); //$NON-NLS-1$ //$NON-NLS-2$
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Creating TupleBuffer:", newID, elements, Arrays.toString(tupleBuffer.getTypes()), "of type", tupleSourceType); //$NON-NLS-1$ //$NON-NLS-2$
+ }
return tupleBuffer;
}
public STree createSTree(final List elements, String groupName, int keyLength) {
String newID = String.valueOf(this.tsId.getAndIncrement());
int[] lobIndexes = LobManager.getLobIndexes(elements);
- BatchManager bm = new BatchManagerImpl(newID, elements.size(), lobIndexes);
- BatchManager keyManager = new BatchManagerImpl(String.valueOf(this.tsId.getAndIncrement()), keyLength, null);
+ BatchManager bm = new BatchManagerImpl(newID, lobIndexes);
+ BatchManager keyManager = new BatchManagerImpl(String.valueOf(this.tsId.getAndIncrement()), null);
int[] compareIndexes = new int[keyLength];
for (int i = 1; i < compareIndexes.length; i++) {
compareIndexes[i] = i;
@@ -509,27 +510,35 @@
this.maxActivePlans = maxActivePlans;
}
+ public void setMaxProcessingKB(int maxProcessingKB) {
+ this.maxProcessingKB = maxProcessingKB;
+ }
+
+ public void setMaxReserveKB(int maxReserveBatchKB) {
+ this.maxReserveKB = maxReserveBatchKB;
+ }
+
@Override
public void initialize() throws TeiidComponentException {
int maxMemory = (int)Math.min(Runtime.getRuntime().maxMemory() / 1024, Integer.MAX_VALUE);
maxMemory -= 300 * 1024; //assume 300 megs of overhead for the AS/system stuff
- if (maxReserveBatchColumns < 0) {
- this.maxReserveBatchKB = 0;
+ if (maxReserveKB < 0) {
+ this.maxReserveKB = 0;
int one_gig = 1024 * 1024;
if (maxMemory > one_gig) {
//assume 75% of the memory over the first gig
- this.maxReserveBatchKB += (int)Math.max(0, (maxMemory - one_gig) * .75);
+ this.maxReserveKB += (int)Math.max(0, (maxMemory - one_gig) * .75);
}
- this.maxReserveBatchKB += Math.max(0, Math.min(one_gig, maxMemory) * .5);
- } else {
- this.maxReserveBatchKB = Math.max(0, (int)Math.min(maxReserveBatchColumns * KB_PER_VALUE * processorBatchSize, Integer.MAX_VALUE));
+ this.maxReserveKB += Math.max(0, Math.min(one_gig, maxMemory) * .5);
}
- this.reserveBatchKB = this.maxReserveBatchKB;
- if (this.maxProcessingBatches < 0) {
- this.maxProcessingKB = Math.max((int)Math.min(128 * KB_PER_VALUE * processorBatchSize, Integer.MAX_VALUE), (int)(.1 * maxMemory)/maxActivePlans);
- } else {
- this.maxProcessingKB = Math.max(0, (int)Math.min(Math.ceil(maxProcessingBatches * KB_PER_VALUE * processorBatchSize), Integer.MAX_VALUE));
+ this.reserveBatchKB = this.maxReserveKB;
+ if (this.maxProcessingKBOrig == null) {
+ //store the config value so that we can be reinitialized (this is not a clean approach)
+ this.maxProcessingKBOrig = this.maxProcessingKB;
}
+ if (this.maxProcessingKBOrig < 0) {
+ this.maxProcessingKB = Math.max(Math.min(8 * processorBatchSize, Integer.MAX_VALUE), (int)(.1 * maxMemory)/maxActivePlans);
+ }
}
@Override
@@ -537,6 +546,9 @@
if (count < 1) {
return;
}
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
+ LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "Releasing buffer space", count); //$NON-NLS-1$
+ }
lock.lock();
try {
this.reserveBatchKB += count;
@@ -548,11 +560,14 @@
@Override
public int reserveBuffers(int count, BufferReserveMode mode) {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
+ LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "Reserving buffer space", count, mode); //$NON-NLS-1$
+ }
lock.lock();
try {
if (mode == BufferReserveMode.WAIT) {
//don't wait for more than is available
- int waitCount = Math.min(count, this.maxReserveBatchKB);
+ int waitCount = Math.min(count, this.maxReserveKB);
while (waitCount > 0 && waitCount > this.reserveBatchKB) {
try {
batchesFreed.await(100, TimeUnit.MILLISECONDS);
@@ -576,13 +591,13 @@
}
void persistBatchReferences() {
- if (activeBatchColumnCount == 0 || activeBatchColumnCount <= reserveBatchKB) {
- int memoryCount = activeBatchColumnCount + maxReserveBatchColumns - reserveBatchKB;
+ if (activeBatchKB == 0 || activeBatchKB <= reserveBatchKB) {
+ int memoryCount = activeBatchKB + maxReserveKB - reserveBatchKB;
if (DataTypeManager.isValueCacheEnabled()) {
- if (memoryCount < maxReserveBatchColumns / 8) {
+ if (memoryCount < maxReserveKB / 8) {
DataTypeManager.setValueCacheEnabled(false);
}
- } else if (memoryCount > maxReserveBatchColumns / 4) {
+ } else if (memoryCount > maxReserveKB / 4) {
DataTypeManager.setValueCacheEnabled(true);
}
return;
@@ -590,7 +605,7 @@
while (true) {
ManagedBatchImpl mb = null;
synchronized (activeBatches) {
- if (activeBatchColumnCount == 0 || activeBatchColumnCount * 5 < reserveBatchKB * 4) {
+ if (activeBatchKB == 0 || activeBatchKB < reserveBatchKB * .8) {
break;
}
Iterator<TupleBufferInfo> iter = activeBatches.values().iterator();
@@ -624,43 +639,12 @@
//this includes alignment, row/array, and reference overhead
for (Expression element : elements) {
Class<?> type = element.getType();
- if (type == DataTypeManager.DefaultDataClasses.STRING) {
- total += isValueCacheEnabled?100:256; //assumes an "average" string length of approximately 100 chars
- } else if (type == DataTypeManager.DefaultDataClasses.DATE
- || type == DataTypeManager.DefaultDataClasses.TIME
- || type == DataTypeManager.DefaultDataClasses.TIMESTAMP) {
- total += isValueCacheEnabled?20:28;
- } else if (type == DataTypeManager.DefaultDataClasses.LONG
- || type == DataTypeManager.DefaultDataClasses.DOUBLE) {
- total += isValueCacheEnabled?12:16;
- } else if (type == DataTypeManager.DefaultDataClasses.INTEGER
- || type == DataTypeManager.DefaultDataClasses.FLOAT) {
- total += isValueCacheEnabled?6:12;
- } else if (type == DataTypeManager.DefaultDataClasses.CHAR
- || type == DataTypeManager.DefaultDataClasses.SHORT) {
- total += isValueCacheEnabled?4:10;
- } else if (type == DataTypeManager.DefaultDataClasses.OBJECT) {
- total += 1024;
- } else if (type == DataTypeManager.DefaultDataClasses.NULL) {
- //it's free
- } else if (type == DataTypeManager.DefaultDataClasses.BYTE) {
- total += 2; //always value cached
- } else if (type == DataTypeManager.DefaultDataClasses.BOOLEAN) {
- total += 1; //always value cached
- } else {
- total += 512; //assumes buffer overhead in the case of lobs
- //however the account for lobs is misleading as the lob
- //references are not actually removed from memory
- }
+ total += SizeUtility.getSize(isValueCacheEnabled, type);
}
total += 8*elements.size() + 36; // column list / row overhead
total *= processorBatchSize;
return Math.max(1, total / 1024);
}
-
- public void setMaxReserveBatchColumns(int maxReserve) {
- this.maxReserveBatchColumns = maxReserve;
- }
public void shutdown() {
}
@@ -698,4 +682,9 @@
id = referent.getId();
}
}
+
+ public void setUseWeakReferences(boolean useWeakReferences) {
+ this.useWeakReferences = useWeakReferences;
+ }
+
}
Copied: trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java (from rev 3275, branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/SizeUtility.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,205 @@
+/*
+ * 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.common.buffer.impl;
+
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.core.types.DataTypeManager;
+
+
+/**
+ * Utility methods to determine the size of Java objects, particularly with
+ * respect to the Teiid runtime types.
+ *
+ * The sizes are loosely based on expected heap size and are generally optimistic.
+ * Actual object allocation efficiency can be quite poor.
+ */
+public final class SizeUtility {
+ public static final int REFERENCE_SIZE = 8;
+
+ private long bigIntegerEstimate;
+ private long bigDecimalEstimate;
+
+ public SizeUtility() {
+ boolean isValueCacheEnabled = DataTypeManager.isValueCacheEnabled();
+ bigIntegerEstimate = getSize(isValueCacheEnabled, DataTypeManager.DefaultDataClasses.BIG_INTEGER);
+ bigDecimalEstimate = getSize(isValueCacheEnabled, DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
+ }
+
+ public long getBatchSize(TupleBatch data) {
+ return getBatchSize(DataTypeManager.isValueCacheEnabled(), data);
+ }
+
+ private long getBatchSize(boolean accountForValueCache, TupleBatch data) {
+ int colLength = data.getDataTypes().length;
+ int rowLength = data.getRowCount();
+
+ // Array overhead for row array
+ long size = 16 + alignMemory(rowLength * REFERENCE_SIZE);
+ // array overhead for all the columns ( 8 object overhead + 4 ref + 4 int)
+ size += (rowLength * (48 + alignMemory(colLength * REFERENCE_SIZE)));
+ for (int col = 0; col < colLength; col++) {
+ Class<?> type = DataTypeManager.getDataTypeClass(data.getDataTypes()[col]);
+
+ if (type == DataTypeManager.DefaultDataClasses.STRING
+ || type == DataTypeManager.DefaultDataClasses.OBJECT
+ || type == DataTypeManager.DefaultDataClasses.BIG_INTEGER
+ || type == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
+ int estRow = 0;
+ for (int row = 0; row < rowLength; row++) {
+ boolean updateEst = row == estRow;
+ size += getSize(data.getTuples().get(row).get(col), updateEst, accountForValueCache);
+ if (updateEst) {
+ estRow = estRow * 2 + 1;
+ }
+ }
+ } else {
+ size += getSize(accountForValueCache, type) * rowLength;
+ }
+ }
+ return size;
+ }
+
+ static int getSize(boolean isValueCacheEnabled,
+ Class<?> type) {
+ if (type == DataTypeManager.DefaultDataClasses.STRING) {
+ return isValueCacheEnabled?100:256; //assumes an "average" string length of approximately 100 chars
+ } else if (type == DataTypeManager.DefaultDataClasses.DATE
+ || type == DataTypeManager.DefaultDataClasses.TIME
+ || type == DataTypeManager.DefaultDataClasses.TIMESTAMP) {
+ return isValueCacheEnabled?20:28;
+ } else if (type == DataTypeManager.DefaultDataClasses.LONG
+ || type == DataTypeManager.DefaultDataClasses.DOUBLE) {
+ return isValueCacheEnabled?12:16;
+ } else if (type == DataTypeManager.DefaultDataClasses.INTEGER
+ || type == DataTypeManager.DefaultDataClasses.FLOAT) {
+ return isValueCacheEnabled?6:12;
+ } else if (type == DataTypeManager.DefaultDataClasses.CHAR
+ || type == DataTypeManager.DefaultDataClasses.SHORT) {
+ return isValueCacheEnabled?4:10;
+ } else if (type == DataTypeManager.DefaultDataClasses.OBJECT) {
+ return 1024;
+ } else if (type == DataTypeManager.DefaultDataClasses.NULL) {
+ return 0; //it's free
+ } else if (type == DataTypeManager.DefaultDataClasses.BYTE
+ || type == DataTypeManager.DefaultDataClasses.BOOLEAN) {
+ return 1; //should always be value cached, but there's a small chance it's not
+ } else if (type == DataTypeManager.DefaultDataClasses.BIG_INTEGER){
+ return isValueCacheEnabled?75:100;
+ } else if (type == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
+ return isValueCacheEnabled?150:200;
+ }
+ return 512; //assumes buffer overhead in the case of lobs
+ //however the account for lobs is misleading as the lob
+ //references are not actually removed from memory
+ }
+
+ /**
+ * Get size of object
+ * @return Size in bytes
+ */
+ protected long getSize(Object obj, boolean updateEstimate, boolean accountForValueCache) {
+ if(obj == null) {
+ return 0;
+ }
+
+ Class<?> type = DataTypeManager.determineDataTypeClass(obj);
+ if(type == DataTypeManager.DefaultDataClasses.STRING) {
+ int length = ((String)obj).length();
+ if (length > 0) {
+ return alignMemory(40 + (2 * length));
+ }
+ return 40;
+ } else if(obj instanceof Iterable<?>) {
+ Iterable<?> i = (Iterable<?>)obj;
+ long total = 16;
+ for (Object object : i) {
+ total += getSize(object, true, false) + REFERENCE_SIZE;
+ }
+ return total;
+ } else if(type == DataTypeManager.DefaultDataClasses.BIG_DECIMAL) {
+ if (!updateEstimate) {
+ return bigDecimalEstimate;
+ }
+ int bitLength = ((BigDecimal)obj).unscaledValue().bitLength();
+ //TODO: this does not account for the possibility of a cached string
+ long result = 88 + alignMemory(4 + (bitLength >> 3));
+ if (updateEstimate) {
+ bigDecimalEstimate = (bigDecimalEstimate + result)/2;
+ }
+ return result;
+ } else if(type == DataTypeManager.DefaultDataClasses.BIG_INTEGER) {
+ if (!updateEstimate) {
+ return bigIntegerEstimate;
+ }
+ int bitLength = ((BigInteger)obj).bitLength();
+ long result = 40 + alignMemory(4 + (bitLength >> 3));
+ if (updateEstimate) {
+ bigIntegerEstimate = (bigIntegerEstimate + result)/2;
+ }
+ return result;
+ } else if(obj.getClass().isArray()) {
+ Class<?> componentType = obj.getClass().getComponentType();
+ if (!componentType.isPrimitive()) {
+ Object[] rows = (Object[]) obj;
+ long total = 16 + alignMemory(rows.length * REFERENCE_SIZE); // Array overhead
+ for(int i=0; i<rows.length; i++) {
+ total += getSize(rows[i], true, false);
+ }
+ return total;
+ }
+ int length = Array.getLength(obj);
+ int primitiveSize = 8;
+ if (componentType == boolean.class) {
+ primitiveSize = 4;
+ } else if (componentType == byte.class) {
+ primitiveSize = 1;
+ } else if (componentType == short.class) {
+ primitiveSize = 2;
+ } else if (componentType == int.class || componentType == float.class) {
+ primitiveSize = 4;
+ }
+ return alignMemory(length * primitiveSize) + 16;
+ }
+ return getSize(accountForValueCache, type);
+ }
+
+ /**
+ * Most current VMs have memory alignment that places objects into heap space that is a multiple of 8 Bytes.
+ * This utility method helps with calculating the aligned size of an object.
+ * @param numBytes
+ * @return
+ * @since 4.2
+ */
+ private static long alignMemory(long numBytes) {
+ long remainder = numBytes % 8;
+ if (remainder != 0) {
+ numBytes += (8 - remainder);
+ }
+ return numBytes;
+ }
+
+}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -28,16 +28,17 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.teiid.CommandContext;
+import org.teiid.PolicyDecider;
import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.DataPolicy.Context;
import org.teiid.adminapi.DataPolicy.PermissionType;
-import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.core.CoreConstants;
import org.teiid.core.TeiidComponentException;
@@ -74,44 +75,19 @@
public class AuthorizationValidationVisitor extends AbstractValidationVisitor {
- public enum Context {
- CREATE,
- DROP,
- QUERY,
- INSERT,
- UPDATE,
- DELETE,
- FUNCTION,
- ALTER,
- STORED_PROCEDURE;
- }
-
- private HashMap<String, DataPolicy> allowedPolicies;
- private boolean allowCreateTemporaryTablesDefault = true;
- private boolean allowFunctionCallsByDefault = true;
private CommandContext commandContext;
+ private PolicyDecider decider;
- public AuthorizationValidationVisitor(HashMap<String, DataPolicy> policies, CommandContext commandContext) {
- this.allowedPolicies = policies;
+ public AuthorizationValidationVisitor(PolicyDecider decider, CommandContext commandContext) {
+ this.decider = decider;
this.commandContext = commandContext;
}
-
- public void setAllowCreateTemporaryTablesDefault(
- boolean allowCreateTemporaryTablesDefault) {
- this.allowCreateTemporaryTablesDefault = allowCreateTemporaryTablesDefault;
- }
-
- public void setAllowFunctionCallsByDefault(boolean allowFunctionCallsDefault) {
- this.allowFunctionCallsByDefault = allowFunctionCallsDefault;
- }
// ############### Visitor methods for language objects ##################
@Override
public void visit(Create obj) {
- Set<String> resources = Collections.singleton(obj.getTable().getName());
- Collection<GroupSymbol> symbols = Arrays.asList(obj.getTable());
- validateTemp(resources, symbols, Context.CREATE);
+ validateTemp(PermissionType.CREATE, obj.getTable(), Context.CREATE);
}
@Override
@@ -129,30 +105,18 @@
validateEntitlements(Arrays.asList(obj.getTarget()), DataPolicy.PermissionType.ALTER, Context.ALTER);
}
- private void validateTemp(Set<String> resources,
- Collection<GroupSymbol> symbols, Context context) {
+ private void validateTemp(DataPolicy.PermissionType action, GroupSymbol symbol, Context context) {
+ String resource = symbol.getNonCorrelationName();
+ Set<String> resources = Collections.singleton(resource);
logRequest(resources, context);
- boolean allowed = false;
- for(DataPolicy p:this.allowedPolicies.values()) {
- DataPolicyMetadata policy = (DataPolicyMetadata)p;
-
- if (policy.isAllowCreateTemporaryTables() == null) {
- if (allowCreateTemporaryTablesDefault) {
- allowed = true;
- break;
- }
- } else if (policy.isAllowCreateTemporaryTables()) {
- allowed = true;
- break;
- }
- }
+ boolean allowed = decider.isTempAccessable(action, resource, context, commandContext);
logResult(resources, context, allowed);
if (!allowed) {
handleValidationError(
QueryPlugin.Util.getString("ERR.018.005.0095", commandContext.getUserName(), "CREATE_TEMPORARY_TABLES"), //$NON-NLS-1$ //$NON-NLS-2$
- symbols);
+ Arrays.asList(symbol));
}
}
@@ -166,9 +130,7 @@
@Override
public void visit(Drop obj) {
- Set<String> resources = Collections.singleton(obj.getTable().getName());
- Collection<GroupSymbol> symbols = Arrays.asList(obj.getTable());
- validateTemp(resources, symbols, Context.CREATE);
+ validateTemp(PermissionType.DROP, obj.getTable(), Context.DROP);
}
public void visit(Delete obj) {
@@ -205,7 +167,7 @@
} catch (TeiidProcessingException e) {
handleException(e, obj);
}
- } else if (!allowFunctionCallsByDefault) {
+ } else {
String schema = obj.getFunctionDescriptor().getSchema();
if (schema != null && !isSystemSchema(schema)) {
Map<String, Function> map = new HashMap<String, Function>();
@@ -221,14 +183,13 @@
* Validate insert entitlements
*/
protected void validateEntitlements(Insert obj) {
+ List<LanguageObject> insert = new LinkedList<LanguageObject>();
+ insert.add(obj.getGroup());
+ insert.addAll(obj.getVariables());
validateEntitlements(
- obj.getVariables(),
+ insert,
DataPolicy.PermissionType.CREATE,
Context.INSERT);
-
- if (obj.getGroup().isTempTable()) {
- validateTemp(Collections.singleton(obj.getGroup().getNonCorrelationName()), Arrays.asList(obj.getGroup()), Context.INSERT);
- }
}
/**
@@ -248,7 +209,10 @@
// The variables from the changes must be checked for UPDATE entitlement
// validateEntitlements on all the variables used in the update.
- validateEntitlements(obj.getChangeList().getClauseMap().keySet(), DataPolicy.PermissionType.UPDATE, Context.UPDATE);
+ List<LanguageObject> updated = new LinkedList<LanguageObject>();
+ updated.add(obj.getGroup());
+ updated.addAll(obj.getChangeList().getClauseMap().keySet());
+ validateEntitlements(updated, DataPolicy.PermissionType.UPDATE, Context.UPDATE);
}
/**
@@ -275,12 +239,10 @@
Into intoObj = obj.getInto();
if ( intoObj != null ) {
GroupSymbol intoGroup = intoObj.getGroup();
- if (intoGroup.isTempTable()) {
- validateTemp(Collections.singleton(intoGroup.getNonCorrelationName()), Arrays.asList(intoGroup), Context.INSERT);
- }
- List<ElementSymbol> intoElements = null;
+ Collection<LanguageObject> intoElements = new LinkedList<LanguageObject>();
+ intoElements.add(intoGroup);
try {
- intoElements = ResolverUtil.resolveElementsInGroup(intoGroup, getMetadata());
+ intoElements.addAll(ResolverUtil.resolveElementsInGroup(intoGroup, getMetadata()));
} catch (QueryMetadataException err) {
handleException(err, intoGroup);
} catch (TeiidComponentException err) {
@@ -292,7 +254,7 @@
}
// Validate this query's entitlements
- Collection entitledObjects = GroupCollectorVisitor.getGroups(obj, true);
+ Collection<LanguageObject> entitledObjects = new ArrayList<LanguageObject>(GroupCollectorVisitor.getGroupsIgnoreInlineViews(obj, true));
if (!isXMLCommand(obj)) {
entitledObjects.addAll(ElementCollectorVisitor.getElements(obj, true));
}
@@ -319,7 +281,7 @@
* @param auditContext The {@link AuthorizationService} to use when resource auditing is done.
*/
protected void validateEntitlements(Collection<? extends LanguageObject> symbols, DataPolicy.PermissionType actionCode, Context auditContext) {
- Map<String, LanguageObject> nameToSymbolMap = new HashMap<String, LanguageObject>();
+ Map<String, LanguageObject> nameToSymbolMap = new LinkedHashMap<String, LanguageObject>();
for (LanguageObject symbol : symbols) {
try {
String fullName = null;
@@ -333,6 +295,9 @@
GroupSymbol group = (GroupSymbol)symbol;
metadataID = group.getMetadataID();
if (metadataID instanceof TempMetadataID && !group.isProcedure()) {
+ if (group.isTempTable()) {
+ validateTemp(actionCode, group, auditContext);
+ }
continue;
}
}
@@ -380,27 +345,12 @@
}
/**
- * Out of resources specified, return the subset for which the specified not have authorization to access.
+ * Out of the resources specified, return the subset for which the specified not have authorization to access.
*/
public Set<String> getInaccessibleResources(DataPolicy.PermissionType action, Set<String> resources, Context context) {
logRequest(resources, context);
- HashSet<String> results = new HashSet<String>(resources);
-
- for(DataPolicy p:this.allowedPolicies.values()) {
- DataPolicyMetadata policy = (DataPolicyMetadata)p;
-
- if (results.isEmpty()) {
- break;
- }
-
- Iterator<String> i = results.iterator();
- while (i.hasNext()) {
- if (policy.allows(i.next(), action)) {
- i.remove();
- }
- }
- }
+ Set<String> results = decider.getInaccessibleResources(action, resources, context, commandContext);
logResult(resources, context, results.isEmpty());
return results;
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -33,8 +33,11 @@
*/
public interface AuthorizationValidator {
- void validate(Command command, QueryMetadataInterface metadata,
- DQPWorkContext workContext, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException;
+ void validate(Command command, QueryMetadataInterface metadata, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException;
- boolean hasRole(String roleName, DQPWorkContext workContext);
+ boolean hasRole(String roleName, CommandContext commandContext);
+
+ boolean isEnabled();
+
+ void setEnabled(boolean enabled);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -125,18 +125,19 @@
@Override
public synchronized boolean restore(Cache cache, BufferManager bufferManager) {
- try {
- if (this.results == null) {
- if (this.hasLobs) {
- return false;
- }
+ if (this.results == null) {
+ if (this.hasLobs) {
+ return false; //the lob store is local only and not distributed
+ }
+ TupleBuffer buffer = null;
+ try {
List<ElementSymbol> schema = new ArrayList<ElementSymbol>(types.length);
for (String type : types) {
ElementSymbol es = new ElementSymbol("x"); //$NON-NLS-1$
es.setType(DataTypeManager.getDataTypeClass(type));
schema.add(es);
}
- TupleBuffer buffer = bufferManager.createTupleBuffer(schema, "cached", TupleSourceType.FINAL); //$NON-NLS-1$
+ buffer = bufferManager.createTupleBuffer(schema, "cached", TupleSourceType.FINAL); //$NON-NLS-1$
buffer.setBatchSize(this.batchSize);
if (this.hint != null) {
buffer.setPrefersMemory(this.hint.getPrefersMemory());
@@ -144,20 +145,26 @@
for (int row = 1; row <= this.rowCount; row+=this.batchSize) {
TupleBatch batch = (TupleBatch)cache.get(uuid+","+row); //$NON-NLS-1$
- if (batch != null) {
- buffer.addTupleBatch(batch, true);
- }
+ if (batch == null) {
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
+ buffer.remove();
+ return false;
+ }
+ buffer.addTupleBatch(batch, true);
}
this.results = buffer;
bufferManager.addTupleBuffer(this.results);
this.results.close();
+ this.accessInfo.restore();
+ } catch (TeiidException e) {
+ LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("unexpected_exception_restoring_results")); //$NON-NLS-1$
+ if (buffer != null) {
+ buffer.remove();
+ }
+ return false;
}
- this.accessInfo.restore();
- return true;
- } catch (TeiidException e) {
- LogManager.logDetail(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
}
- return false;
+ return true;
}
@Override
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -135,40 +135,15 @@
*/
@ManagementProperty(description="Turn on role checking based upon the data roles defined in VDBs. (default true)")
public boolean getUseDataRoles() {
- return useDataRoles;
+ return this.authorizationValidator != null && this.authorizationValidator.isEnabled();
}
public void setUseDataRoles(boolean useEntitlements) {
- this.useDataRoles = useEntitlements;
+ if (this.authorizationValidator != null) {
+ this.authorizationValidator.setEnabled(useEntitlements);
+ }
}
- /**
- * Whether temporary table usage is enabled by default.
- * @return <code>true</code> if temporary table usage is enabled by default.
- */
- @ManagementProperty(description="Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true)")
- public boolean isAllowCreateTemporaryTablesByDefault() {
- return allowCreateTemporaryTablesByDefault;
- }
-
- public void setAllowCreateTemporaryTablesByDefault(
- boolean allowCreateTemporaryTablesByDefault) {
- this.allowCreateTemporaryTablesByDefault = allowCreateTemporaryTablesByDefault;
- }
-
- /**
- * Whether functions are callable by default
- * @return <code>true</code> if function usage is enabled by default.
- */
- @ManagementProperty(description="Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true)")
- public boolean isAllowFunctionCallsByDefault() {
- return allowFunctionCallsByDefault;
- }
-
- public void setAllowFunctionCallsByDefault(boolean allowFunctionCallsDefault) {
- this.allowFunctionCallsByDefault = allowFunctionCallsDefault;
- }
-
@ManagementProperty(description="Long running query threshold, after which a alert can be generated by tooling if configured")
public int getQueryThresholdInSecs() {
return queryThresholdInSecs;
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -673,9 +673,6 @@
public void start(DQPConfiguration config) {
this.config = config;
this.authorizationValidator = config.getAuthorizationValidator();
- if (this.authorizationValidator == null) {
- this.authorizationValidator = new DataRoleAuthorizationValidator(config.getUseDataRoles(), config.isAllowCreateTemporaryTablesByDefault(), config.isAllowFunctionCallsByDefault());
- }
this.chunkSize = config.getLobChunkSizeInKB() * 1024;
//get buffer manager
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -217,6 +217,10 @@
}
return this.policies;
}
+
+ public void setPolicies(HashMap<String, DataPolicy> policies) {
+ this.policies = policies;
+ }
private boolean matchesPrincipal(Set<String> userRoles, DataPolicy policy) {
if (policy.isAnyAuthenticated()) {
Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Deleted: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import org.teiid.api.exception.query.QueryValidatorException;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.util.CommandContext;
-
-/**
- * The default Teiid authorization validator
- */
-public class DataRoleAuthorizationValidator implements AuthorizationValidator {
-
- private boolean useEntitlements;
- private boolean allowCreateTemporaryTablesByDefault;
- private boolean allowFunctionCallsByDefault;
-
- public DataRoleAuthorizationValidator(boolean useEntitlements,
- boolean allowCreateTemporaryTablesByDefault, boolean allowFunctionCallsByDefault) {
- this.useEntitlements = useEntitlements;
- this.allowCreateTemporaryTablesByDefault = allowCreateTemporaryTablesByDefault;
- this.allowFunctionCallsByDefault = allowFunctionCallsByDefault;
- }
-
- @Override
- public void validate(Command command, QueryMetadataInterface metadata, DQPWorkContext workContext, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException {
- if (useEntitlements && !workContext.getVDB().getDataPolicies().isEmpty()) {
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(workContext.getAllowedDataPolicies(), commandContext);
- visitor.setAllowCreateTemporaryTablesDefault(allowCreateTemporaryTablesByDefault);
- visitor.setAllowFunctionCallsByDefault(allowFunctionCallsByDefault);
- Request.validateWithVisitor(visitor, metadata, command);
- }
- }
-
- @Override
- public boolean hasRole(String roleName, DQPWorkContext workContext) {
- if (!useEntitlements) {
- return true;
- }
- return workContext.getAllowedDataPolicies().containsKey(roleName);
- }
-
-}
Copied: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRolePolicyDecider.java (from rev 3275, branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DataRolePolicyDecider.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRolePolicyDecider.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRolePolicyDecider.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,76 @@
+package org.teiid.dqp.internal.process;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.teiid.CommandContext;
+import org.teiid.PolicyDecider;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.DataPolicy.Context;
+import org.teiid.adminapi.DataPolicy.PermissionType;
+import org.teiid.adminapi.impl.DataPolicyMetadata;
+
+public class DataRolePolicyDecider implements PolicyDecider {
+
+ private boolean allowCreateTemporaryTablesByDefault = true;
+ private boolean allowFunctionCallsByDefault = true;
+
+ @Override
+ public Set<String> getInaccessibleResources(PermissionType action,
+ Set<String> resources, Context context, CommandContext commandContext) {
+ if (action == PermissionType.EXECUTE && context == Context.FUNCTION && allowFunctionCallsByDefault) {
+ return Collections.emptySet();
+ }
+ LinkedHashSet<String> results = new LinkedHashSet<String>(resources);
+ for(DataPolicy p:commandContext.getAllowedDataPolicies().values()) {
+ DataPolicyMetadata policy = (DataPolicyMetadata)p;
+
+ if (results.isEmpty()) {
+ break;
+ }
+
+ Iterator<String> i = results.iterator();
+ while (i.hasNext()) {
+ if (policy.allows(i.next(), action)) {
+ i.remove();
+ }
+ }
+ }
+ return results;
+ }
+
+ @Override
+ public boolean hasRole(String roleName, CommandContext context) {
+ return context.getAllowedDataPolicies().containsKey(roleName);
+ }
+
+ @Override
+ public boolean isTempAccessable(PermissionType action, String resource,
+ Context context, CommandContext commandContext) {
+ for(DataPolicy p:commandContext.getAllowedDataPolicies().values()) {
+ DataPolicyMetadata policy = (DataPolicyMetadata)p;
+
+ if (policy.isAllowCreateTemporaryTables() != null) {
+ return policy.isAllowCreateTemporaryTables();
+ }
+ }
+ return allowCreateTemporaryTablesByDefault;
+ }
+
+ public void setAllowCreateTemporaryTablesByDefault(
+ boolean allowCreateTemporaryTablesByDefault) {
+ this.allowCreateTemporaryTablesByDefault = allowCreateTemporaryTablesByDefault;
+ }
+
+ public void setAllowFunctionCallsByDefault(boolean allowFunctionCallsDefault) {
+ this.allowFunctionCallsByDefault = allowFunctionCallsDefault;
+ }
+
+ @Override
+ public boolean validateCommand(CommandContext commandContext) {
+ return !commandContext.getVdb().getDataPolicies().isEmpty();
+ }
+
+}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -33,6 +33,7 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import javax.sql.rowset.serial.SerialClob;
@@ -60,6 +61,8 @@
import org.teiid.dqp.message.RequestID;
import org.teiid.dqp.service.BufferService;
import org.teiid.events.EventDistributor;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
import org.teiid.metadata.AbstractMetadataRecord;
import org.teiid.metadata.Column;
import org.teiid.metadata.ColumnStats;
@@ -120,13 +123,34 @@
private enum SystemAdminProcs {
SETTABLESTATS,
SETCOLUMNSTATS,
- SETPROPERTY
+ SETPROPERTY,
+ LOGMSG,
+ ISLOGGABLE
}
private enum SystemProcs {
GETXMLSCHEMAS
}
+ private static final TreeMap<String, Integer> levelMap = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
+ static {
+ levelMap.put("OFF", MessageLevel.NONE); //$NON-NLS-1$
+ levelMap.put("FATAL", MessageLevel.CRITICAL); //$NON-NLS-1$
+ levelMap.put("ERROR", MessageLevel.ERROR); //$NON-NLS-1$
+ levelMap.put("WARN", MessageLevel.WARNING); //$NON-NLS-1$
+ levelMap.put("INFO", MessageLevel.INFO); //$NON-NLS-1$
+ levelMap.put("DEBUG", MessageLevel.DETAIL); //$NON-NLS-1$
+ levelMap.put("TRACE", MessageLevel.TRACE); //$NON-NLS-1$
+ }
+
+ public static int getLevel(String level) throws TeiidProcessingException {
+ Integer intLevel = levelMap.get(level);
+ if (intLevel == null) {
+ throw new TeiidProcessingException(QueryPlugin.Util.getString("FunctionMethods.unknown_level", level, levelMap.keySet())); //$NON-NLS-1$
+ }
+ return intLevel;
+ }
+
// Resources
private DQPCore requestMgr;
private BufferService bufferService;
@@ -361,6 +385,26 @@
if (StringUtil.startsWithIgnoreCase(proc.getProcedureCallableName(), CoreConstants.SYSTEM_ADMIN_MODEL)) {
final SystemAdminProcs sysProc = SystemAdminProcs.valueOf(proc.getProcedureCallableName().substring(CoreConstants.SYSTEM_ADMIN_MODEL.length() + 1).toUpperCase());
switch (sysProc) {
+ case LOGMSG:
+ case ISLOGGABLE:
+ String level = (String)((Constant)proc.getParameter(2).getExpression()).getValue();
+ String logContext = (String)((Constant)proc.getParameter(3).getExpression()).getValue();
+ Object message = null;
+ if (sysProc == SystemAdminProcs.LOGMSG) {
+ message = ((Constant)proc.getParameter(4).getExpression()).getValue();
+ }
+ int msgLevel = getLevel(level);
+ boolean logged = false;
+ if (LogManager.isMessageToBeRecorded(logContext, msgLevel)) {
+ if (message != null) {
+ LogManager.log(msgLevel, logContext, message);
+ }
+ logged = true;
+ }
+ if (proc.returnParameters()) {
+ rows.add(Arrays.asList(logged));
+ }
+ return new CollectionTupleSource(rows.iterator());
case SETPROPERTY:
try {
String uuid = (String)((Constant)proc.getParameter(2).getExpression()).getValue();
@@ -385,10 +429,12 @@
if (eventDistributor != null) {
eventDistributor.setProperty(vdbName, vdbVersion, uuid, key, strVal);
}
- if (result == null) {
- rows.add(Arrays.asList((Clob)null));
- } else {
- rows.add(Arrays.asList(new ClobType(new SerialClob(result.toCharArray()))));
+ if (proc.returnParameters()) {
+ if (result == null) {
+ rows.add(Arrays.asList((Clob)null));
+ } else {
+ rows.add(Arrays.asList(new ClobType(new SerialClob(result.toCharArray()))));
+ }
}
return new CollectionTupleSource(rows.iterator());
} catch (SQLException e) {
Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -57,8 +57,6 @@
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.dqp.message.AtomicResultsMessage;
import org.teiid.events.EventDistributor;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
import org.teiid.metadata.Table;
import org.teiid.query.function.source.XMLSystemFunctions;
import org.teiid.query.processor.relational.RelationalNodeUtil;
Copied: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java (from rev 3275, branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DefaultAuthorizationValidator.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.dqp.internal.process;
+
+import org.teiid.PolicyDecider;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.util.CommandContext;
+
+/**
+ * The default Teiid authorization validator
+ */
+public class DefaultAuthorizationValidator implements AuthorizationValidator {
+
+ private boolean enabled = true;
+ private PolicyDecider policyDecider;
+
+ public DefaultAuthorizationValidator() {
+ }
+
+ @Override
+ public void validate(Command command, QueryMetadataInterface metadata, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException {
+ if (enabled && policyDecider.validateCommand(commandContext)) {
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.policyDecider, commandContext);
+ Request.validateWithVisitor(visitor, metadata, command);
+ }
+ }
+
+ @Override
+ public boolean hasRole(String roleName, CommandContext commandContext) {
+ if (!enabled) {
+ return true;
+ }
+ return this.policyDecider.hasRole(roleName, commandContext);
+ }
+
+ public void setPolicyDecider(PolicyDecider policyDecider) {
+ this.policyDecider = policyDecider;
+ }
+
+ public PolicyDecider getPolicyDecider() {
+ return policyDecider;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -254,6 +254,7 @@
context.setSubject(workContext.getSubject());
this.context.setSession(workContext.getSession());
this.context.setRequestId(this.requestId);
+ this.context.setDQPWorkContext(this.workContext);
}
@Override
@@ -262,7 +263,10 @@
if (!DATA_ROLE.equalsIgnoreCase(roleType)) {
return false;
}
- return authorizationValidator.hasRole(roleName, workContext);
+ if (this.authorizationValidator == null) {
+ return true;
+ }
+ return authorizationValidator.hasRole(roleName, context);
}
public void setUserRequestConcurrency(int userRequestConcurrency) {
@@ -465,7 +469,9 @@
protected void validateAccess(Command command) throws QueryValidatorException, TeiidComponentException {
createCommandContext(command);
- this.authorizationValidator.validate(command, metadata, workContext, context);
+ if (this.authorizationValidator != null) {
+ this.authorizationValidator.validate(command, metadata, context);
+ }
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -58,6 +58,7 @@
import org.teiid.dqp.service.TransactionContext;
import org.teiid.dqp.service.TransactionService;
import org.teiid.dqp.service.TransactionContext.Scope;
+import org.teiid.jdbc.SQLStates;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
@@ -223,7 +224,7 @@
state = ProcessingState.PROCESSING;
processNew();
if (isCanceled) {
- this.processingException = new TeiidProcessingException(QueryPlugin.Util.getString("QueryProcessor.request_cancelled", this.requestID)); //$NON-NLS-1$
+ this.processingException = new TeiidProcessingException(SQLStates.QUERY_CANCELED, QueryPlugin.Util.getString("QueryProcessor.request_cancelled", this.requestID)); //$NON-NLS-1$
state = ProcessingState.CLOSE;
}
}
@@ -292,10 +293,12 @@
}
private void suspend() {
- try {
- this.transactionService.suspend(this.transactionContext);
- } catch (XATransactionException e) {
- LogManager.logDetail(LogConstants.CTX_DQP, e, "Error suspending active transaction"); //$NON-NLS-1$
+ if (this.transactionState == TransactionState.ACTIVE && this.transactionContext.getTransaction() != null) {
+ try {
+ this.transactionService.suspend(this.transactionContext);
+ } catch (XATransactionException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, e, "Error suspending active transaction"); //$NON-NLS-1$
+ }
}
}
@@ -442,15 +445,17 @@
doneProducingBatches();
}
addToCache();
- add = sendResultsIfNeeded(batch);
- if (!added) {
- super.flushBatchDirect(batch, add);
- //restrict the buffer size for forward only results
- if (add && !processor.hasFinalBuffer()
- && !batch.getTerminationFlag()
- && this.getTupleBuffer().getManagedRowCount() >= 20 * this.getTupleBuffer().getBatchSize()) {
- //requestMore will trigger more processing
- throw BlockedException.block(requestID, "Blocking due to full results buffer."); //$NON-NLS-1$
+ synchronized (lobStreams) {
+ add = sendResultsIfNeeded(batch);
+ if (!added) {
+ super.flushBatchDirect(batch, add);
+ //restrict the buffer size for forward only results
+ if (add && !processor.hasFinalBuffer()
+ && !batch.getTerminationFlag()
+ && this.getTupleBuffer().getManagedRowCount() >= 20 * this.getTupleBuffer().getBatchSize()) {
+ //requestMore will trigger more processing
+ throw BlockedException.block(requestID, "Blocking due to full results buffer."); //$NON-NLS-1$
+ }
}
}
}
@@ -626,10 +631,24 @@
}
LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Sending error to client", requestID); //$NON-NLS-1$
ResultsMessage response = new ResultsMessage(requestMsg);
- response.setException(processingException);
+ Throwable exception = this.processingException;
+ if (isCanceled) {
+ exception = addCancelCode(exception);
+ }
+ response.setException(exception);
setAnalysisRecords(response);
receiver.receiveResults(response);
}
+
+ private Throwable addCancelCode(Throwable exception) {
+ if (exception instanceof TeiidException) {
+ TeiidException te = (TeiidException)exception;
+ if (SQLStates.QUERY_CANCELED.equals(te.getCode())) {
+ return exception;
+ }
+ }
+ return new TeiidProcessingException(exception, SQLStates.QUERY_CANCELED, exception.getMessage());
+ }
@Override
protected boolean shouldPause() {
@@ -651,10 +670,10 @@
public void processLobChunkRequest(String id, int streamRequestId, ResultsReceiver<LobChunk> chunckReceiver) {
LobWorkItem workItem = null;
synchronized (lobStreams) {
- workItem = this.lobStreams.get(new Integer(streamRequestId));
+ workItem = this.lobStreams.get(streamRequestId);
if (workItem == null) {
workItem = new LobWorkItem(this, dqpCore, id, streamRequestId);
- lobStreams.put(new Integer(streamRequestId), workItem);
+ lobStreams.put(streamRequestId, workItem);
}
}
workItem.setResultsReceiver(chunckReceiver);
@@ -666,7 +685,7 @@
}
public void removeLobStream(int streamRequestId) {
- this.lobStreams.remove(new Integer(streamRequestId));
+ this.lobStreams.remove(streamRequestId);
}
public boolean requestCancel() throws TeiidComponentException {
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -42,6 +42,10 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import javax.xml.transform.stream.StreamResult;
+
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.query.QueryResult;
import net.sf.saxon.trans.XPathException;
import org.teiid.api.exception.query.ExpressionEvaluationException;
@@ -50,6 +54,7 @@
import org.teiid.core.ComponentNotFoundException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.BlobType;
import org.teiid.core.types.ClobImpl;
import org.teiid.core.types.ClobType;
@@ -68,6 +73,7 @@
import org.teiid.query.function.FunctionDescriptor;
import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.function.source.XMLSystemFunctions;
+import org.teiid.query.function.source.XMLSystemFunctions.XmlConcat;
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.AbstractSetCriteria;
@@ -113,11 +119,37 @@
import org.teiid.query.util.CommandContext;
import org.teiid.query.xquery.saxon.SaxonXQueryExpression;
import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
+import org.teiid.query.xquery.saxon.SaxonXQueryExpression.RowProcessor;
import org.teiid.translator.WSConnection.Util;
public class Evaluator {
- private final class SequenceReader extends Reader {
+ private final class XMLQueryRowProcessor implements RowProcessor {
+ XmlConcat concat; //just used to get a writer
+ Type type;
+ private javax.xml.transform.Result result;
+
+ private XMLQueryRowProcessor() throws TeiidProcessingException {
+ concat = new XmlConcat(context.getBufferManager());
+ result = new StreamResult(concat.getWriter());
+ }
+
+ @Override
+ public void processRow(NodeInfo row) {
+ if (type == null) {
+ type = SaxonXQueryExpression.getType(row);
+ } else {
+ type = Type.CONTENT;
+ }
+ try {
+ QueryResult.serialize(row, result, SaxonXQueryExpression.DEFAULT_OUTPUT_PROPERTIES);
+ } catch (XPathException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ }
+
+ private final class SequenceReader extends Reader {
private LinkedList<Reader> readers;
private Reader current = null;
@@ -759,13 +791,33 @@
private Object evaluateXMLQuery(List<?> tuple, XMLQuery xmlQuery)
throws BlockedException, TeiidComponentException,
FunctionExecutionException {
- boolean emptyOnEmpty = true;
- if (xmlQuery.getEmptyOnEmpty() != null) {
- emptyOnEmpty = xmlQuery.getEmptyOnEmpty();
- }
+ boolean emptyOnEmpty = xmlQuery.getEmptyOnEmpty() == null || xmlQuery.getEmptyOnEmpty();
Result result = null;
try {
- result = evaluateXQuery(xmlQuery.getXQueryExpression(), xmlQuery.getPassing(), tuple);
+ XMLQueryRowProcessor rp = null;
+ if (xmlQuery.getXQueryExpression().isStreaming()) {
+ rp = new XMLQueryRowProcessor();
+ }
+ try {
+ result = evaluateXQuery(xmlQuery.getXQueryExpression(), xmlQuery.getPassing(), tuple, rp);
+ } catch (TeiidRuntimeException e) {
+ if (e.getCause() instanceof XPathException) {
+ throw (XPathException)e.getCause();
+ }
+ throw e;
+ }
+ if (rp != null) {
+ XMLType.Type type = rp.type;
+ if (type == null) {
+ if (!emptyOnEmpty) {
+ return null;
+ }
+ type = Type.CONTENT;
+ }
+ XMLType val = rp.concat.close();
+ val.setType(rp.type);
+ return val;
+ }
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$
@@ -859,7 +911,7 @@
}
}
- public Result evaluateXQuery(SaxonXQueryExpression xquery, List<DerivedColumn> cols, List<?> tuple)
+ public Result evaluateXQuery(SaxonXQueryExpression xquery, List<DerivedColumn> cols, List<?> tuple, RowProcessor processor)
throws BlockedException, TeiidComponentException, TeiidProcessingException {
HashMap<String, Object> parameters = new HashMap<String, Object>();
Object contextItem = null;
@@ -871,7 +923,7 @@
parameters.put(passing.getAlias(), value);
}
}
- return xquery.evaluateXQuery(contextItem, parameters);
+ return xquery.evaluateXQuery(contextItem, parameters, processor, context);
}
private Evaluator.NameValuePair<Object>[] getNameValuePairs(List<?> tuple, List<DerivedColumn> args, boolean xmlNames)
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -401,6 +401,7 @@
private Writer writer;
private FileStoreInputStreamFactory fsisf;
private FileStore fs;
+ private Type type;
public XmlConcat(BufferManager bm) throws TeiidProcessingException {
fs = bm.createFileStore("xml"); //$NON-NLS-1$
@@ -417,6 +418,13 @@
}
public void addValue(Object object) throws TeiidProcessingException {
+ if (type == null) {
+ if (object instanceof XMLType) {
+ type = ((XMLType)object).getType();
+ }
+ } else {
+ type = Type.CONTENT;
+ }
try {
convertValue(writer, eventWriter, eventFactory, object);
} catch (IOException e) {
@@ -431,6 +439,10 @@
}
}
+ public Writer getWriter() {
+ return writer;
+ }
+
public XMLType close() throws TeiidProcessingException {
try {
eventWriter.flush();
@@ -443,7 +455,11 @@
throw new TeiidProcessingException(e);
}
XMLType result = new XMLType(new SQLXMLImpl(fsisf));
- result.setType(Type.CONTENT);
+ if (type == null) {
+ result.setType(Type.CONTENT);
+ } else {
+ result.setType(type);
+ }
return result;
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -78,7 +78,7 @@
*/
public class TransformationMetadata extends BasicQueryMetadata implements Serializable {
- private final class LiveQueryNode extends QueryNode {
+ private static final class LiveQueryNode extends QueryNode {
Procedure p;
private LiveQueryNode(Procedure p) {
super(null);
@@ -89,7 +89,19 @@
return p.getQueryPlan();
}
}
+
+ private static final class LiveTableQueryNode extends QueryNode {
+ Table t;
+ private LiveTableQueryNode(Table t) {
+ super(null);
+ this.t = t;
+ }
+ public String getQuery() {
+ return t.getSelectTransformation();
+ }
+ }
+
private final class VirtualFileInputStreamFactory extends
InputStreamFactory {
private final VirtualFile f;
@@ -463,8 +475,7 @@
if (!tableRecord.isVirtual()) {
throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.QueryPlan_could_not_be_found_for_physical_group__6")+tableRecord.getFullName()); //$NON-NLS-1$
}
- String transQuery = tableRecord.getSelectTransformation();
- QueryNode queryNode = new QueryNode(transQuery);
+ LiveTableQueryNode queryNode = new LiveTableQueryNode(tableRecord);
// get any bindings and add them onto the query node
List bindings = tableRecord.getBindings();
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -162,6 +162,14 @@
assignOutputElements(root.getLastChild(), outputElements, metadata, capFinder, rules, analysisRecord, context);
break;
case NodeConstants.Types.SOURCE: {
+ if (outputElements.isEmpty()) {
+ //we cannot completely filter an implicit grouping (this is a corner case)
+ PlanNode grouping = NodeEditor.findNodePreOrder(root.getFirstChild(), NodeConstants.Types.GROUP, NodeConstants.Types.SOURCE | NodeConstants.Types.JOIN);
+ if (grouping != null && !grouping.hasCollectionProperty(NodeConstants.Info.GROUP_COLS)) {
+ SymbolMap symbolMap = (SymbolMap) root.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ outputElements.add(symbolMap.getKeys().get(0).clone());
+ }
+ }
outputElements = (List<SingleElementSymbol>)determineSourceOutput(root, outputElements, metadata, capFinder);
root.setProperty(NodeConstants.Info.OUTPUT_COLS, outputElements);
List<SingleElementSymbol> childElements = filterVirtualElements(root, outputElements, metadata);
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -119,7 +119,7 @@
PlanNode setOp = child.getFirstChild();
try {
- pushGroupNodeOverUnion(plan, metadata, capFinder, groupNode, child, groupingExpressions, setOp, context);
+ pushGroupNodeOverUnion(plan, metadata, capFinder, groupNode, child, groupingExpressions, setOp, context, analysisRecord);
} catch (QueryResolverException e) {
throw new TeiidComponentException(e);
}
@@ -175,16 +175,35 @@
*/
private void pushGroupNodeOverUnion(PlanNode plan,
QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
- PlanNode groupNode, PlanNode child,
- List<SingleElementSymbol> groupingExpressions, PlanNode setOp, CommandContext context)
+ PlanNode groupNode, PlanNode unionSourceParent,
+ List<SingleElementSymbol> groupingExpressions, PlanNode setOp, CommandContext context, AnalysisRecord record)
throws TeiidComponentException, QueryMetadataException,
QueryPlannerException, QueryResolverException {
- if (setOp == null || setOp.getType() != NodeConstants.Types.SET_OP || setOp.getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
- return; //must not be a union
+ if (setOp == null) {
+ return;
}
+ PlanNode intermediateView = null;
+ if (setOp.getType() != NodeConstants.Types.SET_OP) {
+ if (setOp.getType() != NodeConstants.Types.PROJECT) {
+ return;
+ }
+ intermediateView = unionSourceParent;
+ unionSourceParent = setOp.getFirstChild();
+ if (unionSourceParent == null || unionSourceParent.getType() != NodeConstants.Types.SOURCE || unionSourceParent.getFirstChild() == null
+ || unionSourceParent.getFirstChild().getType() != NodeConstants.Types.SET_OP || unionSourceParent.getFirstChild().getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
+ return; //not an eligible union
+ }
+ setOp = unionSourceParent.getFirstChild();
+ if (groupingExpressions == null) {
+ return; //shouldn't happen - the view should have been removed
+ }
+ }
+ if (setOp.getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
+ return;
+ }
LinkedHashSet<AggregateSymbol> aggregates = collectAggregates(groupNode);
- Map<ElementSymbol, List<Set<Constant>>> partitionInfo = (Map<ElementSymbol, List<Set<Constant>>>)child.getProperty(Info.PARTITION_INFO);
+ Map<ElementSymbol, List<Set<Constant>>> partitionInfo = (Map<ElementSymbol, List<Set<Constant>>>)unionSourceParent.getProperty(Info.PARTITION_INFO);
//check to see if any aggregate is dependent upon cardinality
boolean cardinalityDependent = AggregateSymbol.areAggregatesCardinalityDependent(aggregates);
@@ -192,11 +211,34 @@
LinkedList<PlanNode> unionChildren = new LinkedList<PlanNode>();
findUnionChildren(unionChildren, cardinalityDependent, setOp);
- SymbolMap parentMap = (SymbolMap)child.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ SymbolMap parentMap = (SymbolMap)unionSourceParent.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ List<ElementSymbol> virtualElements = parentMap.getKeys();
+ GroupSymbol virtualGroup = unionSourceParent.getGroups().iterator().next();
+ List<SingleElementSymbol> actualGroupingExpressions = groupingExpressions;
+ if (intermediateView != null) {
+ actualGroupingExpressions = new ArrayList<SingleElementSymbol>(groupingExpressions.size());
+ SymbolMap viewMap = (SymbolMap)intermediateView.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ for (SingleElementSymbol ses : groupingExpressions) {
+ Expression ex = viewMap.getMappedExpression((ElementSymbol)ses);
+ SingleElementSymbol newCol = null;
+ if (ex instanceof SingleElementSymbol) {
+ newCol = (SingleElementSymbol)ex;
+ } else {
+ newCol = new ExpressionSymbol("grouping", ex); //$NON-NLS-1$
+ }
+ actualGroupingExpressions.add(newCol);
+ }
+ }
+
//partitioned union
- if (partitionInfo != null && !Collections.disjoint(partitionInfo.keySet(), groupingExpressions)) {
- decomposeGroupBy(groupNode, child, groupingExpressions, aggregates, unionChildren, parentMap, context, metadata, capFinder);
+ if (partitionInfo != null && !Collections.disjoint(partitionInfo.keySet(), actualGroupingExpressions)) {
+ if (intermediateView != null) {
+ parentMap = pushGroupByView(plan, metadata, capFinder, unionSourceParent,
+ setOp, intermediateView, cardinalityDependent,
+ unionChildren, virtualElements, virtualGroup);
+ }
+ decomposeGroupBy(groupNode, unionSourceParent, groupingExpressions, aggregates, unionChildren, parentMap, metadata, capFinder, intermediateView != null);
return;
}
@@ -218,15 +260,15 @@
return;
}
- List<ElementSymbol> virtualElements = parentMap.getKeys();
List<SingleElementSymbol> copy = new ArrayList<SingleElementSymbol>(aggregates);
aggregates.clear();
Map<AggregateSymbol, Expression> aggMap = buildAggregateMap(copy, metadata, aggregates);
boolean shouldPushdown = false;
List<Boolean> pushdownList = new ArrayList<Boolean>(unionChildren.size());
+
for (PlanNode planNode : unionChildren) {
- boolean pushdown = canPushGroupByToUnionChild(metadata, capFinder, groupingExpressions, aggregates, planNode);
+ boolean pushdown = canPushGroupByToUnionChild(metadata, capFinder, actualGroupingExpressions, aggregates, planNode, record);
pushdownList.add(pushdown);
shouldPushdown |= pushdown;
}
@@ -235,17 +277,70 @@
return;
}
+ if (intermediateView != null) {
+ parentMap = pushGroupByView(plan, metadata, capFinder, unionSourceParent,
+ setOp, intermediateView, cardinalityDependent,
+ unionChildren, virtualElements, virtualGroup);
+ virtualElements = parentMap.getKeys();
+ virtualGroup = unionSourceParent.getGroups().iterator().next();
+ }
+
Iterator<Boolean> pushdownIterator = pushdownList.iterator();
for (PlanNode planNode : unionChildren) {
- addView(plan, planNode, pushdownIterator.next(), groupingExpressions, aggregates, virtualElements, metadata, capFinder);
+ addView(plan, planNode, pushdownIterator.next(), new GroupSymbol("X"), groupingExpressions, aggregates, virtualElements, metadata, capFinder, null); //$NON-NLS-1$
}
//update the parent plan with the staged aggregates and the new projected symbols
- List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(child, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
- List<ElementSymbol> updatedVirturalElement = new ArrayList<ElementSymbol>(virtualElements);
+ List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(unionSourceParent, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
//hack to introduce aggregate symbols to the parent view TODO: this should change the metadata properly.
- GroupSymbol virtualGroup = child.getGroups().iterator().next();
+ SymbolMap newParentMap = modifyUnionSourceParent(unionSourceParent, virtualGroup, projectedViewSymbols, virtualElements);
+ Map<AggregateSymbol, ElementSymbol> projectedMap = new HashMap<AggregateSymbol, ElementSymbol>();
+ Iterator<AggregateSymbol> aggIter = aggregates.iterator();
+ for (ElementSymbol projectedViewSymbol : newParentMap.getKeys().subList(projectedViewSymbols.size() - aggregates.size(), projectedViewSymbols.size())) {
+ projectedMap.put(aggIter.next(), projectedViewSymbol);
+ }
+ for (Expression expr : aggMap.values()) {
+ ExpressionMappingVisitor.mapExpressions(expr, projectedMap);
+ }
+ mapExpressions(groupNode.getParent(), aggMap, metadata);
+ }
+
+ private SymbolMap pushGroupByView(PlanNode plan,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
+ PlanNode unionSourceParent, PlanNode setOp,
+ PlanNode intermediateView, boolean cardinalityDependent,
+ LinkedList<PlanNode> unionChildren,
+ List<ElementSymbol> virtualElements, GroupSymbol virtualGroup)
+ throws TeiidComponentException, QueryPlannerException,
+ QueryResolverException {
+ //perform view pushing
+ /*
+ * TODO: this introduces yet another potentially unneeded view, but cannot be removed by the normal merge virtual logic
+ * due to an intervening access node
+ */
+ PlanNode intermediateProject = intermediateView.getFirstChild();
+ List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)intermediateProject.getProperty(NodeConstants.Info.PROJECT_COLS);
+ for (PlanNode planNode : unionChildren) {
+ addView(plan, planNode, false, virtualGroup.clone(), null, Collections.EMPTY_SET, virtualElements, metadata, capFinder, LanguageObject.Util.deepClone(projectedViewSymbols, SingleElementSymbol.class));
+ }
+ unionChildren.clear();
+ findUnionChildren(unionChildren, cardinalityDependent, setOp);
+ virtualGroup = intermediateView.getGroups().iterator().next();
+ unionSourceParent.getGroups().clear();
+ unionSourceParent.addGroup(virtualGroup);
+ projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(unionSourceParent, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
+ SymbolMap parentMap = modifyUnionSourceParent(unionSourceParent, virtualGroup, projectedViewSymbols, Collections.EMPTY_LIST);
+ //remove the old view
+ NodeEditor.removeChildNode(intermediateView, intermediateProject);
+ NodeEditor.removeChildNode(intermediateView.getParent(), intermediateView);
+ return parentMap;
+ }
+
+ private SymbolMap modifyUnionSourceParent(PlanNode unionSourceParent,
+ GroupSymbol virtualGroup,
+ List<SingleElementSymbol> projectedViewSymbols, List<ElementSymbol> baseVirtualElements) {
+ List<ElementSymbol> updatedVirturalElement = new ArrayList<ElementSymbol>(baseVirtualElements);
for (int i = updatedVirturalElement.size(); i < projectedViewSymbols.size(); i++) {
SingleElementSymbol symbol = projectedViewSymbols.get(i);
String name = symbol.getShortName();
@@ -257,22 +352,15 @@
updatedVirturalElement.add(virtualElement);
}
SymbolMap newParentMap = SymbolMap.createSymbolMap(updatedVirturalElement, projectedViewSymbols);
- child.setProperty(NodeConstants.Info.SYMBOL_MAP, newParentMap);
- Map<AggregateSymbol, ElementSymbol> projectedMap = new HashMap<AggregateSymbol, ElementSymbol>();
- Iterator<AggregateSymbol> aggIter = aggregates.iterator();
- for (ElementSymbol projectedViewSymbol : newParentMap.getKeys().subList(projectedViewSymbols.size() - aggregates.size(), projectedViewSymbols.size())) {
- projectedMap.put(aggIter.next(), projectedViewSymbol);
- }
- for (Expression expr : aggMap.values()) {
- ExpressionMappingVisitor.mapExpressions(expr, projectedMap);
- }
- mapExpressions(groupNode.getParent(), aggMap, metadata);
+ unionSourceParent.setProperty(NodeConstants.Info.SYMBOL_MAP, newParentMap);
+ return newParentMap;
}
private void decomposeGroupBy(PlanNode groupNode, PlanNode sourceNode,
List<SingleElementSymbol> groupingExpressions,
LinkedHashSet<AggregateSymbol> aggregates,
- LinkedList<PlanNode> unionChildren, SymbolMap parentMap, CommandContext context, QueryMetadataInterface metadata, CapabilitiesFinder capFinder) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
+ LinkedList<PlanNode> unionChildren, SymbolMap parentMap, QueryMetadataInterface metadata,
+ CapabilitiesFinder capFinder, boolean hadIntermediateView) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
// remove the group node
groupNode.getParent().replaceChild(groupNode, groupNode.getFirstChild());
GroupSymbol group = sourceNode.getGroups().iterator().next().clone();
@@ -302,6 +390,10 @@
groupClone.addAsParent(projectPlanNode);
+ if (hadIntermediateView) {
+ //drill down to the possible access node
+ planNode = planNode.getFirstChild().getFirstChild();
+ }
if (planNode.getType() == NodeConstants.Types.ACCESS) {
//TODO: temporarily remove the access node so that the inline view could be removed if possible
while (RuleRaiseAccess.raiseAccessNode(planNode, planNode, metadata, capFinder, true, null) != null) {
@@ -319,7 +411,7 @@
private boolean canPushGroupByToUnionChild(QueryMetadataInterface metadata,
CapabilitiesFinder capFinder,
List<SingleElementSymbol> groupingExpressions,
- LinkedHashSet<AggregateSymbol> aggregates, PlanNode planNode)
+ LinkedHashSet<AggregateSymbol> aggregates, PlanNode planNode, AnalysisRecord record)
throws QueryMetadataException, TeiidComponentException {
if (planNode.getType() != NodeConstants.Types.ACCESS) {
return false;
@@ -334,8 +426,16 @@
return false;
}
}
- if ((groupingExpressions == null || groupingExpressions.isEmpty()) && !CapabilitiesUtil.supports(Capability.QUERY_AGGREGATES_COUNT_STAR, modelId, metadata, capFinder)) {
- return false;
+ if ((groupingExpressions == null || groupingExpressions.isEmpty())) {
+ if (!CapabilitiesUtil.supports(Capability.QUERY_AGGREGATES_COUNT_STAR, modelId, metadata, capFinder)) {
+ return false;
+ }
+ } else {
+ for (SingleElementSymbol ses : groupingExpressions) {
+ if(! CriteriaCapabilityValidatorVisitor.canPushLanguageObject(ses, modelId, metadata, capFinder, record)) {
+ return false;
+ }
+ }
}
//TODO: check to see if we are distinct
return true;
@@ -366,11 +466,14 @@
return null;
}
- public void addView(PlanNode root, PlanNode unionSource, boolean pushdown, List<SingleElementSymbol> groupingExpressions,
+ public void addView(PlanNode root, PlanNode unionSource, boolean pushdown, GroupSymbol group, List<SingleElementSymbol> groupingExpressions,
Set<AggregateSymbol> aggregates, List<ElementSymbol> virtualElements,
- QueryMetadataInterface metadata, CapabilitiesFinder capFinder)
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder, List<SingleElementSymbol> actualProject)
throws TeiidComponentException, QueryPlannerException, QueryResolverException {
- PlanNode originalNode = unionSource;
+ PlanNode accessNode = null;
+ if (pushdown) {
+ accessNode = NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.ACCESS);
+ }
//branches other than the first need to have their projected column names updated
PlanNode sortNode = NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
List<SingleElementSymbol> sortOrder = null;
@@ -394,8 +497,6 @@
updateSymbolName(projectCols, i, virtualElem, projectedSymbol);
}
}
- GroupSymbol group = new GroupSymbol("X"); //$NON-NLS-1$
-
PlanNode intermediateView = createView(group, virtualElements, unionSource, metadata);
SymbolMap symbolMap = (SymbolMap)intermediateView.getProperty(Info.SYMBOL_MAP);
unionSource = intermediateView;
@@ -445,25 +546,26 @@
unionSource = projectPlanNode;
//create proper names for the aggregate symbols
- Select select = new Select(projectedViewSymbols);
+ Select select = null;
+ if (actualProject == null) {
+ select = new Select(projectedViewSymbols);
+ } else {
+ select = new Select(actualProject);
+ }
QueryRewriter.makeSelectUnique(select, false);
projectedViewSymbols = select.getProjectedSymbols();
projectPlanNode.setProperty(NodeConstants.Info.PROJECT_COLS, projectedViewSymbols);
projectPlanNode.addGroup(group);
if (pushdown) {
- while (RuleRaiseAccess.raiseAccessNode(root, originalNode, metadata, capFinder, true, null) != null) {
+ while (RuleRaiseAccess.raiseAccessNode(root, accessNode, metadata, capFinder, true, null) != null) {
//continue to raise
}
}
}
static PlanNode createView(GroupSymbol group, List<? extends SingleElementSymbol> virtualElements, PlanNode child, QueryMetadataInterface metadata) throws TeiidComponentException {
- PlanNode intermediateView = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
SymbolMap symbolMap = createSymbolMap(group, virtualElements, child, metadata);
- intermediateView.setProperty(NodeConstants.Info.SYMBOL_MAP, symbolMap);
- child.addAsParent(intermediateView);
- intermediateView.addGroup(group);
- return intermediateView;
+ return RuleDecomposeJoin.createSource(group, child, symbolMap);
}
private static SymbolMap createSymbolMap(GroupSymbol group,
Modified: trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -34,6 +34,7 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.Assertion;
+import org.teiid.jdbc.SQLStates;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
@@ -130,7 +131,7 @@
while(currentTime < context.getTimeSliceEnd() || context.isNonBlocking()) {
if (requestCanceled) {
- throw new TeiidProcessingException(QueryPlugin.Util.getString("QueryProcessor.request_cancelled", getProcessID())); //$NON-NLS-1$
+ throw new TeiidProcessingException(SQLStates.QUERY_CANCELED, QueryPlugin.Util.getString("QueryProcessor.request_cancelled", getProcessID())); //$NON-NLS-1$
}
if (currentTime > context.getTimeoutEnd()) {
throw new TeiidProcessingException("Query timed out"); //$NON-NLS-1$
Property changes on: trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java:3220-3275
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -45,6 +45,7 @@
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.OrderByItem;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.Select;
import org.teiid.query.sql.symbol.Constant;
@@ -204,6 +205,14 @@
}
if (!shouldProject) {
this.projection = new Object[0];
+ } else if (query.getOrderBy() != null) {
+ for (OrderByItem item : query.getOrderBy().getOrderByItems()) {
+ Integer index = uniqueSymbols.get(SymbolMap.getExpression(item.getSymbol()));
+ if (index != null) {
+ item.setExpressionPosition(index);
+ item.setSymbol((SingleElementSymbol) select.getSymbols().get(index));
+ }
+ }
}
}
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -218,7 +218,7 @@
OrderByItem item = iterator.next();
orderIndecies[iterator.previousIndex()] = collectExpression(item.getSymbol());
element = new ElementSymbol(String.valueOf(iterator.previousIndex()));
- element.setType(inputType);
+ element.setType(item.getSymbol().getType());
schema.add(element);
OrderByItem newItem = item.clone();
newItem.setSymbol(element);
@@ -286,7 +286,7 @@
@Override
protected List updateTuple(List tuple) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
int columns = collectedExpressions.size();
- List exprTuple = new ArrayList(columns);
+ List<Object> exprTuple = new ArrayList<Object>(columns);
for(int col = 0; col<columns; col++) {
// The following call may throw BlockedException, but all state to this point
// is saved in class variables so we can start over on building this tuple
@@ -335,7 +335,7 @@
} else if(! sameGroup(currentGroupTuple, lastRow)) {
// Close old group
- List row = new ArrayList(functions.length);
+ List<Object> row = new ArrayList<Object>(functions.length);
for(int i=0; i<functions.length; i++) {
row.add( functions[i].getResult() );
functions[i].reset();
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -29,6 +29,7 @@
import java.util.Map;
import net.sf.saxon.om.Item;
+import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.sxpath.XPathDynamicContext;
import net.sf.saxon.sxpath.XPathExpression;
@@ -42,8 +43,12 @@
import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.XMLType;
import org.teiid.query.QueryPlugin;
@@ -51,11 +56,15 @@
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.XMLTable.XMLColumn;
import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
+import org.teiid.query.xquery.saxon.SaxonXQueryExpression.RowProcessor;
/**
* Handles xml table processing.
+ *
+ * When streaming the results will be fully built and stored in a buffer
+ * before being returned
*/
-public class XMLTableNode extends SubqueryAwareRelationalNode {
+public class XMLTableNode extends SubqueryAwareRelationalNode implements RowProcessor {
private static Map<Class<?>, BuiltInAtomicType> typeMapping = new HashMap<Class<?>, BuiltInAtomicType>();
@@ -74,6 +83,10 @@
private int rowCount = 0;
private Item item;
+ private TupleBuffer buffer;
+ private int outputRow = 1;
+ private boolean usingOutput;
+
public XMLTableNode(int nodeID) {
super(nodeID);
}
@@ -81,6 +94,10 @@
@Override
public void closeDirect() {
super.closeDirect();
+ if(this.buffer != null) {
+ this.buffer.remove();
+ this.buffer = null;
+ }
reset();
}
@@ -93,6 +110,9 @@
}
item = null;
rowCount = 0;
+ outputRow = 1;
+ usingOutput = false;
+ this.buffer = null;
}
public void setTable(XMLTable table) {
@@ -116,31 +136,62 @@
protected TupleBatch nextBatchDirect() throws BlockedException,
TeiidComponentException, TeiidProcessingException {
- if (result == null) {
- setReferenceValues(this.table);
- result = getEvaluator(Collections.emptyMap()).evaluateXQuery(this.table.getXQueryExpression(), this.table.getPassing(), null);
+ evaluate();
+
+ if (this.table.getXQueryExpression().isStreaming()) {
+ TupleBatch batch = this.buffer.getBatch(outputRow);
+ outputRow = batch.getEndRow() + 1;
+ return batch;
}
while (!isBatchFull() && !isLastBatch()) {
- processRow();
+ if (item == null) {
+ try {
+ item = result.iter.next();
+ } catch (XPathException e) {
+ throw new TeiidProcessingException(e, QueryPlugin.Util.getString("XMLTableNode.error", e.getMessage())); //$NON-NLS-1$
+ }
+ rowCount++;
+ if (item == null) {
+ terminateBatches();
+ break;
+ }
+ }
+ addBatchRow(processRow());
}
return pullBatch();
}
- private void processRow() throws ExpressionEvaluationException, BlockedException,
- TeiidComponentException, TeiidProcessingException {
- if (item == null) {
+ private void evaluate() throws TeiidComponentException,
+ ExpressionEvaluationException, BlockedException,
+ TeiidProcessingException {
+ if (result == null) {
+ if (this.buffer == null && this.table.getXQueryExpression().isStreaming()) {
+ this.buffer = this.getBufferManager().createTupleBuffer(getOutputElements(), getConnectionID(), TupleSourceType.PROCESSOR);
+ }
+ setReferenceValues(this.table);
try {
- item = result.iter.next();
- } catch (XPathException e) {
- throw new TeiidProcessingException(e, QueryPlugin.Util.getString("XMLTableNode.error", e.getMessage())); //$NON-NLS-1$
+ result = getEvaluator(Collections.emptyMap()).evaluateXQuery(this.table.getXQueryExpression(), this.table.getPassing(), null, this);
+ if (this.buffer != null) {
+ this.buffer.close();
+ if (!usingOutput) {
+ this.buffer.setForwardOnly(true);
+ }
+ }
+ } catch (TeiidRuntimeException e) {
+ if (e.getCause() instanceof TeiidComponentException) {
+ throw (TeiidComponentException)e.getCause();
+ }
+ if (e.getCause() instanceof TeiidProcessingException) {
+ throw (TeiidProcessingException)e.getCause();
+ }
+ throw e;
}
- rowCount++;
- if (item == null) {
- terminateBatches();
- return;
- }
}
+ }
+
+ private List<?> processRow() throws ExpressionEvaluationException, BlockedException,
+ TeiidComponentException, TeiidProcessingException {
List<Object> tuple = new ArrayList<Object>(projectedColumns.size());
for (XMLColumn proColumn : projectedColumns) {
if (proColumn.isOrdinal()) {
@@ -167,8 +218,10 @@
if (pathIter.next() != null) {
throw new TeiidProcessingException(QueryPlugin.Util.getString("XMLTableName.multi_value", proColumn.getName())); //$NON-NLS-1$
}
- Object value = Value.convertToJava(colItem);
- if (value instanceof Item) {
+ Object value = colItem;
+ if (value instanceof AtomicValue) {
+ value = Value.convertToJava(colItem);
+ } else if (value instanceof Item) {
Item i = (Item)value;
BuiltInAtomicType bat = typeMapping.get(proColumn.getSymbol().getType());
if (bat != null) {
@@ -190,7 +243,37 @@
}
}
item = null;
- addBatchRow(tuple);
+ return tuple;
}
+
+ @Override
+ public boolean hasFinalBuffer() {
+ return this.table.getXQueryExpression().isStreaming();
+ }
+
+ @Override
+ public TupleBuffer getFinalBuffer() throws BlockedException,
+ TeiidComponentException, TeiidProcessingException {
+ evaluate();
+ usingOutput = true;
+ TupleBuffer finalBuffer = this.buffer;
+ this.buffer = null;
+ close();
+ return finalBuffer;
+ }
+
+ @Override
+ public void processRow(NodeInfo row) {
+ this.item = row;
+ rowCount++;
+ if (rowCount % 100 == 0) {
+ System.out.println(System.currentTimeMillis() + " " + rowCount);
+ }
+ try {
+ this.buffer.addTuple(processRow());
+ } catch (TeiidException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/UpdateProcedureResolver.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -194,7 +194,7 @@
switch (param.getParameterType()) {
case ParameterInfo.OUT:
case ParameterInfo.RETURN_VALUE:
- if (!isAssignable(metadata, param)) {
+ if (param.getExpression() != null && !isAssignable(metadata, param)) {
throw new QueryResolverException(QueryPlugin.Util.getString("UpdateProcedureResolver.only_variables", param.getExpression())); //$NON-NLS-1$
}
sp.setCallableStatement(true);
Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -2357,16 +2357,6 @@
expression.setAggregateFunction(Type.MAX);
}
}
- if ((expression.getAggregateFunction() == Type.MAX || expression.getAggregateFunction() == Type.MIN)
- && EvaluatableVisitor.willBecomeConstant(expression.getExpression())) {
- try {
- return new ExpressionSymbol(expression.getName(), ResolverUtil
- .convertExpression(expression.getExpression(),DataTypeManager.getDataTypeName(expression.getType()), metadata));
- } catch (QueryResolverException e) {
- //should not happen, so throw as a runtime
- throw new TeiidRuntimeException(e);
- }
- }
return expression;
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -315,7 +315,7 @@
String matTableName = metadata.getFullName(matTableId);
LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
MatTableInfo info = globalStore.getMatTableInfo(matTableName);
- boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(1).getExpression()).getValue());
+ boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(2).getExpression()).getValue());
if (invalidate) {
touchTable(context, matTableName, false);
}
@@ -325,7 +325,7 @@
}
GroupSymbol matTable = new GroupSymbol(matTableName);
matTable.setMetadataID(matTableId);
- int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null);
+ int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null, false);
return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
} else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
Object groupID = validateMatView(metadata, proc);
@@ -415,11 +415,13 @@
key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
MatTableEntry entry = this.tables.get(key);
- boolean firstload = !info.isValid();
+ boolean notValid = !info.isValid();
if (entry != null && entry.lastUpdate > info.getUpdateTime()
- && info.getState() != MatState.LOADING) {
- //remote load
- info.setState(MatState.NEEDS_LOADING, firstload?false:entry.valid, null);
+ && info.getState() != MatState.LOADING
+ //TODO: use extension metadata or a config parameter to make this skew configurable
+ && !(!notValid && entry.valid && info.getState() == MatState.LOADED && entry.lastUpdate < info.getUpdateTime() + 30000)) {
+ //trigger a remote load due to the cache being more up to date than the local copy
+ info.setState(MatState.NEEDS_LOADING, notValid?false:entry.valid, null);
loadTime = entry.lastUpdate;
}
}
@@ -427,7 +429,7 @@
if (load) {
if (!info.isValid()) {
//blocking load
- loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
+ loadGlobalTable(context, group, tableName, globalStore, info, loadTime, true);
} else {
loadAsynch(context, group, tableName, globalStore, info, loadTime);
}
@@ -468,7 +470,7 @@
Callable<Integer> toCall = new Callable<Integer>() {
@Override
public Integer call() throws Exception {
- return loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
+ return loadGlobalTable(context, group, tableName, globalStore, info, loadTime, true);
}
};
FutureTask<Integer> task = new FutureTask<Integer>(toCall);
@@ -477,7 +479,7 @@
private int loadGlobalTable(CommandContext context,
GroupSymbol group, final String tableName,
- TempTableStore globalStore, MatTableInfo info, Long loadTime)
+ TempTableStore globalStore, MatTableInfo info, Long loadTime, boolean useCache)
throws TeiidComponentException, TeiidProcessingException {
LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loading", tableName)); //$NON-NLS-1$
QueryMetadataInterface metadata = context.getMetadata();
@@ -511,9 +513,11 @@
if (distributedCache != null) {
cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
context.getVdbVersion(), context.getConnectionID(), context.getUserName());
- CachedResults cr = this.distributedCache.get(cid);
- if (cr != null) {
- ts = cr.getResults().createIndexedTupleSource();
+ if (useCache) {
+ CachedResults cr = this.distributedCache.get(cid);
+ if (cr != null) {
+ ts = cr.getResults().createIndexedTupleSource();
+ }
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.Set;
@@ -33,11 +34,14 @@
import javax.security.auth.Subject;
+import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Session;
+import org.teiid.adminapi.VDB;
import org.teiid.api.exception.query.QueryProcessingException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.util.ArgCheck;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.internal.process.PreparedPlan;
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
@@ -120,9 +124,11 @@
private Subject subject;
private HashSet<Object> dataObjects;
- public Session session;
+ private Session session;
- public RequestID requestId;
+ private RequestID requestId;
+
+ private DQPWorkContext dqpWorkContext;
}
private GlobalState globalState = new GlobalState();
@@ -591,4 +597,22 @@
this.globalState.requestId = requestId;
}
+ public void setDQPWorkContext(DQPWorkContext workContext) {
+ this.globalState.dqpWorkContext = workContext;
+ }
+
+ @Override
+ public Map<String, DataPolicy> getAllowedDataPolicies() {
+ return this.globalState.dqpWorkContext.getAllowedDataPolicies();
+ }
+
+ @Override
+ public VDB getVdb() {
+ return this.globalState.dqpWorkContext.getVDB();
+ }
+
+ public DQPWorkContext getDQPWorkContext() {
+ return this.globalState.dqpWorkContext;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -789,8 +789,8 @@
}
protected void validateInsert(Insert obj) {
- Collection vars = obj.getVariables();
- Iterator varIter = vars.iterator();
+ Collection<ElementSymbol> vars = obj.getVariables();
+ Iterator<ElementSymbol> varIter = vars.iterator();
Collection values = obj.getValues();
Iterator valIter = values.iterator();
GroupSymbol insertGroup = obj.getGroup();
@@ -798,9 +798,7 @@
try {
// Validate that all elements in variable list are updatable
- Iterator elementIter = vars.iterator();
- while(elementIter.hasNext()) {
- ElementSymbol insertElem = (ElementSymbol) elementIter.next();
+ for (ElementSymbol insertElem : vars) {
if(! getMetadata().elementSupports(insertElem.getMetadataID(), SupportConstants.Element.UPDATE)) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0052", insertElem), insertElem); //$NON-NLS-1$
}
@@ -825,7 +823,7 @@
// if any of the value present in the insert are null
while(valIter.hasNext() && varIter.hasNext()) {
Expression nextValue = (Expression) valIter.next();
- ElementSymbol nextVar = (ElementSymbol) varIter.next();
+ ElementSymbol nextVar = varIter.next();
if (!(nextValue instanceof Constant) && getMetadata().isMultiSourceElement(nextVar.getMetadataID())) {
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.multisource_constant", nextVar), nextVar); //$NON-NLS-1$
Copied: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/DocumentWrapper.java (from rev 3275, branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/DocumentWrapper.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/DocumentWrapper.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/DocumentWrapper.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,268 @@
+package org.teiid.query.xquery.saxon;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.om.DocumentInfo;
+import net.sf.saxon.om.NamePool;
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.type.Type;
+import nu.xom.Attribute;
+import nu.xom.Document;
+import nu.xom.Element;
+import nu.xom.Node;
+
+/**
+ * The root node of an XPath tree. (Or equivalently, the tree itself).
+ * <P>
+ * This class is used not only for a document, but also for the root
+ * of a document-less tree fragment.
+ *
+ * @author Michael H. Kay
+ * @author Wolfgang Hoschek (ported net.sf.saxon.jdom to XOM)
+ * @author Steve Hawkins (Ported to Saxon 9.1 for Teiid)
+ */
+
+public class DocumentWrapper extends NodeWrapper implements DocumentInfo {
+
+ protected Configuration config;
+
+ protected String baseURI;
+
+ protected int documentNumber;
+
+ private HashMap idIndex;
+
+ /**
+ * Create a Saxon wrapper for a XOM root node
+ *
+ * @param root
+ * The XOM root node
+ * @param baseURI
+ * The base URI for all the nodes in the tree
+ * @param config
+ * The configuration which defines the name pool used for all
+ * names in this tree
+ */
+ public DocumentWrapper(Node root, String baseURI, Configuration config) {
+ super(root, null, 0);
+ if (root.getParent() != null)
+ throw new IllegalArgumentException("root node must not have a parent node");
+ this.baseURI = baseURI;
+ this.docWrapper = this;
+ setConfiguration(config);
+ }
+
+ /**
+ * Wrap a node in the XOM document.
+ *
+ * @param node
+ * The node to be wrapped. This must be a node in the same
+ * document (the system does not check for this).
+ * @return the wrapping NodeInfo object
+ */
+
+ public NodeInfo wrap(Node node) {
+ if (node == this.node) {
+ return this;
+ }
+ return makeWrapper(node, this);
+ }
+
+ /**
+ * Set the configuration, which defines the name pool used for all names in
+ * this document. This is always called after a new document has been
+ * created. The implementation must register the name pool with the
+ * document, so that it can be retrieved using getNamePool(). It must also
+ * call NamePool.allocateDocumentNumber(), and return the relevant document
+ * number when getDocumentNumber() is subsequently called.
+ *
+ * @param config
+ * The configuration to be used
+ */
+
+ public void setConfiguration(Configuration config) {
+ this.config = config;
+ this.documentNumber = allocateDocumentNumber(config);
+ }
+
+ /**
+ * Get the configuration previously set using setConfiguration
+ */
+
+ public Configuration getConfiguration() {
+ return config;
+ }
+
+ /**
+ * Get the name pool used for the names in this document
+ *
+ * @return the name pool in which all the names used in this document are
+ * registered
+ */
+
+ public NamePool getNamePool() {
+ return config.getNamePool();
+ }
+
+ /**
+ * Get the unique document number for this document (the number is unique
+ * for all documents within a NamePool)
+ *
+ * @return the unique number identifying this document within the name pool
+ */
+
+ public int getDocumentNumber() {
+ return documentNumber;
+ }
+
+ /**
+ * Get the element with a given ID, if any
+ *
+ * @param id
+ * the required ID value
+ * @return the element with the given ID, or null if there is no such ID
+ * present (or if the parser has not notified attributes as being of
+ * type ID).
+ */
+
+ public NodeInfo selectID(String id) {
+ if (idIndex == null) {
+ Element elem;
+ switch (nodeKind) {
+ case Type.DOCUMENT :
+ elem = ((Document) node).getRootElement();
+ break;
+ case Type.ELEMENT :
+ elem = (Element) node;
+ break;
+ default:
+ return null;
+ }
+ idIndex = new HashMap(50);
+ buildIDIndex(elem);
+ }
+ return (NodeInfo) idIndex.get(id);
+ }
+
+
+ private void buildIDIndex(Element elem) {
+ // walk the tree in reverse document order, to satisfy the XPath 1.0 rule
+ // that says if an ID appears twice, the first one wins
+ for (int i=elem.getChildCount(); --i >= 0 ; ) {
+ Node child = elem.getChild(i);
+ if (child instanceof Element) {
+ buildIDIndex((Element)child);
+ }
+ }
+ for (int i=elem.getAttributeCount(); --i >= 0 ; ) {
+ Attribute att = elem.getAttribute(i);
+ if (att.getType() == Attribute.Type.ID) {
+ idIndex.put(att.getValue(), wrap(elem));
+ }
+ }
+ }
+
+ /**
+ * Get the unparsed entity with a given name
+ *
+ * @param name
+ * the name of the entity
+ * @return null: XOM does not provide access to unparsed entities
+ * @return if the entity exists, return an array of two Strings, the first
+ * holding the system ID of the entity, the second holding the
+ * public ID if there is one, or null if not. If the entity does not
+ * exist, return null.
+ */
+
+ public String[] getUnparsedEntity(String name) {
+ return null;
+ }
+
+ private static final Method saxon85Method = findAllocateDocumentNumberMethod85();
+
+ // work-around for incompatibility introduced in saxon-8.5.1
+ private int allocateDocumentNumber(Configuration config) {
+ if (saxon85Method == null) {
+ try { // saxon >= 8.5.1
+ return allocateDocumentNumber851(config);
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+
+ // saxon < 8.5.1
+ try {
+ // return config.getNamePool().allocateDocumentNumber(this);
+ Object result = saxon85Method.invoke(config.getNamePool(), new Object[] {this});
+ return ((Integer) result).intValue();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+
+ }
+
+ // saxon >= 8.5.1
+ private int allocateDocumentNumber851(Configuration config) {
+ return config.getDocumentNumberAllocator().allocateDocumentNumber();
+ }
+
+ private static Method findAllocateDocumentNumberMethod85() {
+ try {
+ return NamePool.class.getMethod("allocateDocumentNumber", new Class[] {NodeInfo.class});
+ } catch (Throwable t) {
+ return null;
+ }
+ }
+
+ @Override
+ public Iterator getUnparsedEntityNames() {
+ return Collections.EMPTY_LIST.iterator();
+ }
+
+ @Override
+ public int getColumnNumber() {
+ return -1;
+ }
+
+ @Override
+ public boolean isId() {
+ return false;
+ }
+
+ @Override
+ public boolean isIdref() {
+ return false;
+ }
+
+ @Override
+ public boolean isNilled() {
+ return false;
+ }
+
+}
+
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.0 (the "License");
+// you may not use this file except in compliance with the License. You may
+// obtain a copy of the
+// License at http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied.
+// See the License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is: all this file.
+//
+// The Initial Developer of the Original Code is Michael Kay
+//
+// Portions created by (your name) are Copyright (C) (your legal entity). All
+// Rights Reserved.
+//
+// Contributor(s): none.
+//
Copied: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/NodeWrapper.java (from rev 3275, branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/NodeWrapper.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/NodeWrapper.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/NodeWrapper.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,1387 @@
+package org.teiid.query.xquery.saxon;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.event.Receiver;
+import net.sf.saxon.om.Axis;
+import net.sf.saxon.om.AxisIterator;
+import net.sf.saxon.om.AxisIteratorImpl;
+import net.sf.saxon.om.DocumentInfo;
+import net.sf.saxon.om.EmptyIterator;
+import net.sf.saxon.om.FastStringBuffer;
+import net.sf.saxon.om.Item;
+import net.sf.saxon.om.NamePool;
+import net.sf.saxon.om.NamespaceIterator;
+import net.sf.saxon.om.Navigator;
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.om.SequenceIterator;
+import net.sf.saxon.om.SiblingCountingNode;
+import net.sf.saxon.om.SingleNodeIterator;
+import net.sf.saxon.om.SingletonIterator;
+import net.sf.saxon.om.StandardNames;
+import net.sf.saxon.om.VirtualNode;
+import net.sf.saxon.pattern.AnyNodeTest;
+import net.sf.saxon.pattern.NameTest;
+import net.sf.saxon.pattern.NodeKindTest;
+import net.sf.saxon.pattern.NodeTest;
+import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.type.Type;
+import net.sf.saxon.value.AtomicValue;
+import net.sf.saxon.value.StringValue;
+import net.sf.saxon.value.UntypedAtomicValue;
+import net.sf.saxon.value.Value;
+import nu.xom.Attribute;
+import nu.xom.Comment;
+import nu.xom.DocType;
+import nu.xom.Document;
+import nu.xom.Element;
+import nu.xom.Node;
+import nu.xom.ParentNode;
+import nu.xom.ProcessingInstruction;
+import nu.xom.Text;
+
+/**
+ * A node in the XML parse tree representing an XML element, character content,
+ * or attribute.
+ * <P>
+ * This is the implementation of the NodeInfo interface used as a wrapper for
+ * XOM nodes.
+ *
+ * @author Michael H. Kay
+ * @author Wolfgang Hoschek (ported net.sf.saxon.jdom to XOM)
+ * @author Steve Hawkins (Ported to Saxon 9.1 for Teiid and fixed a bug with the buffer usage in getDeclaredNamespaces)
+ */
+
+public class NodeWrapper implements NodeInfo, VirtualNode, SiblingCountingNode {
+
+ protected Node node;
+
+ protected short nodeKind;
+
+ private NodeWrapper parent; // null means unknown
+
+ protected DocumentWrapper docWrapper;
+
+ protected int index; // -1 means unknown
+
+ /**
+ * This constructor is protected: nodes should be created using the wrap
+ * factory method on the DocumentWrapper class
+ *
+ * @param node
+ * The XOM node to be wrapped
+ * @param parent
+ * The NodeWrapper that wraps the parent of this node
+ * @param index
+ * Position of this node among its siblings
+ */
+ protected NodeWrapper(Node node, NodeWrapper parent, int index) {
+ short kind;
+ if (node instanceof Element) {
+ kind = Type.ELEMENT;
+ } else if (node instanceof Text) {
+ kind = Type.TEXT;
+ } else if (node instanceof Attribute) {
+ kind = Type.ATTRIBUTE;
+ } else if (node instanceof Comment) {
+ kind = Type.COMMENT;
+ } else if (node instanceof ProcessingInstruction) {
+ kind = Type.PROCESSING_INSTRUCTION;
+ } else if (node instanceof Document) {
+ kind = Type.DOCUMENT;
+ } else {
+ throwIllegalNode(node); // moved out of fast path to enable better inlining
+ return; // keep compiler happy
+ }
+ this.nodeKind = kind;
+ this.node = node;
+ this.parent = parent;
+ this.index = index;
+ }
+
+ /**
+ * Factory method to wrap a XOM node with a wrapper that implements the
+ * Saxon NodeInfo interface.
+ *
+ * @param node
+ * The XOM node
+ * @param docWrapper
+ * The wrapper for the Document containing this node
+ * @return The new wrapper for the supplied node
+ */
+ protected final NodeWrapper makeWrapper(Node node, DocumentWrapper docWrapper) {
+ return makeWrapper(node, docWrapper, null, -1);
+ }
+
+ /**
+ * Factory method to wrap a XOM node with a wrapper that implements the
+ * Saxon NodeInfo interface.
+ *
+ * @param node
+ * The XOM node
+ * @param docWrapper
+ * The wrapper for the Document containing this node
+ * @param parent
+ * The wrapper for the parent of the XOM node
+ * @param index
+ * The position of this node relative to its siblings
+ * @return The new wrapper for the supplied node
+ */
+
+ protected final NodeWrapper makeWrapper(Node node, DocumentWrapper docWrapper,
+ NodeWrapper parent, int index) {
+
+ if (node == docWrapper.node) return docWrapper;
+ NodeWrapper wrapper = new NodeWrapper(node, parent, index);
+ wrapper.docWrapper = docWrapper;
+ return wrapper;
+ }
+
+ private static void throwIllegalNode(Node node) {
+ String str = node == null ?
+ "NULL" :
+ node.getClass() + " instance " + node.toString();
+ throw new IllegalArgumentException("Bad node type in XOM! " + str);
+ }
+
+ /**
+ * Get the configuration
+ */
+
+ public Configuration getConfiguration() {
+ return docWrapper.getConfiguration();
+ }
+
+ /**
+ * Get the underlying XOM node, to implement the VirtualNode interface
+ */
+
+ public Object getUnderlyingNode() {
+ return node;
+ }
+
+ /**
+ * Get the name pool for this node
+ *
+ * @return the NamePool
+ */
+
+ public NamePool getNamePool() {
+ return docWrapper.getNamePool();
+ }
+
+ /**
+ * Return the type of node.
+ *
+ * @return one of the values Node.ELEMENT, Node.TEXT, Node.ATTRIBUTE, etc.
+ */
+
+ public int getNodeKind() {
+ return nodeKind;
+ }
+
+ /**
+ * Get the typed value of the item
+ */
+
+ public SequenceIterator getTypedValue() {
+ return SingletonIterator.makeIterator((AtomicValue)atomize());
+ }
+
+ /**
+ * Get the typed value. The result of this method will always be consistent
+ * with the method {@link net.sf.saxon.om.Item#getTypedValue()}. However,
+ * this method is often more convenient and may be more efficient,
+ * especially in the common case where the value is expected to be a
+ * singleton.
+ *
+ * @return the typed value. If requireSingleton is set to true, the result
+ * will always be an AtomicValue. In other cases it may be a Value
+ * representing a sequence whose items are atomic values.
+ * @since 8.5
+ */
+
+ public Value atomize() {
+ switch (getNodeKind()) {
+ case Type.COMMENT:
+ case Type.PROCESSING_INSTRUCTION:
+ return new StringValue(getStringValueCS());
+ default:
+ return new UntypedAtomicValue(getStringValueCS());
+ }
+ }
+
+ /**
+ * Get the type annotation of this node, if any. Returns -1 for kinds of
+ * nodes that have no annotation, and for elements annotated as untyped, and
+ * attributes annotated as untypedAtomic.
+ *
+ * @return the type annotation of the node.
+ * @see net.sf.saxon.type.Type
+ */
+
+ public int getTypeAnnotation() {
+ if (getNodeKind() == Type.ATTRIBUTE) {
+ return StandardNames.XS_UNTYPED_ATOMIC;
+ }
+ return StandardNames.XS_UNTYPED;
+ }
+
+ /**
+ * Determine whether this is the same node as another node. <br />
+ * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b)
+ *
+ * @return true if this Node object and the supplied Node object represent
+ * the same node in the tree.
+ */
+
+ public boolean isSameNodeInfo(NodeInfo other) {
+ if (other instanceof NodeWrapper) {
+ return node == ((NodeWrapper) other).node; // In XOM equality means identity
+ }
+ return false;
+ }
+
+ /**
+ * The equals() method compares nodes for identity. It is defined to give the same result
+ * as isSameNodeInfo().
+ *
+ * @param other the node to be compared with this node
+ * @return true if this NodeInfo object and the supplied NodeInfo object represent
+ * the same node in the tree.
+ * @since 8.7 Previously, the effect of the equals() method was not defined. Callers
+ * should therefore be aware that third party implementations of the NodeInfo interface may
+ * not implement the correct semantics. It is safer to use isSameNodeInfo() for this reason.
+ * The equals() method has been defined because it is useful in contexts such as a Java Set or HashMap.
+ */
+
+ public boolean equals(Object other) {
+ if (other instanceof NodeInfo) {
+ return isSameNodeInfo((NodeInfo)other);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * The hashCode() method obeys the contract for hashCode(): that is, if two objects are equal
+ * (represent the same node) then they must have the same hashCode()
+ * @since 8.7 Previously, the effect of the equals() and hashCode() methods was not defined. Callers
+ * should therefore be aware that third party implementations of the NodeInfo interface may
+ * not implement the correct semantics.
+ */
+
+ public int hashCode() {
+ return node.hashCode();
+ }
+
+ /**
+ * Get the System ID for the node.
+ *
+ * @return the System Identifier of the entity in the source document
+ * containing the node, or null if not known. Note this is not the
+ * same as the base URI: the base URI can be modified by xml:base,
+ * but the system ID cannot.
+ */
+
+ public String getSystemId() {
+ return docWrapper.baseURI;
+ }
+
+ public void setSystemId(String uri) {
+ docWrapper.baseURI = uri;
+ }
+
+ /**
+ * Get the Base URI for the node, that is, the URI used for resolving a
+ * relative URI contained in the node.
+ */
+
+ public String getBaseURI() {
+ return node.getBaseURI();
+ }
+
+ /**
+ * Get line number
+ *
+ * @return the line number of the node in its original source document; or
+ * -1 if not available
+ */
+
+ public int getLineNumber() {
+ return -1;
+ }
+
+ /**
+ * Determine the relative position of this node and another node, in
+ * document order. The other node will always be in the same document.
+ *
+ * @param other
+ * The other node, whose position is to be compared with this
+ * node
+ * @return -1 if this node precedes the other node, +1 if it follows the
+ * other node, or 0 if they are the same node. (In this case,
+ * isSameNode() will always return true, and the two nodes will
+ * produce the same result for generateId())
+ */
+
+ public int compareOrder(NodeInfo other) {
+ if (other instanceof NodeWrapper) {
+ return compareOrderFast(node,((NodeWrapper) other).node);
+// }
+// if (other instanceof SiblingCountingNode) {
+// return Navigator.compareOrder(this, (SiblingCountingNode) other);
+ } else {
+ // it must be a namespace node
+ return -other.compareOrder(this);
+ }
+ }
+
+ private static int compareOrderFast(Node first, Node second) {
+ /*
+ * Unfortunately we do not have a sequence number for each node at hand;
+ * this would allow to turn the comparison into a simple sequence number
+ * subtraction. Walking the entire tree and batch-generating sequence
+ * numbers on the fly is no good option either. However, this rewritten
+ * implementation turns out to be more than fast enough.
+ */
+
+ // assert first != null && second != null
+ // assert first and second MUST NOT be namespace nodes
+ if (first == second) return 0;
+
+ ParentNode firstParent = first.getParent();
+ ParentNode secondParent = second.getParent();
+ if (firstParent == null) {
+ if (secondParent != null) return -1; // first node is the root
+ // both nodes are parentless, use arbitrary but fixed order:
+ return first.hashCode() - second.hashCode();
+ }
+
+ if (secondParent == null) return +1; // second node is the root
+
+ // do they have the same parent (common case)?
+ if (firstParent == secondParent) {
+ int i1 = firstParent.indexOf(first);
+ int i2 = firstParent.indexOf(second);
+
+ // note that attributes and namespaces are not children
+ // of their own parent (i = -1).
+ // attribute (if any) comes before child
+ if (i1 != -1) return (i2 != -1) ? i1 - i2 : +1;
+ if (i2 != -1) return -1;
+
+ // assert: i1 == -1 && i2 == -1
+ // i.e. both nodes are attributes
+ Element elem = (Element) firstParent;
+ for (int i = elem.getAttributeCount(); --i >= 0;) {
+ Attribute attr = elem.getAttribute(i);
+ if (attr == second) return -1;
+ if (attr == first) return +1;
+ }
+ throw new IllegalStateException("should be unreachable");
+ }
+
+ // find the depths of both nodes in the tree
+ int depth1 = 0;
+ int depth2 = 0;
+ Node p1 = first;
+ Node p2 = second;
+ while (p1 != null) {
+ depth1++;
+ p1 = p1.getParent();
+ if (p1 == second) return +1;
+ }
+ while (p2 != null) {
+ depth2++;
+ p2 = p2.getParent();
+ if (p2 == first) return -1;
+ }
+
+ // move up one branch of the tree so we have two nodes on the same level
+ p1 = first;
+ while (depth1 > depth2) {
+ p1 = p1.getParent();
+ depth1--;
+ }
+ p2 = second;
+ while (depth2 > depth1) {
+ p2 = p2.getParent();
+ depth2--;
+ }
+
+ // now move up both branches in sync until we find a common parent
+ while (true) {
+ firstParent = p1.getParent();
+ secondParent = p2.getParent();
+ if (firstParent == null || secondParent == null) {
+ // both nodes are documentless, use arbitrary but fixed order
+ // based on their root elements
+ return p1.hashCode() - p2.hashCode();
+ // throw new NullPointerException("XOM tree compare - internal error");
+ }
+ if (firstParent == secondParent) {
+ return firstParent.indexOf(p1) - firstParent.indexOf(p2);
+ }
+ p1 = firstParent;
+ p2 = secondParent;
+ }
+ }
+
+ /**
+ * Return the string value of the node. The interpretation of this depends
+ * on the type of node. For an element it is the accumulated character
+ * content of the element, including descendant elements.
+ *
+ * @return the string value of the node
+ */
+
+ public String getStringValue() {
+ return node.getValue();
+ }
+
+ /**
+ * Get the value of the item as a CharSequence. This is in some cases more efficient than
+ * the version of the method that returns a String.
+ */
+
+ public CharSequence getStringValueCS() {
+ return node.getValue();
+ }
+
+ /**
+ * Get name code. The name code is a coded form of the node name: two nodes
+ * with the same name code have the same namespace URI, the same local name,
+ * and the same prefix. By masking the name code with &0xfffff, you get a
+ * fingerprint: two nodes with the same fingerprint have the same local name
+ * and namespace URI.
+ *
+ * @see net.sf.saxon.om.NamePool#allocate allocate
+ */
+
+ public int getNameCode() {
+ switch (nodeKind) {
+ case Type.ELEMENT:
+ case Type.ATTRIBUTE:
+ case Type.PROCESSING_INSTRUCTION:
+ return docWrapper.getNamePool().allocate(getPrefix(), getURI(),
+ getLocalPart());
+ default:
+ return -1;
+ }
+ }
+
+ /**
+ * Get fingerprint. The fingerprint is a coded form of the expanded name of
+ * the node: two nodes with the same name code have the same namespace URI
+ * and the same local name. A fingerprint of -1 should be returned for a
+ * node with no name.
+ */
+
+ public int getFingerprint() {
+ int nc = getNameCode();
+ if (nc == -1) return -1;
+ return nc & 0xfffff;
+ }
+
+ /**
+ * Get the local part of the name of this node. This is the name after the
+ * ":" if any.
+ *
+ * @return the local part of the name. For an unnamed node, returns "".
+ */
+
+ public String getLocalPart() {
+ switch (nodeKind) {
+ case Type.ELEMENT:
+ return ((Element) node).getLocalName();
+ case Type.ATTRIBUTE:
+ return ((Attribute) node).getLocalName();
+ case Type.PROCESSING_INSTRUCTION:
+ return ((ProcessingInstruction) node).getTarget();
+ default:
+ return "";
+ }
+ }
+
+ /**
+ * Get the prefix of the name of the node. This is defined only for elements and attributes.
+ * If the node has no prefix, or for other kinds of node, return a zero-length string.
+ * @return The prefix of the name of the node.
+ */
+
+ public String getPrefix() {
+ switch (nodeKind) {
+ case Type.ELEMENT:
+ return ((Element) node).getNamespacePrefix();
+ case Type.ATTRIBUTE:
+ return ((Attribute) node).getNamespacePrefix();
+ default:
+ return "";
+ }
+ }
+
+ /**
+ * Get the URI part of the name of this node. This is the URI corresponding
+ * to the prefix, or the URI of the default namespace if appropriate.
+ *
+ * @return The URI of the namespace of this node. For an unnamed node, or
+ * for a node with an empty prefix, return an empty string.
+ */
+
+ public String getURI() {
+ switch (nodeKind) {
+ case Type.ELEMENT:
+ return ((Element) node).getNamespaceURI();
+ case Type.ATTRIBUTE:
+ return ((Attribute) node).getNamespaceURI();
+ default:
+ return "";
+ }
+ }
+
+ /**
+ * Get the display name of this node. For elements and attributes this is
+ * [prefix:]localname. For unnamed nodes, it is an empty string.
+ *
+ * @return The display name of this node. For a node with no name, return an
+ * empty string.
+ */
+
+ public String getDisplayName() {
+ switch (nodeKind) {
+ case Type.ELEMENT:
+ return ((Element) node).getQualifiedName();
+ case Type.ATTRIBUTE:
+ return ((Attribute) node).getQualifiedName();
+ case Type.PROCESSING_INSTRUCTION:
+ return ((ProcessingInstruction) node).getTarget();
+ default:
+ return "";
+ }
+ }
+
+ /**
+ * Get the NodeInfo object representing the parent of this node
+ */
+
+ public NodeInfo getParent() {
+ if (parent == null) {
+ ParentNode p = node.getParent();
+ if (p != null) parent = makeWrapper(p, docWrapper);
+ }
+ return parent;
+ }
+
+ /**
+ * Get the index position of this node among its siblings (starting from 0)
+ */
+
+ public int getSiblingPosition() {
+ if (index != -1) return index;
+ switch (nodeKind) {
+ case Type.ATTRIBUTE: {
+ Attribute att = (Attribute) node;
+ Element p = (Element) att.getParent();
+ if (p == null) return 0;
+ for (int i=p.getAttributeCount(); --i >= 0;) {
+ if (p.getAttribute(i) == att) {
+ index = i;
+ return i;
+ }
+ }
+ throw new IllegalStateException("XOM node not linked to parent node");
+ }
+
+ default: {
+ ParentNode p = node.getParent();
+ int i = (p == null ? 0 : p.indexOf(node));
+ if (i == -1) throw new IllegalStateException("XOM node not linked to parent node");
+ index = i;
+ return index;
+ }
+ }
+ }
+
+ /**
+ * Return an iteration over the nodes reached by the given axis from this
+ * node
+ *
+ * @param axisNumber
+ * the axis to be used
+ * @return a SequenceIterator that scans the nodes reached by the axis in
+ * turn.
+ */
+
+ public AxisIterator iterateAxis(byte axisNumber) {
+ return iterateAxis(axisNumber, AnyNodeTest.getInstance());
+ }
+
+ /**
+ * Return an iteration over the nodes reached by the given axis from this
+ * node
+ *
+ * @param axisNumber
+ * the axis to be used
+ * @param nodeTest
+ * A pattern to be matched by the returned nodes
+ * @return a SequenceIterator that scans the nodes reached by the axis in
+ * turn.
+ */
+
+ public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest) {
+ // for clarifications, see the W3C specs or:
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/h...
+ switch (axisNumber) {
+ case Axis.ANCESTOR:
+ return new AncestorAxisIterator(this, false, nodeTest);
+
+ case Axis.ANCESTOR_OR_SELF:
+ return new AncestorAxisIterator(this, true, nodeTest);
+
+ case Axis.ATTRIBUTE:
+ if (nodeKind != Type.ELEMENT || ((Element) node).getAttributeCount() == 0) {
+ return EmptyIterator.getInstance();
+ } else {
+ return new AttributeAxisIterator(this, nodeTest);
+ }
+
+ case Axis.CHILD:
+ if (hasChildNodes()) {
+ return new ChildAxisIterator(this, true, true, nodeTest);
+ } else {
+ return EmptyIterator.getInstance();
+ }
+
+ case Axis.DESCENDANT:
+ if (hasChildNodes()) {
+ return new DescendantAxisIterator(this, false, false, nodeTest);
+ } else {
+ return EmptyIterator.getInstance();
+ }
+
+ case Axis.DESCENDANT_OR_SELF:
+ if (hasChildNodes()) {
+ return new DescendantAxisIterator(this, true, false, nodeTest);
+ } else {
+ return filteredSingleton(this, nodeTest);
+ }
+
+ case Axis.FOLLOWING:
+ if (getParent() == null) {
+ return EmptyIterator.getInstance();
+ } else {
+ return new DescendantAxisIterator(this, false, true, nodeTest);
+ }
+
+ case Axis.FOLLOWING_SIBLING:
+ if (nodeKind == Type.ATTRIBUTE || getParent() == null) {
+ return EmptyIterator.getInstance();
+ } else {
+ return new ChildAxisIterator(this, false, true, nodeTest);
+ }
+
+ case Axis.NAMESPACE:
+ if (nodeKind == Type.ELEMENT) {
+ return NamespaceIterator.makeIterator(this, nodeTest);
+ } else {
+ return EmptyIterator.getInstance();
+ }
+
+ case Axis.PARENT:
+ if (getParent() == null) {
+ return EmptyIterator.getInstance();
+ } else {
+ return filteredSingleton(getParent(), nodeTest);
+ }
+
+ case Axis.PRECEDING:
+ return new PrecedingAxisIterator(this, false, nodeTest);
+// return new Navigator.AxisFilter(
+// new Navigator.PrecedingEnumeration(this, false), nodeTest);
+
+ case Axis.PRECEDING_SIBLING:
+ if (nodeKind == Type.ATTRIBUTE || getParent() == null) {
+ return EmptyIterator.getInstance();
+ } else {
+ return new ChildAxisIterator(this, false, false, nodeTest);
+ }
+
+ case Axis.SELF:
+ return filteredSingleton(this, nodeTest);
+
+ case Axis.PRECEDING_OR_ANCESTOR:
+ // This axis is used internally by saxon for the xsl:number implementation,
+ // it returns the union of the preceding axis and the ancestor axis.
+ return new PrecedingAxisIterator(this, true, nodeTest);
+// return new Navigator.AxisFilter(new Navigator.PrecedingEnumeration(
+// this, true), nodeTest);
+
+ default:
+ throw new IllegalArgumentException("Unknown axis number " + axisNumber);
+ }
+ }
+
+// private static AxisIterator makeSingleIterator(NodeWrapper wrapper, NodeTest nodeTest) {
+// if (nodeTest == AnyNodeTest.getInstance() || nodeTest.matches(wrapper))
+// return SingletonIterator.makeIterator(wrapper);
+// else
+// return EmptyIterator.getInstance();
+// }
+
+ /**
+ * Get the value of a given attribute of this node
+ *
+ * @param fingerprint
+ * The fingerprint of the attribute name
+ * @return the attribute value if it exists or null if not
+ */
+
+ public String getAttributeValue(int fingerprint) {
+ if (nodeKind == Type.ELEMENT) {
+ NamePool pool = docWrapper.getNamePool();
+ String localName = pool.getLocalName(fingerprint);
+ String uri = pool.getURI(fingerprint);
+ Attribute att = ((Element) node).getAttribute(localName, uri);
+ if (att != null) return att.getValue();
+ }
+ return null;
+ }
+
+ /**
+ * Get the root node of the tree containing this node
+ *
+ * @return the NodeInfo representing the top-level ancestor of this node.
+ * This will not necessarily be a document node
+ */
+
+ public NodeInfo getRoot() {
+ return docWrapper;
+ }
+
+ /**
+ * Get the root node, if it is a document node.
+ *
+ * @return the DocumentInfo representing the containing document.
+ */
+
+ public DocumentInfo getDocumentRoot() {
+ if (docWrapper.node instanceof Document) {
+ return docWrapper;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Determine whether the node has any children. <br />
+ * Note: the result is equivalent to <br />
+ * getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext()
+ */
+
+ public boolean hasChildNodes() {
+ return node.getChildCount() > 0;
+ }
+
+ /**
+ * Get a character string that uniquely identifies this node. Note:
+ * a.isSameNode(b) if and only if generateId(a)==generateId(b)
+ *
+ * @param buffer a buffer to contain a string that uniquely identifies this node, across all documents
+ */
+
+ public void generateId(FastStringBuffer buffer) {
+ Navigator.appendSequentialKey(this, buffer, true);
+ //buffer.append(Navigator.getSequentialKey(this));
+ }
+
+ /**
+ * Get the document number of the document containing this node. For a
+ * free-standing orphan node, just return the hashcode.
+ */
+
+ public int getDocumentNumber() {
+ return docWrapper.getDocumentNumber();
+ }
+
+ /**
+ * Copy this node to a given outputter (deep copy)
+ */
+
+ public void copy(Receiver out, int whichNamespaces,
+ boolean copyAnnotations, int locationId) throws XPathException {
+ Navigator.copy(this, out, docWrapper.getNamePool(), whichNamespaces,
+ copyAnnotations, locationId);
+ }
+
+ /**
+ * Get all namespace undeclarations and undeclarations defined on this element.
+ *
+ * @param buffer If this is non-null, and the result array fits in this buffer, then the result
+ * may overwrite the contents of this array, to avoid the cost of allocating a new array on the heap.
+ * @return An array of integers representing the namespace declarations and undeclarations present on
+ * this element. For a node other than an element, return null. Otherwise, the returned array is a
+ * sequence of namespace codes, whose meaning may be interpreted by reference to the name pool. The
+ * top half word of each namespace code represents the prefix, the bottom half represents the URI.
+ * If the bottom half is zero, then this is a namespace undeclaration rather than a declaration.
+ * The XML namespace is never included in the list. If the supplied array is larger than required,
+ * then the first unused entry will be set to -1.
+ * <p/>
+ * <p>For a node other than an element, the method returns null.</p>
+ */
+
+ public int[] getDeclaredNamespaces(int[] buffer) {
+ if (node instanceof Element) {
+ Element elem = (Element)node;
+ int size = elem.getNamespaceDeclarationCount();
+ if (size == 0) {
+ return EMPTY_NAMESPACE_LIST;
+ }
+ int[] result = (buffer != null && size <= buffer.length ? buffer : new int[size]);
+ NamePool pool = getNamePool();
+ for (int i=0; i < size; i++) {
+ String prefix = elem.getNamespacePrefix(i);
+ String uri = elem.getNamespaceURI(prefix);
+ result[i] = pool.allocateNamespaceCode(prefix, uri);
+ }
+ if (size < result.length) {
+ result[size] = -1;
+ }
+ return result;
+ } else {
+ return null;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Axis enumeration classes
+ ///////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Handles the ancestor axis in a rather direct manner.
+ */
+ private final class AncestorAxisIterator extends AxisIteratorImpl {
+
+ private NodeWrapper start;
+ private boolean includeSelf;
+
+ private NodeTest nodeTest;
+
+ public AncestorAxisIterator(NodeWrapper start, boolean includeSelf, NodeTest test) {
+ // use lazy instead of eager materialization (performance)
+ this.start = start;
+ if (test == AnyNodeTest.getInstance()) test = null;
+ this.nodeTest = test;
+ if (!includeSelf) this.current = start;
+ this.includeSelf = includeSelf;
+ this.position = 0;
+ }
+
+ public Item next() {
+ NodeInfo curr;
+ do { // until we find a match
+ curr = advance();
+ }
+ while (curr != null && nodeTest != null && (! nodeTest.matches(curr)));
+
+ if (curr != null) position++;
+ current = curr;
+ return curr;
+ }
+
+ private NodeInfo advance() {
+ if (current == null)
+ current = start;
+ else
+ current = current.getParent();
+
+ return current;
+ }
+
+ public Item current() {
+ return current;
+ }
+
+ public SequenceIterator getAnother() {
+ return new AncestorAxisIterator(start, includeSelf, nodeTest);
+ }
+
+ public int getProperties() {
+ return 0;
+ }
+
+ } // end of class AncestorAxisIterator
+
+ /**
+ * Handles the attribute axis in a rather direct manner.
+ */
+ private final class AttributeAxisIterator extends AxisIteratorImpl {
+
+ private NodeWrapper start;
+
+ private int cursor;
+
+ private NodeTest nodeTest;
+
+ public AttributeAxisIterator(NodeWrapper start, NodeTest test) {
+ // use lazy instead of eager materialization (performance)
+ this.start = start;
+ if (test == AnyNodeTest.getInstance()) test = null;
+ this.nodeTest = test;
+ this.position = 0;
+ this.cursor = 0;
+ }
+
+ public Item next() {
+ NodeInfo curr;
+ do { // until we find a match
+ curr = advance();
+ }
+ while (curr != null && nodeTest != null && (! nodeTest.matches(curr)));
+
+ if (curr != null) position++;
+ current = curr;
+ return curr;
+ }
+
+ private NodeInfo advance() {
+ Element elem = (Element) start.node;
+ if (cursor == elem.getAttributeCount()) return null;
+ NodeInfo curr = makeWrapper(elem.getAttribute(cursor), docWrapper, start, cursor);
+ cursor++;
+ return curr;
+ }
+
+ public Item current() {
+ return current;
+ }
+
+ public SequenceIterator getAnother() {
+ return new AttributeAxisIterator(start, nodeTest);
+ }
+
+ public int getProperties() {
+ return 0;
+ }
+
+ } // end of class AttributeAxisIterator
+
+ /**
+ * The class ChildAxisIterator handles not only the child axis, but also the
+ * following-sibling and preceding-sibling axes. It can also iterate the
+ * children of the start node in reverse order, something that is needed to
+ * support the preceding and preceding-or-ancestor axes (the latter being
+ * used by xsl:number)
+ */
+ private final class ChildAxisIterator extends AxisIteratorImpl {
+
+ private NodeWrapper start;
+ private NodeWrapper commonParent;
+ private int ix;
+ private boolean downwards; // iterate children of start node (not siblings)
+ private boolean forwards; // iterate in document order (not reverse order)
+
+ private ParentNode par;
+ private int cursor;
+
+ private NodeTest nodeTest;
+
+ private ChildAxisIterator(NodeWrapper start, boolean downwards, boolean forwards, NodeTest test) {
+ this.start = start;
+ this.downwards = downwards;
+ this.forwards = forwards;
+
+ if (test == AnyNodeTest.getInstance()) test = null;
+ this.nodeTest = test;
+ this.position = 0;
+
+ if (downwards)
+ commonParent = start;
+ else
+ commonParent = (NodeWrapper) start.getParent();
+
+ par = (ParentNode) commonParent.node;
+ if (downwards) {
+ ix = (forwards ? 0 : par.getChildCount());
+ } else {
+ // find the start node among the list of siblings
+// ix = start.getSiblingPosition();
+ ix = par.indexOf(start.node);
+ if (forwards) ix++;
+ }
+ cursor = ix;
+ if (!downwards && !forwards) ix--;
+ }
+
+ public Item next() {
+ NodeInfo curr;
+ do { // until we find a match
+ curr = advance();
+ }
+ while (curr != null && nodeTest != null && (! nodeTest.matches(curr)));
+
+ if (curr != null) position++;
+ current = curr;
+ return curr;
+ }
+
+ private NodeInfo advance() {
+ Node nextChild;
+ do {
+ if (forwards) {
+ if (cursor == par.getChildCount()) return null;
+ nextChild = par.getChild(cursor++);
+ } else { // backwards
+ if (cursor == 0) return null;
+ nextChild = par.getChild(--cursor);
+ }
+ } while (nextChild instanceof DocType);
+ // DocType is not an XPath node; can occur for /child::node()
+
+ NodeInfo curr = makeWrapper(nextChild, docWrapper, commonParent, ix);
+ ix += (forwards ? 1 : -1);
+ return curr;
+ }
+
+ public Item current() {
+ return current;
+ }
+
+ public SequenceIterator getAnother() {
+ return new ChildAxisIterator(start, downwards, forwards, nodeTest);
+ }
+
+ public int getProperties() {
+ return 0;
+ }
+ }
+
+ /**
+ * A bit of a misnomer; efficiently takes care of descendants,
+ * descentants-or-self as well as "following" axis.
+ * "includeSelf" must be false for the following axis.
+ * Uses simple and effective O(1) backtracking via indexOf().
+ */
+ private final class DescendantAxisIterator extends AxisIteratorImpl {
+
+ private NodeWrapper start;
+ private boolean includeSelf;
+ private boolean following;
+
+ private Node anchor; // so we know where to stop the scan
+ private Node currNode;
+ private boolean moveToNextSibling;
+
+ private NodeTest nodeTest;
+
+ private String testLocalName;
+ private String testURI;
+
+ public DescendantAxisIterator(NodeWrapper start, boolean includeSelf, boolean following, NodeTest test) {
+ this.start = start;
+ this.includeSelf = includeSelf;
+ this.following = following;
+ this.moveToNextSibling = following;
+
+ if (!following) anchor = start.node;
+ if (!includeSelf) currNode = start.node;
+
+ if (test == AnyNodeTest.getInstance()) { // performance hack
+ test = null; // mark as AnyNodeTest
+ }
+ else if (test instanceof NameTest) {
+ NameTest nt = (NameTest) test;
+ if (nt.getPrimitiveType() == Type.ELEMENT) { // performance hack
+ // mark as element name test
+ NamePool pool = getNamePool();
+ this.testLocalName = pool.getLocalName(nt.getFingerprint());
+ this.testURI = pool.getURI(nt.getFingerprint());
+ }
+ }
+ else if (test instanceof NodeKindTest) {
+ if (test.getPrimitiveType() == Type.ELEMENT) { // performance hack
+ // mark as element type test
+ this.testLocalName = "";
+ this.testURI = null;
+ }
+ }
+ this.nodeTest = test;
+ this.position = 0;
+ }
+
+ public Item next() {
+ NodeInfo curr;
+ do { // until we find a match
+ curr = advance();
+ }
+ while (curr != null && nodeTest != null && (! nodeTest.matches(curr)));
+
+ if (curr != null) position++;
+ current = curr;
+ return curr;
+ }
+
+ // might look expensive at first glance - but it's not
+ private NodeInfo advance() {
+ if (currNode == null) { // if includeSelf
+ currNode = start.node;
+ return start;
+ }
+
+ int i;
+ do {
+ i = 0;
+ Node p = currNode;
+
+ if (p.getChildCount() == 0 || moveToNextSibling) { // move to next sibling
+
+ moveToNextSibling = false; // do it just once
+ while (true) {
+ // if we've reached the root we're done scanning
+ p = currNode.getParent();
+ if (p == null) return null;
+
+ // Note: correct even if currNode is an attribute.
+ // Performance is particularly good with the O(1) patch
+ // for XOM's ParentNode.indexOf()
+ i = currNode.getParent().indexOf(currNode) + 1;
+
+ if (i < p.getChildCount()) {
+ break; // break out of while(true) loop; move to next sibling
+ }
+ else { // reached last sibling; move up
+ currNode = p;
+ // if we've come all the way back to the start anchor we're done
+ if (p == anchor) return null;
+ }
+ }
+ }
+ currNode = p.getChild(i);
+ } while (!conforms(currNode));
+
+ // note the null here: makeNodeWrapper(parent, ...) is fast, so it
+ // doesn't really matter that we don't keep a link to it.
+ // In fact, it makes objects more short lived, easing pressure on
+ // the VM allocator and collector for tenured heaps.
+ return makeWrapper(currNode, docWrapper, null, i);
+ }
+
+ // avoids NodeWrapper allocation when there's clearly a mismatch (common case)
+ private boolean conforms(Node node) {
+ if (this.testLocalName != null) { // element test?
+ if (!(node instanceof Element)) return false;
+ if (this.testURI == null) return true; // pure element type test
+
+ // element name test
+ Element elem = (Element) node;
+ return this.testLocalName.equals(elem.getLocalName()) &&
+ this.testURI.equals(elem.getNamespaceURI());
+ }
+ else { // DocType is not an XPath node; can occur for /descendants::node()
+ return !(node instanceof DocType);
+ }
+ }
+
+ public Item current() {
+ return current;
+ }
+
+ public SequenceIterator getAnother() {
+ return new DescendantAxisIterator(start, includeSelf, following, nodeTest);
+ }
+
+ public int getProperties() {
+ return 0;
+ }
+ }
+
+ /**
+ * Efficiently takes care of preceding axis and Saxon internal preceding-or-ancestor axis.
+ * Uses simple and effective O(1) backtracking via indexOf().
+ * Implemented along similar lines as DescendantAxisIterator.
+ */
+ private final class PrecedingAxisIterator extends AxisIteratorImpl {
+
+ private NodeWrapper start;
+ private boolean includeAncestors;
+
+ private Node currNode;
+ private ParentNode nextAncestor; // next ancestors to skip if !includeAncestors
+
+ private NodeTest nodeTest;
+
+ private String testLocalName;
+ private String testURI;
+
+ public PrecedingAxisIterator(NodeWrapper start, boolean includeAncestors, NodeTest test) {
+ this.start = start;
+ this.includeAncestors = includeAncestors;
+ this.currNode = start.node;
+ if (includeAncestors)
+ nextAncestor = null;
+ else
+ nextAncestor = start.node.getParent();
+
+ if (test == AnyNodeTest.getInstance()) { // performance hack
+ test = null; // mark as AnyNodeTest
+ }
+ else if (test instanceof NameTest) {
+ NameTest nt = (NameTest) test;
+ if (nt.getPrimitiveType() == Type.ELEMENT) { // performance hack
+ // mark as element name test
+ NamePool pool = getNamePool();
+ this.testLocalName = pool.getLocalName(nt.getFingerprint());
+ this.testURI = pool.getURI(nt.getFingerprint());
+ }
+ }
+ else if (test instanceof NodeKindTest) {
+ if (test.getPrimitiveType() == Type.ELEMENT) { // performance hack
+ // mark as element type test
+ this.testLocalName = "";
+ this.testURI = null;
+ }
+ }
+ this.nodeTest = test;
+ this.position = 0;
+ }
+
+ public Item next() {
+ NodeInfo curr;
+ do { // until we find a match
+ curr = advance();
+ }
+ while (curr != null && nodeTest != null && (! nodeTest.matches(curr)));
+
+ if (curr != null) position++;
+ current = curr;
+ return curr;
+ }
+
+ // might look expensive at first glance - but it's not
+ private NodeInfo advance() {
+ int i;
+ do {
+ Node p;
+
+ while (true) {
+ // if we've reached the root we're done scanning
+// System.out.println("p="+p);
+ p = currNode.getParent();
+ if (p == null) return null;
+
+ // Note: correct even if currNode is an attribute.
+ // Performance is particularly good with the O(1) patch
+ // for XOM's ParentNode.indexOf()
+ i = currNode.getParent().indexOf(currNode) - 1;
+
+ if (i >= 0) { // move to next sibling's last descendant node
+ p = p.getChild(i); // move to next sibling
+ int j;
+ while ((j = p.getChildCount()-1) >= 0) { // move to last descendant node
+ p = p.getChild(j);
+ i = j;
+ }
+ break; // break out of while(true) loop
+ }
+ else { // there are no more siblings; move up
+ // if !includeAncestors skip the ancestors of the start node
+ // assert p != null
+ if (p != nextAncestor) break; // break out of while(true) loop
+
+ nextAncestor = nextAncestor.getParent();
+ currNode = p;
+ }
+ }
+ currNode = p;
+
+ } while (!conforms(currNode));
+
+ // note the null here: makeNodeWrapper(parent, ...) is fast, so it
+ // doesn't really matter that we don't keep a link to it.
+ // In fact, it makes objects more short lived, easing pressure on
+ // the VM allocator and collector for tenured heaps.
+ return makeWrapper(currNode, docWrapper, null, i);
+ }
+
+ // avoids NodeWrapper allocation when there's clearly a mismatch (common case)
+ // same as for DescendantAxisIterator
+ private boolean conforms(Node node) {
+ if (this.testLocalName != null) { // element test?
+ if (!(node instanceof Element)) return false;
+ if (this.testURI == null) return true; // pure element type test
+
+ // element name test
+ Element elem = (Element) node;
+ return this.testLocalName.equals(elem.getLocalName()) &&
+ this.testURI.equals(elem.getNamespaceURI());
+ }
+ else { // DocType is not an XPath node
+ return !(node instanceof DocType);
+ }
+ }
+
+ public Item current() {
+ return current;
+ }
+
+ public SequenceIterator getAnother() {
+ return new PrecedingAxisIterator(start, includeAncestors, nodeTest);
+ }
+
+ public int getProperties() {
+ return 0;
+ }
+ }
+
+ private static AxisIterator filteredSingleton(NodeInfo node, NodeTest nodeTest) {
+// return Navigator.filteredSingleton(node, nodeTest); // saxon >= 8.7
+ if (node != null && (nodeTest == AnyNodeTest.getInstance() || nodeTest.matches(node))) {
+ return SingleNodeIterator.makeIterator(node);
+ } else {
+ return EmptyIterator.getInstance();
+ }
+ }
+
+ @Override
+ public int getColumnNumber() {
+ return -1;
+ }
+
+ @Override
+ public boolean isId() {
+ return false;
+ }
+
+ @Override
+ public boolean isIdref() {
+ return false;
+ }
+
+ @Override
+ public boolean isNilled() {
+ return false;
+ }
+
+}
+
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.0 (the "License");
+// you may not use this file except in compliance with the License. You may
+// obtain a copy of the
+// License at http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied.
+// See the License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is: all this file.
+//
+// The Initial Developer of the Original Code is Michael Kay, with extensive
+// rewriting by Wolfgang Hoschek
+//
+// Portions created by (your name) are Copyright (C) (your legal entity). All
+// Rights Reserved.
+//
+// Contributor(s): none.
+//
Modified: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/PathMapFilter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/PathMapFilter.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/PathMapFilter.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -184,5 +184,13 @@
super.endElement();
}
}
+
+ @Override
+ public void startContent() throws XPathException {
+ MatchContext context = matchContext.getLast();
+ if (context.matchedElement) {
+ super.startContent();
+ }
+ }
}
\ No newline at end of file
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -23,9 +23,11 @@
package org.teiid.query.xquery.saxon;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Writer;
import java.sql.SQLXML;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
@@ -61,6 +63,7 @@
import net.sf.saxon.query.DynamicQueryContext;
import net.sf.saxon.query.QueryResult;
import net.sf.saxon.query.StaticQueryContext;
+import net.sf.saxon.query.XQueryExpression;
import net.sf.saxon.sxpath.IndependentContext;
import net.sf.saxon.sxpath.XPathEvaluator;
import net.sf.saxon.sxpath.XPathExpression;
@@ -69,6 +72,12 @@
import net.sf.saxon.type.ItemType;
import net.sf.saxon.type.TypeHierarchy;
import net.sf.saxon.value.SequenceType;
+import nu.xom.Builder;
+import nu.xom.Element;
+import nu.xom.Nodes;
+import nu.xom.ParsingException;
+import nux.xom.xquery.StreamingPathFilter;
+import nux.xom.xquery.StreamingTransform;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.common.buffer.BufferManager;
@@ -80,6 +89,9 @@
import org.teiid.core.types.XMLTranslator;
import org.teiid.core.types.XMLType;
import org.teiid.core.types.XMLType.Type;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
import org.teiid.query.QueryPlugin;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.function.source.XMLSystemFunctions;
@@ -88,11 +100,34 @@
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.query.util.CommandContext;
import org.teiid.translator.WSConnection.Util;
@SuppressWarnings("serial")
public class SaxonXQueryExpression {
+ public static final Properties DEFAULT_OUTPUT_PROPERTIES = new Properties();
+ {
+ DEFAULT_OUTPUT_PROPERTIES.setProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+ //props.setProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ DEFAULT_OUTPUT_PROPERTIES.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
+ }
+
+ private static Nodes NONE = new Nodes();
+ private static InputStream FAKE_IS = new InputStream() {
+
+ @Override
+ public int read() throws IOException {
+ return 0;
+ }
+ };
+
+ public interface RowProcessor {
+
+ void processRow(NodeInfo row);
+
+ }
+
public static class Result {
public SequenceIterator iter;
public List<Source> sources = new LinkedList<Source>();
@@ -147,16 +182,20 @@
}
};
- private net.sf.saxon.query.XQueryExpression xQuery;
+ private XQueryExpression xQuery;
+ private String xQueryString;
+ private Map<String, String> namespaceMap = new HashMap<String, String>();
private Configuration config = new Configuration();
private PathMapRoot contextRoot;
+ private StreamingPathFilter streamingPathFilter;
public SaxonXQueryExpression(String xQueryString, XMLNamespaces namespaces, List<DerivedColumn> passing, List<XMLTable.XMLColumn> columns)
throws QueryResolverException {
config.setErrorListener(ERROR_LISTENER);
+ this.xQueryString = xQueryString;
StaticQueryContext context = new StaticQueryContext(config);
IndependentContext ic = new IndependentContext(config);
-
+ namespaceMap.put("", ""); //$NON-NLS-1$ //$NON-NLS-2$
if (namespaces != null) {
for (NamespaceItem item : namespaces.getNamespaceItems()) {
if (item.getPrefix() == null) {
@@ -166,10 +205,12 @@
} else {
context.setDefaultElementNamespace(item.getUri());
ic.setDefaultElementNamespace(item.getUri());
+ namespaceMap.put("", item.getUri()); //$NON-NLS-1$
}
} else {
context.declareNamespace(item.getPrefix(), item.getUri());
ic.declareNamespace(item.getPrefix(), item.getUri());
+ namespaceMap.put(item.getPrefix(), item.getUri());
}
}
}
@@ -211,6 +252,13 @@
}
public void useDocumentProjection(List<XMLTable.XMLColumn> columns, AnalysisRecord record) {
+ try {
+ streamingPathFilter = StreamingUtils.getStreamingPathFilter(xQueryString, namespaceMap);
+ } catch (IllegalArgumentException e) {
+ if (record.recordDebug()) {
+ record.println("Document streaming will not be used: " + e.getMessage()); //$NON-NLS-1$
+ }
+ }
this.contextRoot = null;
PathMap map = this.xQuery.getPathMap();
PathMapRoot parentRoot;
@@ -246,8 +294,8 @@
return;
}
} else {
- for (Iterator iter = finalNodes.iterator(); iter.hasNext(); ) {
- PathMapNode subNode = (PathMapNode)iter.next();
+ for (Iterator<PathMapNode> iter = finalNodes.iterator(); iter.hasNext(); ) {
+ PathMapNode subNode = iter.next();
subNode.createArc(new AxisExpression(Axis.DESCENDANT_OR_SELF, AnyNodeTest.getInstance()));
}
}
@@ -265,6 +313,24 @@
}
this.contextRoot = parentRoot;
}
+
+ public static final boolean[] isValidAncestorAxis =
+ {
+ false, // ANCESTOR
+ false, // ANCESTOR_OR_SELF;
+ true, // ATTRIBUTE;
+ false, // CHILD;
+ false, // DESCENDANT;
+ false, // DESCENDANT_OR_SELF;
+ false, // FOLLOWING;
+ false, // FOLLOWING_SIBLING;
+ true, // NAMESPACE;
+ true, // PARENT;
+ false, // PRECEDING;
+ false, // PRECEDING_SIBLING;
+ true, // SELF;
+ false, // PRECEDING_OR_ANCESTOR;
+ };
private PathMapRoot projectColumns(PathMapRoot parentRoot, List<XMLTable.XMLColumn> columns, PathMapNode finalNode, AnalysisRecord record) {
for (XMLColumn xmlColumn : columns) {
@@ -293,6 +359,9 @@
continue;
}
for (PathMapArc arc : subContextRoot.getArcs()) {
+ if (streamingPathFilter != null && !validateColumnForStreaming(record, xmlColumn, arc)) {
+ streamingPathFilter = null;
+ }
finalNode.createArc(arc.getStep(), arc.getTarget());
}
HashSet<PathMapNode> subFinalNodes = new HashSet<PathMapNode>();
@@ -319,6 +388,54 @@
return newMap.reduceToDownwardsAxes(newRoot);
}
+ private boolean validateColumnForStreaming(AnalysisRecord record,
+ XMLColumn xmlColumn, PathMapArc arc) {
+ boolean ancestor = false;
+ LinkedList<PathMapArc> arcStack = new LinkedList<PathMapArc>();
+ arcStack.add(arc);
+ while (!arcStack.isEmpty()) {
+ PathMapArc current = arcStack.removeFirst();
+ byte axis = current.getStep().getAxis();
+ if (ancestor) {
+ if (current.getTarget().isReturnable()) {
+ if (axis != Axis.NAMESPACE && axis != Axis.ATTRIBUTE) {
+ if (record.recordDebug()) {
+ record.println("Document streaming will not be used, since the column path contains an invalid reverse axis " + xmlColumn.getPath()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ }
+ if (!isValidAncestorAxis[axis]) {
+ if (record.recordDebug()) {
+ record.println("Document streaming will not be used, since the column path contains an invalid reverse axis " + xmlColumn.getPath()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ } else if (!Axis.isSubtreeAxis[axis]) {
+ if (axis == Axis.PARENT
+ || axis == Axis.ANCESTOR
+ || axis == Axis.ANCESTOR_OR_SELF) {
+ if (current.getTarget().isReturnable()) {
+ if (record.recordDebug()) {
+ record.println("Document streaming will not be used, since the column path contains an invalid reverse axis " + xmlColumn.getPath()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ ancestor = true;
+ } else {
+ if (record.recordDebug()) {
+ record.println("Document streaming will not be used, since the column path may not reference an ancestor or subtree " + xmlColumn.getPath()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ }
+ for (PathMapArc pathMapArc : current.getTarget().getArcs()) {
+ arcStack.add(pathMapArc);
+ }
+ }
+ return true;
+ }
+
private void addReturnedArcs(XMLColumn xmlColumn, PathMapNode subNode) {
if (xmlColumn.getSymbol().getType() == DataTypeManager.DefaultDataClasses.XML) {
subNode.createArc(new AxisExpression(Axis.DESCENDANT_OR_SELF, AnyNodeTest.getInstance()));
@@ -371,7 +488,7 @@
}
}
- public Result evaluateXQuery(Object context, Map<String, Object> parameterValues) throws TeiidProcessingException {
+ public Result evaluateXQuery(Object context, Map<String, Object> parameterValues, final RowProcessor processor, CommandContext commandContext) throws TeiidProcessingException {
DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
Result result = new Result();
@@ -399,6 +516,39 @@
AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
sourceInput.addFilter(filter);
source = sourceInput;
+
+ //use streamable processing instead
+ if (streamingPathFilter != null && processor != null) {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Using stream processing for evaluation of", this.xQueryString); //$NON-NLS-1$
+ }
+ //set to non-blocking in case default expression evaluation blocks
+ boolean isNonBlocking = commandContext.isNonBlocking();
+ commandContext.setNonBlocking(true);
+
+ final StreamingTransform myTransform = new StreamingTransform() {
+ public Nodes transform(Element elem) {
+ processor.processRow(StreamingUtils.wrap(elem, config));
+ return NONE;
+ }
+ };
+
+ Builder builder = new Builder(new SaxonReader(config, sourceInput), false,
+ streamingPathFilter.createNodeFactory(null, myTransform));
+ try {
+ //the builder is hard wired to parse the source, but the api will throw an exception if the stream is null
+ builder.build(FAKE_IS);
+ return result;
+ } catch (ParsingException e) {
+ throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
+ } catch (IOException e) {
+ throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
+ } finally {
+ if (!isNonBlocking) {
+ commandContext.setNonBlocking(false);
+ }
+ }
+ }
}
DocumentInfo doc;
try {
@@ -429,17 +579,7 @@
XMLType.Type type = Type.CONTENT;
if (item instanceof NodeInfo) {
NodeInfo info = (NodeInfo)item;
- switch (info.getNodeKind()) {
- case net.sf.saxon.type.Type.DOCUMENT:
- type = Type.DOCUMENT;
- break;
- case net.sf.saxon.type.Type.ELEMENT:
- type = Type.ELEMENT;
- break;
- case net.sf.saxon.type.Type.TEXT:
- type = Type.TEXT;
- break;
- }
+ type = getType(info);
}
Item next = iter.next();
if (next != null) {
@@ -450,17 +590,29 @@
@Override
public void translate(Writer writer) throws TransformerException,
IOException {
- Properties props = new Properties();
- props.setProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- //props.setProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
- QueryResult.serializeSequence(iter.getAnother(), config, writer, props);
+ QueryResult.serializeSequence(iter.getAnother(), config, writer, DEFAULT_OUTPUT_PROPERTIES);
}
});
XMLType value = new XMLType(xml);
value.setType(type);
return value;
}
+
+ public static XMLType.Type getType(NodeInfo info) {
+ switch (info.getNodeKind()) {
+ case net.sf.saxon.type.Type.DOCUMENT:
+ return Type.DOCUMENT;
+ case net.sf.saxon.type.Type.ELEMENT:
+ return Type.ELEMENT;
+ case net.sf.saxon.type.Type.TEXT:
+ return Type.TEXT;
+ case net.sf.saxon.type.Type.COMMENT:
+ return Type.COMMENT;
+ case net.sf.saxon.type.Type.PROCESSING_INSTRUCTION:
+ return Type.PI;
+ }
+ return Type.CONTENT;
+ }
public Configuration getConfig() {
return config;
@@ -477,5 +629,9 @@
showArcs(sb, node, level + 1);
}
}
+
+ public boolean isStreaming() {
+ return streamingPathFilter != null;
+ }
}
Copied: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java (from rev 3275, branches/7.4.x/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/StreamingUtils.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,322 @@
+/*
+ * 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.xquery.saxon;
+
+import java.io.IOException;
+import java.util.Map;
+
+import net.sf.saxon.AugmentedSource;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.event.ContentHandlerProxy;
+import net.sf.saxon.event.PipelineConfiguration;
+import net.sf.saxon.event.ProxyReceiver;
+import net.sf.saxon.event.Receiver;
+import net.sf.saxon.om.Name11Checker;
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.trans.XPathException;
+import nu.xom.DocType;
+import nu.xom.Node;
+import nux.xom.xquery.StreamingPathFilter;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
+
+final class StreamingUtils {
+ /**
+ * Converts a xom node into something readable by Saxon
+ * @param node
+ * @param config
+ * @return
+ */
+ static NodeInfo wrap(Node node, Configuration config) {
+ if (node == null)
+ throw new IllegalArgumentException("node must not be null"); //$NON-NLS-1$
+ if (node instanceof DocType)
+ throw new IllegalArgumentException("DocType can't be queried by XQuery/XPath"); //$NON-NLS-1$
+
+ Node root = node;
+ while (root.getParent() != null) {
+ root = root.getParent();
+ }
+
+ DocumentWrapper docWrapper = new DocumentWrapper(root, root.getBaseURI(), config);
+
+ return docWrapper.wrap(node);
+ }
+
+ /**
+ * Pre-parser that adds validation and handles a default name space
+ *
+ * TODO: add support for more general paths including node tests
+ * this could be done as a secondary expression applied to the
+ * context item
+ *
+ * @param locationPath
+ * @param prefixMap
+ * @return
+ */
+ public static StreamingPathFilter getStreamingPathFilter(String locationPath, Map<String, String> prefixMap) {
+ if (locationPath.indexOf("//") >= 0) //$NON-NLS-1$
+ throw new IllegalArgumentException("DESCENDANT axis is not supported"); //$NON-NLS-1$
+
+ String path = locationPath.trim();
+ if (path.startsWith("/")) path = path.substring(1); //$NON-NLS-1$
+ if (path.endsWith("/")) path = path.substring(0, path.length() - 1); //$NON-NLS-1$
+ path = path.trim();
+ String[] localNames = path.split("/"); //$NON-NLS-1$
+
+ if (localNames.length == 1) {
+ throw new IllegalArgumentException(locationPath + " refers to only the root element"); //$NON-NLS-1$
+ }
+
+ String fixedPath = ""; //$NON-NLS-1$
+
+ // parse prefix:localName pairs and resolve prefixes to namespaceURIs
+ for (int i = 0; i < localNames.length; i++) {
+ fixedPath += "/"; //$NON-NLS-1$
+ int k = localNames[i].indexOf(':');
+ if (k >= 0 && localNames[i].indexOf(':', k+1) >= 0)
+ throw new IllegalArgumentException(
+ "QName must not contain more than one colon: " //$NON-NLS-1$
+ + "qname='" + localNames[i] + "', path='" + path + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (k <= 0) {
+ fixedPath += " :"; //$NON-NLS-1$
+ } else {
+ String prefix = localNames[i].substring(0, k).trim();
+ if (k >= localNames[i].length() - 1)
+ throw new IllegalArgumentException(
+ "Missing localName for prefix: " + "prefix='" //$NON-NLS-1$ //$NON-NLS-2$
+ + prefix + "', path='" + path + "', prefixes=" + prefixMap); //$NON-NLS-1$ //$NON-NLS-2$
+ fixedPath += prefix + ":"; //$NON-NLS-1$
+ } // end if
+
+ localNames[i] = localNames[i].substring(k + 1).trim();
+ if (!localNames[i].equals("*") && !Name11Checker.getInstance().isValidNCName(localNames[i])) { //$NON-NLS-1$
+ throw new IllegalArgumentException(localNames[i] + " is not a valid local name."); //$NON-NLS-1$
+ }
+ fixedPath += localNames[i];
+ }
+ return new StreamingPathFilter(fixedPath, prefixMap);
+ }
+
+}
+
+/**
+ * An {@link XMLReader} designed to bridge between the Saxon document projection logic and the XOM/NUX streaming logic.
+ */
+final class SaxonReader implements XMLReader {
+
+ private ContentHandler handler;
+ private LexicalHandler lexicalHandler;
+
+ private Configuration config;
+ private AugmentedSource source;
+
+ public SaxonReader(Configuration config, AugmentedSource source) {
+ this.config = config;
+ this.source = source;
+ }
+
+ @Override
+ public void setProperty(String name, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException {
+ if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { //$NON-NLS-1$
+ this.lexicalHandler = (LexicalHandler) value;
+ }
+ }
+
+ @Override
+ public void setFeature(String name, boolean value)
+ throws SAXNotRecognizedException, SAXNotSupportedException {
+ }
+
+ @Override
+ public void setErrorHandler(ErrorHandler handler) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
+ public void setEntityResolver(EntityResolver resolver) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
+ public void setDTDHandler(DTDHandler handler) {
+
+ }
+
+ @Override
+ public void setContentHandler(ContentHandler handler) {
+ this.handler = handler;
+ }
+
+ @Override
+ public void parse(String systemId) throws IOException, SAXException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void parse(InputSource input) throws IOException, SAXException {
+ ContentHandlerProxy chp = new ContentHandlerProxy();
+ chp.setLexicalHandler(lexicalHandler);
+ chp.setUnderlyingContentHandler(handler);
+ this.source.addFilter(new ContentHandlerProxyReceiver(chp));
+ try {
+ config.buildDocument(source);
+ } catch (XPathException e) {
+ throw new SAXException(e);
+ }
+ }
+
+ @Override
+ public Object getProperty(String name) throws SAXNotRecognizedException,
+ SAXNotSupportedException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean getFeature(String name) throws SAXNotRecognizedException,
+ SAXNotSupportedException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ErrorHandler getErrorHandler() {
+ return null;
+ }
+
+ @Override
+ public EntityResolver getEntityResolver() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public DTDHandler getDTDHandler() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ContentHandler getContentHandler() {
+ return this.handler;
+ }
+
+}
+
+/**
+ * Adapts the {@link ContentHandlerProxy} to be a {@link ProxyReceiver}
+ */
+final class ContentHandlerProxyReceiver extends ProxyReceiver {
+
+ private Receiver reciever;
+
+ public ContentHandlerProxyReceiver(Receiver reciever) {
+ this.reciever = reciever;
+ }
+
+ public void attribute(int nameCode, int typeCode, CharSequence value,
+ int locationId, int properties) throws XPathException {
+ reciever.attribute(nameCode, typeCode, value, locationId,
+ properties);
+ }
+
+ public void characters(CharSequence chars, int locationId,
+ int properties) throws XPathException {
+ reciever.characters(chars, locationId, properties);
+ }
+
+ public void close() throws XPathException {
+ reciever.close();
+ }
+
+ public void comment(CharSequence content, int locationId, int properties)
+ throws XPathException {
+ reciever.comment(content, locationId, properties);
+ }
+
+ public void endDocument() throws XPathException {
+ reciever.endDocument();
+ }
+
+ public void endElement() throws XPathException {
+ reciever.endElement();
+ }
+
+ public PipelineConfiguration getPipelineConfiguration() {
+ return reciever.getPipelineConfiguration();
+ }
+
+ public String getSystemId() {
+ return reciever.getSystemId();
+ }
+
+ public void namespace(int namespaceCode, int properties)
+ throws XPathException {
+ reciever.namespace(namespaceCode, properties);
+ }
+
+ public void open() throws XPathException {
+ reciever.open();
+ }
+
+ public void processingInstruction(String name, CharSequence data,
+ int locationId, int properties) throws XPathException {
+ reciever.processingInstruction(name, data, locationId, properties);
+ }
+
+ public void setPipelineConfiguration(PipelineConfiguration config) {
+ reciever.setPipelineConfiguration(config);
+ }
+
+ public void setSystemId(String systemId) {
+ reciever.setSystemId(systemId);
+ }
+
+ public void setUnparsedEntity(String name, String systemID,
+ String publicID) throws XPathException {
+ reciever.setUnparsedEntity(name, systemID, publicID);
+ }
+
+ public void startContent() throws XPathException {
+ reciever.startContent();
+ }
+
+ public void startDocument(int properties) throws XPathException {
+ reciever.startDocument(properties);
+ }
+
+ public void startElement(int nameCode, int typeCode, int locationId,
+ int properties) throws XPathException {
+ reciever.startElement(nameCode, typeCode, locationId, properties);
+ }
+
+}
\ No newline at end of file
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-28 03:47:29 UTC (rev 3280)
@@ -901,7 +901,8 @@
datasource_not_found=Data Source {0} not accessible.
RequestWorkItem.cache_nondeterministic=Caching command "{0}" at a session level, but less deterministic functions were evaluated.
-not_found_cache=Failed to restore results
+not_found_cache=Failed to restore results, since batch entries were missing. The entry will be re-populated.
+unexpected_exception_restoring_results=Failed to restore results. The entry will be re-populated.
failed_to_cache=Failed to store the result set contents to disk.
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.
@@ -913,6 +914,7 @@
MultiSource.out_procedure=The multisource plan must execute a procedure returning parameter values exactly 1: {0}
FunctionMethods.not_array_value=Expected a java.sql.Array, or java array type, but got: {0}
+FunctionMethods.unknown_level=Unknown log level: {0}, expected one of {1}
FunctionMethods.array_index=Array index out of range: {0}
ArrayTableNode.conversion_error=Could not convert value for column: {0}
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -58,16 +58,35 @@
}
public static BufferManagerImpl createBufferManager() {
- BufferManagerImpl bufferMgr = new BufferManagerImpl();
- try {
- bufferMgr.initialize();
+ return initBufferManager(new BufferManagerImpl());
+ }
+
+ public static BufferManagerImpl getTestBufferManager(long bytesAvailable, int procBatchSize, int connectorBatchSize) {
+ BufferManagerImpl bufferManager = new BufferManagerImpl();
+ bufferManager.setProcessorBatchSize(procBatchSize);
+ bufferManager.setConnectorBatchSize(connectorBatchSize);
+ bufferManager.setMaxProcessingKB((int) (bytesAvailable/1024));
+ bufferManager.setMaxReserveKB((int) (bytesAvailable/1024));
+ return initBufferManager(bufferManager);
+ }
+
+ public static BufferManagerImpl getTestBufferManager(long bytesAvailable, int procBatchSize) {
+ BufferManagerImpl bufferManager = new BufferManagerImpl();
+ bufferManager.setProcessorBatchSize(procBatchSize);
+ bufferManager.setMaxProcessingKB((int) (bytesAvailable/1024));
+ bufferManager.setMaxReserveKB((int) (bytesAvailable/1024));
+ return initBufferManager(bufferManager);
+ }
+
+ public static BufferManagerImpl initBufferManager(BufferManagerImpl bufferManager) {
+ try {
+ bufferManager.initialize();
} catch (TeiidComponentException e) {
throw new RuntimeException(e);
}
-
- // Add unmanaged memory storage manager
- bufferMgr.setStorageManager(new MemoryStorageManager());
- return bufferMgr;
+
+ bufferManager.setStorageManager(new MemoryStorageManager());
+ return bufferManager;
}
}
Copied: trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSizeUtility.java (from rev 3275, branches/7.4.x/engine/src/test/java/org/teiid/common/buffer/impl/TestSizeUtility.java)
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSizeUtility.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/impl/TestSizeUtility.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -0,0 +1,185 @@
+/*
+ * 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.common.buffer.impl;
+
+import static org.junit.Assert.*;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.teiid.common.buffer.TupleBatch;
+
+public class TestSizeUtility {
+
+ public void helpTestGetStaticSize(Object obj, long expectedSize) {
+ helpTestGetSize(obj, expectedSize);
+ }
+
+ public void helpTestGetSize(Object obj, long expectedSize) {
+ long actualSize = new SizeUtility().getSize(obj, true, false);
+ assertEquals("Got unexpected size: ", expectedSize, actualSize); //$NON-NLS-1$
+ }
+
+ @Test public void testGetSizeChar() {
+ helpTestGetStaticSize(new Character('a'), 10);
+ }
+
+ @Test public void testGetSizeBoolean() {
+ helpTestGetStaticSize(Boolean.TRUE, 1);
+ }
+
+ @Test public void testGetSizeByte() {
+ helpTestGetStaticSize(new Byte((byte)0), 1);
+ }
+
+ @Test public void testGetSizeShort() {
+ helpTestGetStaticSize(new Short((short)0), 10);
+ }
+
+ @Test public void testGetSizeInteger() {
+ helpTestGetStaticSize(new Integer(0), 12);
+ }
+
+ @Test public void testGetSizeLong() {
+ helpTestGetStaticSize(new Long(0l), 16);
+ }
+
+ @Test public void testGetSizeFloat() {
+ helpTestGetStaticSize(new Float(0), 12);
+ }
+
+ @Test public void testGetSizeDouble() {
+ helpTestGetStaticSize(new Double(0), 16);
+ }
+
+ @Test public void testGetSizeTimestamp() {
+ helpTestGetStaticSize(new Timestamp(12301803), 28);
+ }
+
+ @Test public void testGetSizeDate() {
+ helpTestGetStaticSize(new Date(12301803), 28);
+ }
+
+ @Test public void testGetSizeTime() {
+ helpTestGetStaticSize(new Time(12301803), 28);
+ }
+
+ @Test public void testGetSizeEmptyString() {
+ helpTestGetSize("", 40); //$NON-NLS-1$
+ }
+
+ @Test public void testGetSizeShortString() {
+ helpTestGetSize("abcdefghij", 64); //$NON-NLS-1$
+ }
+
+ public void XtestGetSizeLongString() {
+ // There is no clear way of figuring out the actual size of a string that is created
+ // from a StringBuffer because the buffer can sometimes be twice as big as the actual length of the string
+ // Since the data comin from the connector is not created this way, this test is an inaccurate setup
+ int size = 10000;
+ StringBuffer str = new StringBuffer();
+ for(int i=0; i<size; i++) {
+ str.append("a"); //$NON-NLS-1$
+ }
+ helpTestGetSize(str.toString(), size+3);
+ }
+
+ @Test public void testGetSizeRow1() {
+ List<Object> row = new ArrayList<Object>(1);
+ row.add(new Integer(0));
+ helpTestGetStaticSize(row, 36);
+ }
+
+ @Test public void testGetSizeRow2() {
+ List<Object> row = new ArrayList<Object>(4);
+ row.add(new Integer(0));
+ row.add(new Integer(101));
+ row.add(Boolean.TRUE);
+ row.add(new Double(1091203.00));
+ helpTestGetStaticSize(row, 89);
+ }
+
+ @Test public void testGetSizeRows1() {
+ helpTestGetStaticSize(new List[] { }, 16);
+ }
+
+ @Test public void testGetSizeRows2() {
+ List<Object> row1 = new ArrayList<Object>(2);
+ row1.add(new Integer(0));
+ row1.add(new Integer(100));
+
+ List<Object> row2 = new ArrayList<Object>(2);
+ row2.add(new Integer(0));
+ row2.add(new Integer(100));
+
+ helpTestGetStaticSize(new List[] { row1, row2 }, 144);
+ }
+
+ @Test public void testGetSizeBigInteger() {
+ BigInteger b = BigInteger.ONE;
+
+ helpTestGetStaticSize(b, 48);
+ }
+
+ @Test public void testGetSizeBigDecimal() {
+ BigDecimal bd = new BigDecimal("1.0"); //$NON-NLS-1$
+
+ helpTestGetStaticSize(bd, 96);
+ }
+
+ @Test public void testGetSizeByteArray() {
+ byte[] bytes = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ helpTestGetSize(bytes, 32);
+ }
+
+ @Test public void testResultSet() {
+ List<?>[] expected = new List[] {
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0), "a", new Integer(0) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0), "a", new Integer(0) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0), "a", new Integer(0) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0), "a", new Integer(0) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0), "a", new Integer(3) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0), "a", new Integer(3) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(3), Boolean.TRUE, new Double(7.0), "a", new Integer(0) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(3), Boolean.TRUE, new Double(7.0), "a", new Integer(0) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "a", new Integer(3), Boolean.TRUE, new Double(7.0), "a", new Integer(3) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "b", new Integer(2), Boolean.FALSE, new Double(0.0), "b", new Integer(2) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { "c", new Integer(1), Boolean.FALSE, new Double(0.0), "c", new Integer(1) }) //$NON-NLS-1$ //$NON-NLS-2$
+ };
+
+ String[] types = {"string", "integer", "boolean", "double", "string", "integer"}; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ //$NON-NLS-5$//$NON-NLS-6$
+
+ TupleBatch tb = new TupleBatch(1, expected);
+ tb.setDataTypes(types);
+ long actualSize = new SizeUtility().getBatchSize(tb);
+ assertEquals("Got unexpected size: ", 2667, actualSize); //$NON-NLS-1$
+ }
+
+}
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -29,8 +29,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
+import org.junit.Before;
import org.junit.Test;
import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.DataPolicy.PermissionType;
@@ -40,7 +39,6 @@
import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
-import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.parser.QueryParser;
@@ -58,10 +56,12 @@
public class TestAuthorizationValidationVisitor {
public static final String CONN_ID = "connID"; //$NON-NLS-1$
- private static CommandContext context = new CommandContext();
+ private CommandContext context;
- @BeforeClass public static void oneTimeSetup() {
+ @Before public void setup() {
+ context = new CommandContext();
context.setSession(new SessionMetadata());
+ context.setDQPWorkContext(new DQPWorkContext());
}
PermissionMetaData addResource(PermissionType type, boolean flag, String resource) {
@@ -179,9 +179,10 @@
HashMap<String, DataPolicy> policies = new HashMap<String, DataPolicy>();
policies.put(policy.getName(), policy);
-
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(policies, context); //$NON-NLS-1$
- visitor.setAllowFunctionCallsByDefault(false);
+ this.context.getDQPWorkContext().setPolicies(policies);
+ DataRolePolicyDecider dataRolePolicyDecider = new DataRolePolicyDecider();
+ dataRolePolicyDecider.setAllowFunctionCallsByDefault(false);
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(dataRolePolicyDecider, context); //$NON-NLS-1$
ValidatorReport report = Validator.validate(command, metadata, visitor);
if(report.hasItems()) {
ValidatorFailure firstFailure = report.getItems().iterator().next();
@@ -289,11 +290,11 @@
}
@Test public void testSelectIntoTarget_e1_NotAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm2.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {"pm2.g2.e2","pm2.g2.e4","pm2.g2.e3"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm2.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {"pm2.g2", "pm2.g2.e2","pm2.g2.e4","pm2.g2.e3"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
@Test public void testSelectIntoTarget_e1e2_NotAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {"pm3.g2.e4", "pm3.g2.e3"},RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {"pm3.g2", "pm3.g2.e4", "pm3.g2.e3"},RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@Test public void testTempTableSelectInto() throws Exception {
@@ -326,28 +327,4 @@
helpTest(examplePolicyBQT(), "alter trigger on SmallA_2589 INSTEAD OF UPDATE enabled", RealMetadataFactory.exampleBQTCached(), new String[] {}, RealMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
- private void helpTestLookupVisibility(boolean visible) throws QueryParserException, QueryValidatorException, TeiidComponentException {
- VDBMetaData vdb = RealMetadataFactory.example1VDB();
- vdb.getModel("pm1").setVisible(visible); //$NON-NLS-1$
- AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(new HashMap<String, DataPolicy>(), context); //$NON-NLS-1$
- String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
- Command command = QueryParser.getQueryParser().parseCommand(sql);
- Request.validateWithVisitor(mvvv, RealMetadataFactory.example1Cached(), command);
- }
-
- @Ignore("visibility no longer ristricts access")
- @Test public void testLookupVisibility() throws Exception {
- helpTestLookupVisibility(true);
- }
-
- @Ignore("visibility no longer ristricts access")
- @Test public void testLookupVisibilityFails() throws Exception {
- try {
- helpTestLookupVisibility(false);
- fail("expected exception"); //$NON-NLS-1$
- } catch (QueryValidatorException e) {
- assertEquals("Group does not exist: pm1.g1", e.getMessage()); //$NON-NLS-1$
- }
- }
-
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -92,7 +92,7 @@
RealMetadataFactory.buildWorkContext(RealMetadataFactory.exampleBQT());
- cachedResults.restore(cache, bm);
+ assertTrue(cachedResults.restore(cache, bm));
// since restored, simulate a async cache flush
cache.clear();
@@ -106,5 +106,10 @@
assertArrayEquals(tb.getBatch(1).getAllTuples(), cachedTb.getBatch(1).getAllTuples());
assertArrayEquals(tb.getBatch(9).getAllTuples(), cachedTb.getBatch(9).getAllTuples());
assertTrue(ts - cachedResults.getAccessInfo().getCreationTime() <= 5000);
+
+ //ensure that an incomplete load fails
+ cache.remove(results.getId()+","+1); //$NON-NLS-1$
+ cachedResults = UnitTestUtil.helpSerialize(results);
+ assertFalse(cachedResults.restore(cache, bm));
}
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -41,9 +41,13 @@
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
import org.teiid.client.RequestMessage.StatementType;
+import org.teiid.client.lob.LobChunk;
+import org.teiid.client.util.ResultsFuture;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.impl.BufferManagerImpl;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.BlobType;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.FakeTransactionService;
import org.teiid.dqp.internal.process.AbstractWorkItem.ThreadState;
@@ -57,7 +61,41 @@
@SuppressWarnings("nls")
public class TestDQPCore {
- private DQPCore core;
+ private final class LobThread extends Thread {
+ BlobType bt;
+ private final RequestMessage reqMsg;
+ volatile ResultsFuture<LobChunk> chunkFuture;
+ protected DQPWorkContext workContext;
+
+ private LobThread(RequestMessage reqMsg) {
+ this.reqMsg = reqMsg;
+ }
+
+ @Override
+ public void run() {
+ synchronized (this) {
+ while (workContext == null) {
+ try {
+ this.wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ workContext.runInContext(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ chunkFuture = core.requestNextLobChunk(1, reqMsg.getExecutionId(), bt.getReferenceStreamId());
+ } catch (TeiidProcessingException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+ }
+
+ private DQPCore core;
private DQPConfiguration config;
private AutoGenDataService agds;
@@ -411,6 +449,34 @@
assertEquals(1, this.core.getRsCache().getCacheHitCount());
}
+ @Test public void testLobConcurrency() throws Exception {
+ RequestMessage reqMsg = exampleRequestMessage("select to_bytes(stringkey, 'utf-8') FROM BQT1.SmallA");
+ reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
+ agds.setSleep(100);
+ ResultsFuture<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
+ final LobThread t = new LobThread(reqMsg);
+ t.start();
+ message.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
+ @Override
+ public void onCompletion(ResultsFuture<ResultsMessage> future) {
+ try {
+ final BlobType bt = (BlobType)future.get().getResults()[0].get(0);
+ t.bt = bt;
+ t.workContext = DQPWorkContext.getWorkContext();
+ synchronized (t) {
+ t.notify();
+ }
+ Thread.sleep(100); //give the Thread a chance to run
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ message.get();
+ t.join();
+ assertNotNull(t.chunkFuture.get().getBytes());
+ }
+
public void helpTestVisibilityFails(String sql) throws Exception {
RequestMessage reqMsg = exampleRequestMessage(sql);
reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
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 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -242,7 +242,9 @@
serverRequest.initialize(request, BufferManagerFactory.getStandaloneBufferManager(), null, new FakeTransactionService(), null, workContext, prepPlanCache);
serverRequest.setMetadata(capFinder, metadata, null);
- serverRequest.setAuthorizationValidator(new DataRoleAuthorizationValidator(false, true, true));
+ DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator();
+ drav.setEnabled(false);
+ serverRequest.setAuthorizationValidator(drav);
serverRequest.processRequest();
assertNotNull(serverRequest.processPlan);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -82,7 +82,12 @@
request.initialize(message, BufferManagerFactory.getStandaloneBufferManager(), null,new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null);
request.initMetadata();
- request.setAuthorizationValidator(new DataRoleAuthorizationValidator(true, true, true));
+ DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator();
+ DataRolePolicyDecider drpd = new DataRolePolicyDecider();
+ drpd.setAllowCreateTemporaryTablesByDefault(true);
+ drpd.setAllowFunctionCallsByDefault(true);
+ drav.setPolicyDecider(drpd);
+ request.setAuthorizationValidator(drav);
request.validateAccess(command);
}
@@ -136,7 +141,9 @@
request.initialize(message, Mockito.mock(BufferManager.class),
new FakeDataManager(), new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null);
- request.setAuthorizationValidator(new DataRoleAuthorizationValidator(false, true, true));
+ DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator();
+ drav.setEnabled(false);
+ request.setAuthorizationValidator(drav);
request.processRequest();
return request;
}
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -898,6 +898,64 @@
}
/**
+ * pushdown won't happen since searched case is not supported
+ */
+ @Test public void testPushDownOverUnionGroupingExpression() throws Exception {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = getAggregateCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", getAggregateCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z group by case when e1 is null then 0 else 1 end", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ new String[]{"SELECT v_1.c_0, MAX(v_1.c_1) FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1 FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0", //$NON-NLS-1$
+ "SELECT g_0.e1, g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 3, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
+ @Test public void testPushDownOverUnionGroupingExpressionPartitioned() throws Exception {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = getAggregateCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2, 1 as part from pm1.g1 union all select e1, e2, 2 as part from pm1.g2) z group by case when e1 is null then 0 else 1 end, part", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ new String[]{"SELECT MAX(v_1.c_2), v_1.c_0 FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1, v_0.c_2 FROM (SELECT g_0.e1 AS c_0, 2 AS c_1, g_0.e2 AS c_2 FROM pm1.g2 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0, v_1.c_1",
+ "SELECT MAX(v_1.c_2), v_1.c_0 FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1, v_0.c_2 FROM (SELECT g_0.e1 AS c_0, 1 AS c_1, g_0.e2 AS c_2 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0, v_1.c_1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
+ /**
* Ensures that we do not raise criteria over a group by
* TODO: check if the criteria only depends on grouping columns
*/
Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java:3149-3217,3220-3275
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -793,9 +793,9 @@
TransformationMetadata metadata = RealMetadataFactory.exampleBQT();
RealMetadataFactory.setCardinality("bqt1.smalla", 1000, metadata); //$NON-NLS-1$
RealMetadataFactory.setCardinality("bqt2.smalla", 10000, metadata); //$NON-NLS-1$
- Column fmo = (Column)metadata.getElementID("bqt1.smalla.intnum");
+ Column fmo = metadata.getElementID("bqt1.smalla.intnum");
fmo.setDistinctValues(1000);
- Column floatnum = (Column)metadata.getElementID("bqt1.smalla.floatnum");
+ Column floatnum = metadata.getElementID("bqt1.smalla.floatnum");
floatnum.setDistinctValues(800);
ProcessorPlan plan = TestOptimizer.helpPlan(
Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java:3149-3217,3220-3275
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -2122,7 +2122,7 @@
"SELECT MAX(sa.datevalue) FROM bqt1.smalla AS sb " + //$NON-NLS-1$
"WHERE (sb.intkey = sa.intkey) AND (sa.stringkey = sb.stringkey) ))"; //$NON-NLS-1$
- String sqlOut = "SELECT g_0.intkey FROM bqt1.smalla AS g_0 WHERE (g_0.intkey = 46) AND (g_0.stringkey = '46') AND (g_0.datevalue = (SELECT g_0.datevalue FROM bqt1.smalla AS g_1 WHERE (g_1.intkey = g_0.intkey) AND (g_1.stringkey = g_0.stringkey)))"; //$NON-NLS-1$
+ String sqlOut = "SELECT g_0.intkey FROM bqt1.smalla AS g_0 WHERE (g_0.intkey = 46) AND (g_0.stringkey = '46') AND (g_0.datevalue = (SELECT MAX(g_0.datevalue) FROM bqt1.smalla AS g_1 WHERE (g_1.intkey = g_0.intkey) AND (g_1.stringkey = g_0.stringkey)))"; //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sqlIn,
RealMetadataFactory.exampleBQTCached(),
@@ -6587,6 +6587,26 @@
null, null, false); //$NON-NLS-1$
}
+ @Test public void testUnnamedAggInView() throws Exception {
+ MetadataStore metadataStore = new MetadataStore();
+
+ Schema bqt1 = RealMetadataFactory.createPhysicalModel("BQT1", metadataStore); //$NON-NLS-1$
+ Schema vqt = RealMetadataFactory.createVirtualModel("VQT", metadataStore); //$NON-NLS-1$
+
+ Table bqt1SmallA = RealMetadataFactory.createPhysicalGroup("SmallA", bqt1); //$NON-NLS-1$
+ RealMetadataFactory.createElement("col", bqt1SmallA, DataTypeManager.DefaultDataTypes.STRING);
+
+ Table agg3 = RealMetadataFactory.createVirtualGroup("Agg3", vqt, new QueryNode("select count(*) from smalla"));
+ RealMetadataFactory.createElement("count", agg3, DataTypeManager.DefaultDataTypes.INTEGER);
+
+ TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "x");
+ BasicSourceCapabilities bac = getTypicalCapabilities();
+ bac.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
+ bac.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
+ bac.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
+ helpPlan("select count(*) from agg3", metadata, new String[] {"SELECT COUNT(*) FROM (SELECT COUNT(*) AS c_0 FROM BQT1.SmallA AS g_0) AS v_0"}, new DefaultCapabilitiesFinder(bac), ComparisonMode.EXACT_COMMAND_STRING);
+ }
+
public static final boolean DEBUG = false;
}
Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java:3149-3217,3220-3275
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -347,7 +347,7 @@
}
/**
- * Union should prevent the removal from happening
+ * Union all should not prevent the removal from happening
*/
@Test public void testOptionalJoinWithUnion() {
ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g2.e4 from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1 union all select convert(pm1.g2.e2, double) from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
@@ -371,6 +371,31 @@
});
}
+ /**
+ * The first branch should have the join removed, but not the second branch
+ */
+ @Test public void testOptionalJoinWithUnion1() {
+ ProcessorPlan plan = TestOptimizer.helpPlan("select e4 from (select e4, e2 from (select pm1.g2.e4, pm1.g1.e2 from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1) as x union all select e4, e2 from (select convert(pm2.g1.e2, double) as e4, pm2.g2.e2 from /* optional */ pm2.g1 inner join pm2.g2 on pm2.g1.e1 = pm2.g2.e1) as x) as y", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
+ new String[] {"SELECT pm1.g2.e4 FROM pm1.g2", "SELECT g_0.e2 FROM pm2.g1 AS g_0, pm2.g2 AS g_1 WHERE g_0.e1 = g_1.e1"} ); //$NON-NLS-1$ //$NON-NLS-2$
+
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // Join
+ 0, // MergeJoin
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
@Test public void testOptionalJoinWithCompoundCriteria() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1 inner join (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x on pm1.g1.e2=x.y and concat(x.y, x.z) = '1'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT e3 FROM pm1.g1"} ); //$NON-NLS-1$
Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java:3149-3217,3220-3275
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -31,6 +31,8 @@
import java.util.List;
import org.junit.Test;
+import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestAggregatePushdown;
import org.teiid.query.optimizer.TestOptimizer;
@@ -38,6 +40,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.query.util.CommandContext;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings({"nls", "unchecked"})
@@ -372,5 +375,29 @@
// Run query
helpProcess(plan, dataManager, expected);
}
+
+ @Test public void testArrayAggOrderByPersistence() throws Exception {
+ // Create query
+ String sql = "SELECT array_agg(e2 order by e1) from pm1.g1 group by e3"; //$NON-NLS-1$
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList((Object)new Integer[] {1, 0, 0, 2}),
+ Arrays.asList((Object)new Integer[] {3, 1}),
+ };
+
+ // Construct data manager with data
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ // Plan query
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
+ CommandContext cc = TestProcessor.createCommandContext();
+ BufferManagerImpl impl = BufferManagerFactory.getTestBufferManager(0, 2);
+ impl.setUseWeakReferences(false);
+ cc.setBufferManager(impl);
+ // Run query
+ helpProcess(plan, cc, dataManager, expected);
+ }
+
}
Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java:3149-3217,3220-3275
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -320,7 +320,7 @@
List record = ts.nextTuple();
//handle xml
- if(record.size() == 1){
+ if(record.size() == 1 && expectedResults[i].size() == 1){
Object cellValue = record.get(0);
if(cellValue instanceof XMLType){
XMLType id = (XMLType)cellValue;
@@ -329,6 +329,9 @@
compareDocuments((String)expectedResults[i].get(0), actualDoc);
continue;
}
+ } else if (cellValue instanceof Object[]) {
+ assertArrayEquals((Object[])expectedResults[i].get(0), (Object[])cellValue);
+ continue;
}
}
@@ -7530,7 +7533,6 @@
helpProcess(plan, dataManager, expected);
}
-
@Test public void testDupSelect() throws Exception {
String sql = "select e1, e1 from pm1.g1";
@@ -7555,5 +7557,18 @@
helpProcess(plan, dataManager, new List[] {Arrays.asList(1, 2)});
}
+ @Test public void testDupSelectWithOrderBy() throws Exception {
+ String sql = "select e1 as a, e1 as b from pm1.g1 order by b";
+
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+
+ //note that the command is referencing c_0
+ dataManager.addData("SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0", new List[] {Arrays.asList(1)});
+
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+
+ helpProcess(plan, dataManager, new List[] {Arrays.asList(1, 1)});
+ }
+
private static final boolean DEBUG = false;
}
Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java:3149-3217,3220-3275
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -271,7 +271,27 @@
process(sql, expected);
}
+
+ @Test public void testXmlQueryEmptyNullString() throws Exception {
+ String sql = "select xmlquery('/a/b' passing xmlparse(document '<x/>') null on empty)"; //$NON-NLS-1$
+
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList((String)null)
+ };
+ process(sql, expected);
+ }
+
+ @Test public void testXmlQueryStreaming() throws Exception {
+ String sql = "select xmlquery('/a/b' passing xmlparse(document '<a><b x=''1''/><b x=''2''/></a>') null on empty)"; //$NON-NLS-1$
+
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList("<b x=\"1\"/><b x=\"2\"/>")
+ };
+
+ process(sql, expected);
+ }
+
@Test public void testXmlNameEscaping() throws Exception {
String sql = "select xmlforest(\"xml\") from (select 1 as \"xml\") x"; //$NON-NLS-1$
@@ -371,6 +391,27 @@
process(sql, expected);
}
+ @Test public void testXmlTableStreamingParentAttributes() throws Exception {
+ String sql = "select * from xmltable('/a/b' passing xmlparse(document '<a x=''1''><b>foo</b></a>') columns y string path '.', x integer path '../@x') as x"; //$NON-NLS-1$
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList("foo", 1),
+ };
+ process(sql, expected);
+ }
+
+ /**
+ * Highlights that the PathMapFilter needs to be selective in calling startContent
+ * @throws Exception
+ */
+ @Test public void testXmlStreamingError() throws Exception {
+ String sql = "select * from xmltable('/a/a' passing xmlparse(document '<a><a>2000-01-01T01:01:00.2-06:00<a></a></a></a>') columns x timestamp path 'xs:dateTime(./text())') as x"; //$NON-NLS-1$
+ Timestamp ts = TimestampUtil.createTimestamp(100, 0, 1, 1, 1, 0, 200000000);
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList(ts),
+ };
+ process(sql, expected);
+ }
+
@Test public void testXmlTableSubquery() throws Exception {
String sql = "select * from xmltable('/a/b' passing convert('<a><b>first</b><b x=\"attr\">c</b></a>', xml) columns x string path '@x', val string path '/.') as x where val = (select max(e1) from pm1.g1 as x)";
Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java:3149-3217
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java:3149-3217,3220-3275
Deleted: trunk/engine/src/test/java/org/teiid/query/processor/relational/NodeTestUtil.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/NodeTestUtil.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/NodeTestUtil.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.processor.relational;
-
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.StorageManager;
-import org.teiid.common.buffer.impl.BufferManagerImpl;
-import org.teiid.common.buffer.impl.MemoryStorageManager;
-import org.teiid.core.TeiidComponentException;
-
-/**
- * @since 4.2
- */
-public class NodeTestUtil {
-
- static BufferManager getTestBufferManager(long bytesAvailable, int procBatchSize, int connectorBatchSize) {
- BufferManagerImpl bufferManager = new BufferManagerImpl();
- bufferManager.setProcessorBatchSize(procBatchSize);
- bufferManager.setConnectorBatchSize(connectorBatchSize);
- bufferManager.setMaxProcessingBatchColumns((int)(bytesAvailable/procBatchSize/BufferManagerImpl.KB_PER_VALUE/1024));
- bufferManager.setMaxReserveBatchColumns((int)(bytesAvailable/procBatchSize/BufferManagerImpl.KB_PER_VALUE/1024));
- // Get the properties for BufferManager
- return createBufferManager(bufferManager);
- }
-
- static BufferManager getTestBufferManager(long bytesAvailable, int procBatchSize) {
- BufferManagerImpl bufferManager = new BufferManagerImpl();
- bufferManager.setProcessorBatchSize(procBatchSize);
- bufferManager.setMaxProcessingBatchColumns((int)(bytesAvailable/procBatchSize/BufferManagerImpl.KB_PER_VALUE/1024));
- bufferManager.setMaxReserveBatchColumns((int)(bytesAvailable/procBatchSize/BufferManagerImpl.KB_PER_VALUE/1024));
- // Get the properties for BufferManager
- return createBufferManager(bufferManager);
- }
-
- static BufferManager createBufferManager(BufferManagerImpl bufferManager) {
- try {
- bufferManager.initialize();
- } catch (TeiidComponentException e) {
- throw new RuntimeException(e);
- }
-
- // Add storage managers
-
- bufferManager.setStorageManager(createFakeDatabaseStorageManager());
- return bufferManager;
- }
-
-
- private static StorageManager createFakeDatabaseStorageManager() {
- return new MemoryStorageManager();
- }
-
-}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -53,7 +53,7 @@
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
-
+@SuppressWarnings("unchecked")
public class TestGroupingNode {
public static FakeTupleSource createTupleSource1() {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -34,6 +34,7 @@
import org.junit.Test;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
@@ -231,7 +232,7 @@
}
public void helpTestJoinDirect(List[] expectedResults, int batchSize, int processingBytes) throws TeiidComponentException, TeiidProcessingException {
- BufferManager mgr = NodeTestUtil.getTestBufferManager(processingBytes, batchSize);
+ BufferManager mgr = BufferManagerFactory.getTestBufferManager(processingBytes, batchSize);
CommandContext context = new CommandContext("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
join.addChild(leftNode);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -32,6 +32,7 @@
import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.TeiidComponentException;
@@ -80,7 +81,7 @@
CommandContext context = new CommandContext();
context.setProcessorID("processorID"); //$NON-NLS-1$
- BufferManager bm = NodeTestUtil.getTestBufferManager(tupleBatchSize, tupleBatchSize);
+ BufferManager bm = BufferManagerFactory.getTestBufferManager(tupleBatchSize, tupleBatchSize);
ProcessorDataManager dataManager = new FakePDM(tupleBatchSize);
child.initialize(context, bm, dataManager);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSortNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -52,7 +52,7 @@
public static final int BATCH_SIZE = 100;
private void helpTestSort(List elements, List[] data, List sortElements, List sortTypes, List[] expected, Mode mode) throws TeiidComponentException, TeiidProcessingException {
- BufferManager mgr = NodeTestUtil.getTestBufferManager(100, BATCH_SIZE, BATCH_SIZE);
+ BufferManager mgr = BufferManagerFactory.getTestBufferManager(100, BATCH_SIZE, BATCH_SIZE);
CommandContext context = new CommandContext ("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
BlockingFakeRelationalNode dataNode = new BlockingFakeRelationalNode(2, data);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestUnionAllNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestUnionAllNode.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestUnionAllNode.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -31,6 +31,7 @@
import org.junit.Test;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
@@ -45,7 +46,7 @@
public class TestUnionAllNode {
public void helpTestUnion(RelationalNode[] children, RelationalNode union, List[] expected) throws TeiidComponentException, TeiidProcessingException {
- BufferManager mgr = NodeTestUtil.getTestBufferManager(1, 2);
+ BufferManager mgr = BufferManagerFactory.getTestBufferManager(1, 2);
CommandContext context = new CommandContext("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$
FakeDataManager fdm = new FakeDataManager();
for(int i=0; i<children.length; i++) {
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -173,13 +173,13 @@
AssignmentStatement assStmt = (AssignmentStatement)block.getStatements().get(1);
assertEquals(ProcedureReservedWords.VARIABLES, assStmt.getVariable().getGroupSymbol().getCanonicalName());
- assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getValue()).getGroupSymbol().getCanonicalName());
+ assertEquals(ProcedureReservedWords.VARIABLES, ((ElementSymbol)assStmt.getExpression()).getGroupSymbol().getCanonicalName());
Block inner = ((LoopStatement)block.getStatements().get(2)).getBlock();
assStmt = (AssignmentStatement)inner.getStatements().get(0);
- ElementSymbol value = ElementCollectorVisitor.getElements(assStmt.getValue(), false).iterator().next();
+ ElementSymbol value = ElementCollectorVisitor.getElements(assStmt.getExpression(), false).iterator().next();
assertEquals("LOOPCURSOR", value.getGroupSymbol().getCanonicalName()); //$NON-NLS-1$
}
@@ -1038,6 +1038,16 @@
TestResolver.helpResolve(procedure, RealMetadataFactory.example1Cached());
}
+ // addresses Cases 5474.
+ @Test public void testProcWithReturn() throws Exception {
+ String procedure = "CREATE VIRTUAL PROCEDURE "; //$NON-NLS-1$
+ procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
+ procedure = procedure + "call sptest9(1);\n"; //$NON-NLS-1$
+ procedure = procedure + "END\n"; //$NON-NLS-1$
+
+ TestResolver.helpResolve(procedure, RealMetadataFactory.exampleBQTCached());
+ }
+
@Test public void testIssue174102() throws Exception {
String procedure = "CREATE VIRTUAL PROCEDURE \n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -2086,7 +2086,7 @@
}
@Test public void testRewiteEvaluatableAggregate() {
- helpTestRewriteCommand("select pm1.g1.e1, max(1) from pm1.g1", "SELECT pm1.g1.e1, 1 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestRewriteCommand("select max(1) from pm1.g1", "SELECT MAX(1) FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testRewriteFromUnixTime() throws Exception {
Modified: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1104,14 +1104,14 @@
sq15.setResultSet(rs18);
QueryNode sq16n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( 1, 2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
- Procedure sq16 = createVirtualProcedure("sq16", pm1, null, sq16n1); //$NON-NLS-1$
+ createVirtualProcedure("sq16", pm1, null, sq16n1); //$NON-NLS-1$
ColumnSet<Procedure> rs19 = createResultSet("pm1.rs19", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
QueryNode sq17n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END"); //$NON-NLS-1$ //$NON-NLS-2$
Procedure sq17 = createVirtualProcedure("sq17", pm1, null, sq17n1); //$NON-NLS-1$
sq17.setResultSet(rs19);
- Procedure sp3 = createStoredProcedure("sp3", pm1, null); //$NON-NLS-1$ //$NON-NLS-2$
+ createStoredProcedure("sp3", pm1, null); //$NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> rs20 = createResultSet("pm1.rs20", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
QueryNode sq18n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1130,7 +1130,7 @@
sp4.setResultSet(rs22);
// no params or result set at all
- Procedure sp5 = createStoredProcedure("sp5", pm1, new ArrayList<ProcedureParameter>()); //$NON-NLS-1$ //$NON-NLS-2$
+ createStoredProcedure("sp5", pm1, new ArrayList<ProcedureParameter>()); //$NON-NLS-1$ //$NON-NLS-2$
//virtual stored procedures
ColumnSet<Procedure> vsprs1 = vsprs1(); //$NON-NLS-1$ //$NON-NLS-2$
Copied: trunk/metadata/DATATYPES.INDEX (from rev 3275, branches/7.4.x/metadata/DATATYPES.INDEX)
===================================================================
(Binary files differ)
Modified: trunk/metadata/src/main/resources/System.vdb
===================================================================
(Binary files differ)
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -146,17 +146,19 @@
newMergedVDB.setConnectionType(this.vdb.getConnectionType());
ConnectorManagerRepository mergedRepo = new ConnectorManagerRepository();
mergedRepo.getConnectorManagers().putAll(this.cmr.getConnectorManagers());
- for (CompositeVDB child:this.children.values()) {
-
- // add models
- for (Model m:child.getVDB().getModels()) {
- newMergedVDB.addModel((ModelMetaData)m);
+ if (this.children != null) {
+ for (CompositeVDB child:this.children.values()) {
+
+ // add models
+ for (Model m:child.getVDB().getModels()) {
+ newMergedVDB.addModel((ModelMetaData)m);
+ }
+
+ for (DataPolicy p:child.getVDB().getDataPolicies()) {
+ newMergedVDB.addDataPolicy((DataPolicyMetadata)p);
+ }
+ mergedRepo.getConnectorManagers().putAll(child.cmr.getConnectorManagers());
}
-
- for (DataPolicy p:child.getVDB().getDataPolicies()) {
- newMergedVDB.addDataPolicy((DataPolicyMetadata)p);
- }
- mergedRepo.getConnectorManagers().putAll(child.cmr.getConnectorManagers());
}
newMergedVDB.addAttchment(ConnectorManagerRepository.class, mergedRepo);
return newMergedVDB;
Modified: trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -160,7 +160,8 @@
"pt.oid as atttypid," + //$NON-NLS-1$
"pt.typlen as attlen, " + //$NON-NLS-1$
"convert(t1.Position, short) as attnum, " + //$NON-NLS-1$
- "t1.Length as atttypmod, " + //$NON-NLS-1$
+ "(CASE WHEN (t1.DataType = 'bigdecimal' OR t1.DataType = 'biginteger' OR t1.DataType = 'float' OR t1.DataType='double') THEN (4+(65536*t1.Precision)+t1.Scale) " + //$NON-NLS-1$
+ "ELSE (4+t1.Length) END) as atttypmod, " + //$NON-NLS-1$
"CASE WHEN (t1.NullType = 'No Nulls') THEN true ELSE false END as attnotnull, " + //$NON-NLS-1$
"false as attisdropped, " + //$NON-NLS-1$
"false as atthasdef " + //$NON-NLS-1$
@@ -312,10 +313,10 @@
String transformation = "SELECT t1.OID as oid, t1.Name as proname, (SELECT (CASE WHEN count(pp.Type)>0 THEN true else false END) as x FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName and pp.Type='ResultSet') as proretset, " + //$NON-NLS-1$
"CASE WHEN (SELECT count(dt.oid) FROM ProcedureParams pp, matpg_datatype dt WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type IN ('ReturnValue', 'ResultSet') AND dt.Name = pp.DataType) IS NULL THEN (select oid from pg_type WHERE typname = 'void') WHEN (SELECT count(dt.oid) FROM ProcedureParams pp, matpg_datatype dt WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type = 'ResultSet' AND dt.Name = pp.DataType) IS NOT NULL THEN (select oid from pg_type WHERE typname = 'record') ELSE (SELECT dt.oid FROM ProcedureParams pp, matpg_datatype dt WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type = 'ReturnValue' AND dt.Name = pp.DataType) END as prorettype, " + //$NON-NLS-1$
"convert((SELECT count(*) FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type IN ('In', 'InOut')), short) as pronargs, " + //$NON-NLS-1$
- "(select "+textAggStmt("y.oid","y.type, y.position" )+" FROM ("+paramTable("'ResultSet','ReturnValue', 'Out'")+") as y) as proargtypes, " +//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "(select "+textAggStmt("y.name", "y.type, y.position")+" FROM (SELECT pp.Name as name, pp.position as position, pp.Type as type FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue' )) as y) as proargnames, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "(select case WHEN count(distinct(y.type)) = 1 THEN null ELSE "+textAggStmt("CASE WHEN (y.type ='In') THEN 'i' WHEN (y.type = 'Out') THEN 'o' WHEN (y.type = 'InOut') THEN 'b' WHEN (y.type = 'ResultSet') THEN 't' END", "y.type,y.position")+" END FROM (SELECT pp.Type as type, pp.Position as position FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue')) as y) as proargmodes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "(select case WHEN count(distinct(y.oid)) = 1 THEN null ELSE "+textAggStmt("y.oid", "y.type, y.position")+" END FROM ("+paramTable("'ReturnValue'")+") as y) as proallargtypes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "(select "+arrayAgg("y.oid","y.type, y.position" )+" FROM ("+paramTable("'ResultSet','ReturnValue', 'Out'")+") as y) as proargtypes, " +//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "(select "+arrayAgg("y.name", "y.type, y.position")+" FROM (SELECT pp.Name as name, pp.position as position, pp.Type as type FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue' )) as y) as proargnames, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "(select case WHEN count(distinct(y.type)) = 1 THEN null ELSE "+arrayAgg("CASE WHEN (y.type ='In') THEN 'i' WHEN (y.type = 'Out') THEN 'o' WHEN (y.type = 'InOut') THEN 'b' WHEN (y.type = 'ResultSet') THEN 't' END", "y.type,y.position")+" END FROM (SELECT pp.Type as type, pp.Position as position FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue')) as y) as proargmodes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "(select case WHEN count(distinct(y.oid)) = 1 THEN null ELSE "+arrayAgg("y.oid", "y.type, y.position")+" END FROM ("+paramTable("'ReturnValue'")+") as y) as proallargtypes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"(SELECT OID FROM SYS.Schemas WHERE Name = t1.SchemaName) as pronamespace " + //$NON-NLS-1$
"FROM SYS.Procedures as t1";//$NON-NLS-1$
@@ -330,7 +331,7 @@
}
- private String textAggStmt(String select, String orderby) {
+ private String arrayAgg(String select, String orderby) {
return "array_agg("+select+" ORDER BY "+orderby+")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -477,7 +477,12 @@
}
else {
try {
+ // The response is a ParameterDescription message describing the parameters needed by the statement,
this.client.sendParameterDescription(query.stmt.getParameterMetaData(), query.paramType);
+
+ // followed by a RowDescription message describing the rows that will be returned when the statement
+ // is eventually executed (or a NoData message if the statement will not return rows).
+ this.client.sendResultSetDescription(query.stmt.getMetaData(), query.stmt);
} catch (SQLException e) {
errorOccurred(e);
}
Modified: trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -62,8 +62,8 @@
private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
private int maxOpenFiles = FileStorageManager.DEFAULT_MAX_OPEN_FILES;
private long maxFileSize = FileStorageManager.DEFAULT_MAX_FILESIZE; // 2GB
- private int maxProcessingBatchesColumns = BufferManager.DEFAULT_MAX_PROCESSING_BATCHES;
- private int maxReserveBatchColumns = BufferManager.DEFAULT_RESERVE_BUFFERS;
+ private int maxProcessingKb = BufferManager.DEFAULT_MAX_PROCESSING_KB;
+ private int maxReserveKb = BufferManager.DEFAULT_RESERVE_BUFFER_KB;
private long maxBufferSpace = FileStorageManager.DEFAULT_MAX_BUFFERSPACE;
private FileStorageManager fsm;
@@ -86,8 +86,8 @@
this.bufferMgr = new BufferManagerImpl();
this.bufferMgr.setConnectorBatchSize(Integer.valueOf(connectorBatchSize));
this.bufferMgr.setProcessorBatchSize(Integer.valueOf(processorBatchSize));
- this.bufferMgr.setMaxReserveBatchColumns(this.maxReserveBatchColumns);
- this.bufferMgr.setMaxProcessingBatchColumns(this.maxProcessingBatchesColumns);
+ this.bufferMgr.setMaxReserveKB(this.maxReserveKb);
+ this.bufferMgr.setMaxProcessingKB(this.maxProcessingKb);
this.bufferMgr.initialize();
@@ -167,14 +167,6 @@
this.maxFileSize = maxFileSize;
}
- public void setMaxReserveBatchColumns(int value) {
- this.maxReserveBatchColumns = value;
- }
-
- public void setMaxProcessingBatchesColumns(int value) {
- this.maxProcessingBatchesColumns = value;
- }
-
@ManagementProperty(description="Max file size, in MB, for buffer files (default 2GB)")
public long getMaxFileSize() {
return maxFileSize;
@@ -185,20 +177,24 @@
this.maxOpenFiles = maxOpenFiles;
}
- @ManagementProperty(description="The number of batch columns guarenteed to a processing operation. Set this value lower if the workload typically" +
- "processes larger numbers of concurrent queries with large intermediate results from operations such as sorting, " +
- "grouping, etc. (default 128)")
- public int getMaxProcessingBatchesColumns() {
- return maxProcessingBatchesColumns;
+ @ManagementProperty(description="The approximate amount of buffer memory in kilobytes allowable for a single processing operation (sort, grouping, etc.) regardless of existing memory commitments. -1 means to automatically calculate a value (default -1).")
+ public int getMaxProcessingKb() {
+ return maxProcessingKb;
}
- @ManagementProperty(description="The number of batch columns to allow in memory (default 16384). " +
- "This value should be set lower or higher depending on the available memory to Teiid in the VM. " +
- "16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.")
- public int getMaxReserveBatchColumns() {
- return maxReserveBatchColumns;
+ @ManagementProperty(description="The approximate amount of memory in kilobytes allowed to be held by the buffer manager. -1 means to automatically calculate a value (default -1)")
+ public int getMaxReservedKb() {
+ return maxReserveKb;
}
+ public void setMaxProcessingKb(int maxProcessingKb) {
+ this.maxProcessingKb = maxProcessingKb;
+ }
+
+ public void setMaxReserveKb(int maxReserveKb) {
+ this.maxReserveKb = maxReserveKb;
+ }
+
@ManagementProperty(description="Max file storage space, in MB, to be used for buffer files (default 50G)")
public long getMaxBufferSpace() {
return maxBufferSpace;
Modified: trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -21,6 +21,8 @@
*/
package org.teiid.deployers;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.List;
@@ -40,12 +42,20 @@
import org.teiid.query.sql.lang.Command;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ExecutionFactory;
+import org.teiid.vdb.runtime.VDBKey;
@SuppressWarnings("nls")
public class TestCompositeVDB {
public static TransformationMetadata createTransformationMetadata(MetadataStore metadataStore, String vdbName) throws Exception {
- VDBMetaData vdbMetaData = new VDBMetaData();
+ CompositeVDB cvdb = createCompositeVDB(metadataStore, vdbName);
+ VDBMetaData vdb = cvdb.getVDB();
+ return vdb.getAttachment(TransformationMetadata.class);
+ }
+
+ private static CompositeVDB createCompositeVDB(MetadataStore metadataStore,
+ String vdbName) {
+ VDBMetaData vdbMetaData = new VDBMetaData();
vdbMetaData.setName(vdbName); //$NON-NLS-1$
vdbMetaData.setVersion(1);
for (Schema schema : metadataStore.getSchemas().values()) {
@@ -59,8 +69,7 @@
cmr.addConnectorManager("source2", getConnectorManager("bqt2", "FakeTranslator2", "FakeConnection2", getFuncsTwo()));
CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metaGroup, null, null, RealMetadataFactory.SFM.getSystemFunctions(),cmr);
- VDBMetaData vdb = cvdb.getVDB();
- return vdb.getAttachment(TransformationMetadata.class);
+ return cvdb;
}
private static ConnectorManager getConnectorManager(String modelName, String translatorName, String connectionName, List<FunctionMethod> funcs) {
@@ -103,7 +112,7 @@
private void helpResolve(String sql) throws Exception {
- TransformationMetadata metadata = createTransformationMetadata(RealMetadataFactory.exampleBQTStore(), "bqt");
+ TransformationMetadata metadata = createTransformationMetadata(RealMetadataFactory.exampleBQTCached().getMetadataStore(), "bqt");
Command command = QueryParser.getQueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
}
@@ -138,4 +147,10 @@
helpResolve("SELECT duplicate_func(BQT1.SmallA.INTKEY) FROM BQT1.SmallA");
}
+ @Test public void testRemoveChild() throws Exception {
+ CompositeVDB vdb = createCompositeVDB(RealMetadataFactory.exampleBQTStore(), "bqt");
+ vdb.removeChild(new VDBKey("foo", 1));
+ assertNotNull(vdb.getVDB());
+ }
+
}
Modified: trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/runtime/src/test/java/org/teiid/dqp/service/buffer/TestLocalBufferService.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -91,7 +91,7 @@
svc.start();
BufferManager mgr = svc.getBufferManager();
- assertEquals(16261, mgr.getSchemaSize(schema));
+ assertEquals(13141, mgr.getSchemaSize(schema));
}
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractMMQueryTestCase.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractMMQueryTestCase.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractMMQueryTestCase.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -80,7 +80,7 @@
}
- protected void helpTest(String query, String[] expected, String vdb, String props, String urlProperties) {
+ protected void helpTest(String query, String[] expected, String vdb, String props, String urlProperties) throws SQLException {
getConnection(vdb, props, urlProperties);
executeAndAssertResults(query, expected);
closeConnection();
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractQueryTest.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractQueryTest.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/AbstractQueryTest.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -86,11 +86,11 @@
return this.internalConnection;
}
- public boolean execute(String sql) {
+ public boolean execute(String sql) throws SQLException {
return execute(sql, new Object[] {});
}
- public boolean execute(String sql, Object[] params) {
+ public boolean execute(String sql, Object[] params) throws SQLException {
closeResultSet();
closeStatement();
this.updateCount = -1;
@@ -122,7 +122,7 @@
} catch (SQLException e) {
this.internalException = e;
if (!exceptionExpected()) {
- throw new RuntimeException(e);
+ throw e;
}
}
return false;
@@ -465,7 +465,7 @@
}
- protected void executeAndAssertResults(String query, String[] expected) {
+ protected void executeAndAssertResults(String query, String[] expected) throws SQLException {
execute(query);
if (expected != null) {
assertResults(expected);
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -22,7 +22,9 @@
package org.teiid.jdbc;
import java.io.File;
+import java.util.Collection;
import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Properties;
import org.jboss.deployers.spi.DeploymentException;
@@ -37,6 +39,7 @@
import org.teiid.client.DQP;
import org.teiid.client.security.ILogon;
import org.teiid.deployers.MetadataStoreGroup;
+import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
@@ -44,6 +47,7 @@
import org.teiid.dqp.internal.process.DQPConfiguration;
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.dqp.service.FakeBufferService;
+import org.teiid.metadata.FunctionMethod;
import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.Schema;
@@ -61,7 +65,7 @@
import org.teiid.transport.LocalServerConnection;
import org.teiid.transport.LogonImpl;
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "serial"})
public class FakeServer extends ClientServiceRegistryImpl implements ConnectionProfile {
SessionServiceImpl sessionService = new SessionServiceImpl();
@@ -97,7 +101,12 @@
});
config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
- this.dqp.setCacheFactory(new DefaultCacheFactory());
+ this.dqp.setCacheFactory(new DefaultCacheFactory() {
+ @Override
+ public boolean isReplicated() {
+ return true; //pretend to be replicated for matview tests
+ }
+ });
this.dqp.start(config);
this.sessionService.setDqp(this.dqp);
@@ -121,18 +130,25 @@
public void setUseCallingThread(boolean useCallingThread) {
this.useCallingThread = useCallingThread;
}
+
+ public void deployVDB(String vdbName, String vdbPath) throws Exception {
+ deployVDB(vdbName, vdbPath, null);
+ }
- public void deployVDB(String vdbName, String vdbPath) throws Exception {
-
+ public void deployVDB(String vdbName, String vdbPath, Map<String, Collection<FunctionMethod>> udfs) throws Exception {
IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(new File(vdbPath).toURI().toURL());
MetadataStore metadata = imf.getMetadataStore(repo.getSystemStore().getDatatypes());
LinkedHashMap<String, Resource> entries = imf.getEntriesPlusVisibilities();
-
- deployVDB(vdbName, metadata, entries);
+ deployVDB(vdbName, metadata, entries, udfs);
}
+
+ public void deployVDB(String vdbName, MetadataStore metadata,
+ LinkedHashMap<String, Resource> entries) {
+ deployVDB(vdbName, metadata, entries, null);
+ }
public void deployVDB(String vdbName, MetadataStore metadata,
- LinkedHashMap<String, Resource> entries) {
+ LinkedHashMap<String, Resource> entries, Map<String, Collection<FunctionMethod>> udfs) {
VDBMetaData vdbMetaData = new VDBMetaData();
vdbMetaData.setName(vdbName);
vdbMetaData.setStatus(VDB.Status.ACTIVE);
@@ -152,7 +168,14 @@
try {
MetadataStoreGroup stores = new MetadataStoreGroup();
stores.addStore(metadata);
- this.repo.addVDB(vdbMetaData, stores, entries, null, cmr);
+ UDFMetaData udfMetaData = null;
+ if (udfs != null) {
+ udfMetaData = new UDFMetaData();
+ for (Map.Entry<String, Collection<FunctionMethod>> entry : udfs.entrySet()) {
+ udfMetaData.addFunctions(entry.getKey(), entry.getValue());
+ }
+ }
+ this.repo.addVDB(vdbMetaData, stores, entries, udfMetaData, cmr);
this.repo.finishDeployment(vdbName, 1);
} catch (DeploymentException e) {
throw new RuntimeException(e);
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -74,7 +74,7 @@
assertEquals(1, p.getResultSet().getColumns().size());
}
- @Test public void testDuplicatException() throws Exception {
+ @Test public void testDuplicateException() throws Exception {
FakeServer server = new FakeServer();
MetadataFactory mf = createMetadataFactory("x", new Properties());
MetadataFactory mf1 = createMetadataFactory("y", new Properties());
@@ -93,8 +93,9 @@
Properties importProperties = new Properties();
- getMetadata(importProperties, conn);
- assertNotNull(mf.getMetadataStore().getSchemas().get("X").getTables().get("DUP"));
+ mf = getMetadata(importProperties, conn);
+ Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("TEST.X.DUP");
+ assertEquals("\"test\".\"x\".\"dup\"", t.getNameInSource());
importProperties.setProperty("importer.useFullSchemaName", Boolean.FALSE.toString());
try {
@@ -104,5 +105,25 @@
}
}
+
+ @Test public void testUseCatalog() throws Exception {
+ FakeServer server = new FakeServer();
+ MetadataFactory mf = createMetadataFactory("x", new Properties());
+
+ Table dup = mf.addTable("dup");
+
+ mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
+
+ MetadataStore ms = mf.getMetadataStore();
+
+ server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
+ Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
+
+ Properties importProperties = new Properties();
+ importProperties.setProperty("importer.useCatalogName", Boolean.FALSE.toString());
+ mf = getMetadata(importProperties, conn);
+ Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("X.DUP");
+ assertEquals("\"x\".\"dup\"", t.getNameInSource());
+ }
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,5 +1,7 @@
package org.teiid.jdbc;
+import java.sql.SQLException;
+
import org.junit.Test;
import org.teiid.core.util.UnitTestUtil;
@@ -66,7 +68,7 @@
executeTest("select * from tables where schemaname ='PartsSupplier'", expected); //$NON-NLS-1$
}
- private void executeTest(String sql, String[] expected){
+ private void executeTest(String sql, String[] expected) throws SQLException{
execute(sql);
if (expected != null) {
assertResults(expected);
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -28,15 +28,22 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.FakeServer;
import org.teiid.jdbc.TeiidSQLException;
-import org.teiid.metadata.Table;
-import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.FunctionParameter;
+import org.teiid.metadata.FunctionMethod.Determinism;
+import org.teiid.metadata.FunctionMethod.PushDown;
@SuppressWarnings("nls")
public class TestMatViews {
@@ -44,13 +51,33 @@
private static final String MATVIEWS = "matviews";
private Connection conn;
private FakeServer server;
+
+ private static int count = 0;
+
+ public static int pause() throws InterruptedException {
+ synchronized (TestMatViews.class) {
+ count++;
+ TestMatViews.class.notify();
+ while (count < 2) {
+ TestMatViews.class.wait();
+ }
+ }
+ return 1;
+ }
@Before public void setUp() throws Exception {
server = new FakeServer();
- server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() + "/matviews.vdb");
+ HashMap<String, Collection<FunctionMethod>> udfs = new HashMap<String, Collection<FunctionMethod>>();
+ udfs.put("funcs", Arrays.asList(new FunctionMethod("pause", null, null, PushDown.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause", null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER), false, Determinism.NONDETERMINISTIC)));
+ server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() + "/matviews.vdb", udfs);
conn = server.createConnection("jdbc:teiid:matviews");
}
+ @After public void tearDown() throws Exception {
+ server.stop();
+ conn.close();
+ }
+
@Test public void testSystemMatViewsWithImplicitLoad() throws Exception {
Statement s = conn.createStatement();
ResultSet rs = s.executeQuery("select * from MatViews order by name");
@@ -80,6 +107,34 @@
@Test public void testSystemMatViewsWithExplicitRefresh() throws Exception {
Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ rs = s.executeQuery("select * from MatViews where name = 'RandomView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
+ rs = s.executeQuery("select x from TEST.RANDOMVIEW");
+ assertTrue(rs.next());
+ double key = rs.getDouble(1);
+
+ rs = s.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ rs = s.executeQuery("select * from MatViews where name = 'RandomView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
+ rs = s.executeQuery("select x from TEST.RANDOMVIEW");
+ assertTrue(rs.next());
+ double key1 = rs.getDouble(1);
+
+ //ensure that invalidate with distributed caching works
+ assertTrue(key1 != key);
+ }
+
+ @Test public void testSystemManViewsWithExplictRefreshAndInvalidate() throws Exception {
+ Statement s = conn.createStatement();
ResultSet rs = s.executeQuery("select * from (call refreshMatView('TEST.MATVIEW', false)) p");
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
@@ -87,6 +142,42 @@
assertTrue(rs.next());
assertEquals("LOADED", rs.getString("loadstate"));
assertEquals(true, rs.getBoolean("valid"));
+
+ count = 0;
+ s.execute("alter view TEST.MATVIEW as select pause() as x");
+ Thread t = new Thread() {
+ public void run() {
+ try {
+ Statement s1 = conn.createStatement();
+ ResultSet rs = s1.executeQuery("select * from (call refreshMatView('TEST.MATVIEW', true)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ } catch (Exception e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ };
+ t.start();
+ synchronized (TestMatViews.class) {
+ while (count < 1) {
+ TestMatViews.class.wait();
+ }
+ }
+ rs = s.executeQuery("select * from MatViews where name = 'MatView'");
+ assertTrue(rs.next());
+ assertEquals("NEEDS_LOADING", rs.getString("loadstate"));
+ assertEquals(false, rs.getBoolean("valid"));
+
+ synchronized (TestMatViews.class) {
+ count++;
+ TestMatViews.class.notify();
+ }
+ t.join();
+
+ rs = s.executeQuery("select * from MatViews where name = 'MatView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
}
@Test(expected=TeiidSQLException.class) public void testSystemMatViewsInvalidView() throws Exception {
@@ -99,14 +190,27 @@
s.execute("call refreshMatView('foo', false)");
}
+ @Test(expected=TeiidSQLException.class) public void testSystemMatViewsWithRowRefreshNotAllowed() throws Exception {
+ Statement s = conn.createStatement();
+ s.execute("alter view test.randomview as select rand() as x, rand() as y");
+ ResultSet rs = s.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ rs = s.executeQuery("select * from MatViews where name = 'RandomView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
+ rs = s.executeQuery("select x from TEST.RANDOMVIEW");
+ assertTrue(rs.next());
+ double key = rs.getDouble(1);
+
+ rs = s.executeQuery("select * from (call refreshMatViewRow('TEST.RANDOMVIEW', "+key+")) p");
+ }
+
@Test public void testSystemMatViewsWithRowRefresh() throws Exception {
- //TOOD: remove this. it's a workaround for TEIIDDES-549
- VDBMetaData vdb = server.getVDB(MATVIEWS);
- TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
- Table t = tm.getGroupID("TEST.RANDOMVIEW");
- t.setSelectTransformation("/*+ cache(updatable) */ " + t.getSelectTransformation());
+ Statement s = conn.createStatement();
- Statement s = conn.createStatement();
+ s.execute("alter view test.randomview as /*+ cache(updatable) */ select rand() as x, rand() as y");
//prior to load refresh of a single row returns -1
ResultSet rs = s.executeQuery("select * from (call refreshMatViewRow('TEST.RANDOMVIEW', 0)) p");
assertTrue(rs.next());
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -67,7 +67,7 @@
public String answer(InvocationOnMock invocation) throws Throwable {
Procedure t = (Procedure)invocation.getArguments()[2];
if (t.getName().equals("proc")) {
- return "create virtual procedure begin select '2011'; end";
+ return "create virtual procedure begin select '2011'; if ((call isLoggable())) call logMsg(msg=>'hello'); end";
}
return null;
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -83,7 +83,7 @@
checkResult("testProcedures", "select* from SYS.Procedures order by Name"); //$NON-NLS-1$ //$NON-NLS-2$
}
- @Test public void testProperties() {
+ @Test public void testProperties() throws Exception {
String[] expected = { "Name[string] Value[string] UID[string] OID[integer] ClobValue[clob]",
"pg_type:oid 30 mmuid:ffa4ac73-b549-470e-931f-dc36330cb8c4 1 30",
"pg_type:oid 1009 mmuid:d9f36bdc-7b25-4af0-b9f5-a96aac6d3094 2 1009",
@@ -94,7 +94,7 @@
executeAndAssertResults("select* from SYS.Properties", expected); //$NON-NLS-1$
}
- @Test public void testVirtualDatabase() {
+ @Test public void testVirtualDatabase() throws Exception {
String[] expected = { "Name[string] Version[string] ", "PartsSupplier 1", //$NON-NLS-1$ //$NON-NLS-2$
@@ -116,7 +116,7 @@
checkResult("testColumns", "select* from SYS.Columns order by Name"); //$NON-NLS-1$ //$NON-NLS-2$
}
- @Test public void testTableType() {
+ @Test public void testTableType() throws Exception {
String[] expected = { "Type[string] ", "Table", }; //$NON-NLS-1$ //$NON-NLS-2$
executeAndAssertResults(
@@ -128,7 +128,7 @@
checkResult("testTableIsSystem", "select Name from SYS.Tables where IsSystem = 'false' order by Name"); //$NON-NLS-1$ //$NON-NLS-2$
}
- @Test public void testDefect12064() {
+ @Test public void testDefect12064() throws Exception {
String[] expected = {
"KeyName[string] RefKeyUID[string] ", //$NON-NLS-1$
"PK_PARTS null", //$NON-NLS-1$
@@ -174,4 +174,12 @@
oidCount = getRowCount();
assertEquals(uidCount, oidCount);
}
+
+ @Test public void testLogMsg() throws Exception {
+ execute("call logMsg(level=>'DEBUG', context=>'org.teiid.foo', msg=>'hello world')"); //$NON-NLS-1$
+ }
+
+ @Test(expected=SQLException.class) public void testLogMsg1() throws Exception {
+ execute("call logMsg(level=>'foo', context=>'org.teiid.foo', msg=>'hello world')"); //$NON-NLS-1$
+ }
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -55,7 +55,7 @@
closeConnection();
}
- @Test public void testDefect15241() {
+ @Test public void testDefect15241() throws Exception {
String sql = "SELECT SchemaName, Name, Description FROM SYS.Tables WHERE Name = 'yyyTestDocument'"; //$NON-NLS-1$
@@ -67,7 +67,7 @@
executeAndAssertResults(sql, expected);
}
- @Test public void testDefect15241a() {
+ @Test public void testDefect15241a() throws Exception {
String sql = "SELECT TableName, Name, Description FROM SYS.Columns WHERE Name = 'IntKey'"; //$NON-NLS-1$
String[] expected ={
"TableName[string] Name[string] Description[string]", //$NON-NLS-1$
@@ -83,7 +83,7 @@
executeAndAssertResults(sql, expected);
}
- @Test public void testDefect15241b() {
+ @Test public void testDefect15241b() throws Exception {
String sql = "SELECT p.Name, p.Value, UID FROM SYS.Properties p"; //$NON-NLS-1$
String[] expected ={
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -43,6 +43,13 @@
QT_Ora9DS SP sp_rows_between ObjectValue 3 2000 object 2147483647 2048 0 10 1 <null> <null> <null> <null> <null> 17 YES sp_rows_between
QT_Ora9DS SYS getXMLSchemas document 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 1 NO getXMLSchemas
QT_Ora9DS SYS getXMLSchemas schema 3 2009 xml 2147483647 2147483647 0 10 1 <null> <null> <null> <null> <null> 1 YES getXMLSchemas
+QT_Ora9DS SYSADMIN isLoggable level 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 2 NO isLoggable
+QT_Ora9DS SYSADMIN isLoggable context 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 3 NO isLoggable
+QT_Ora9DS SYSADMIN isLoggable loggable 5 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 1 NO isLoggable
+QT_Ora9DS SYSADMIN logMsg level 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 2 NO logMsg
+QT_Ora9DS SYSADMIN logMsg context 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 3 NO logMsg
+QT_Ora9DS SYSADMIN logMsg msg 1 2000 object 2147483647 2147483647 0 10 0 <null> <null> <null> <null> <null> 4 NO logMsg
+QT_Ora9DS SYSADMIN logMsg logged 5 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 1 NO logMsg
QT_Ora9DS SYSADMIN refreshMatView ViewName 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 1 NO refreshMatView
QT_Ora9DS SYSADMIN refreshMatView Invalidate 1 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 2 NO refreshMatView
QT_Ora9DS SYSADMIN refreshMatView RowsUpdated 5 4 integer 10 10 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatView
@@ -61,7 +68,7 @@
QT_Ora9DS SYSADMIN setProperty OldValue 5 2005 clob 2147483647 2097152 0 10 0 <null> <null> <null> <null> <null> 1 NO setProperty
QT_Ora9DS SYSADMIN setTableStats tableName 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 1 NO setTableStats
QT_Ora9DS SYSADMIN setTableStats cardinality 1 4 integer 10 10 0 10 0 <null> <null> <null> <null> <null> 2 NO setTableStats
-Row Count : 61
+Row Count : 68
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 QT_Ora9DS java.lang.String PROCEDURE_CAT string SYS ProcedureParams 255 255 0 false false false false 0 true true false false
SchemaName 12 QT_Ora9DS java.lang.String PROCEDURE_SCHEM string SYS ProcedureParams 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedures.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedures.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedures.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -5,12 +5,14 @@
QT_Ora9DS SP sp_count_rows_between <null> <null> <null> <null> 1 sp_count_rows_between
QT_Ora9DS SP sp_rows_between <null> <null> <null> <null> 2 sp_rows_between
QT_Ora9DS SYS getXMLSchemas <null> <null> <null> <null> 2 getXMLSchemas
+QT_Ora9DS SYSADMIN isLoggable <null> <null> <null> <null> 1 isLoggable
+QT_Ora9DS SYSADMIN logMsg <null> <null> <null> <null> 1 logMsg
QT_Ora9DS SYSADMIN refreshMatView <null> <null> <null> <null> 1 refreshMatView
QT_Ora9DS SYSADMIN refreshMatViewRow <null> <null> <null> <null> 1 refreshMatViewRow
QT_Ora9DS SYSADMIN setColumnStats <null> <null> <null> <null> 1 setColumnStats
QT_Ora9DS SYSADMIN setProperty <null> <null> <null> <null> 1 setProperty
QT_Ora9DS SYSADMIN setTableStats <null> <null> <null> <null> 1 setTableStats
-Row Count : 10
+Row Count : 12
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 QT_Ora9DS java.lang.String PROCEDURE_CAT string SYS Procedures 255 255 0 false false false false 0 true true false false
SchemaName 12 QT_Ora9DS java.lang.String PROCEDURE_SCHEM string SYS Procedures 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProceduresWithEscape.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProceduresWithEscape.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProceduresWithEscape.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -5,12 +5,14 @@
QT_Ora9DS SP sp_count_rows_between <null> <null> <null> <null> 1 sp_count_rows_between
QT_Ora9DS SP sp_rows_between <null> <null> <null> <null> 2 sp_rows_between
QT_Ora9DS SYS getXMLSchemas <null> <null> <null> <null> 2 getXMLSchemas
+QT_Ora9DS SYSADMIN isLoggable <null> <null> <null> <null> 1 isLoggable
+QT_Ora9DS SYSADMIN logMsg <null> <null> <null> <null> 1 logMsg
QT_Ora9DS SYSADMIN refreshMatView <null> <null> <null> <null> 1 refreshMatView
QT_Ora9DS SYSADMIN refreshMatViewRow <null> <null> <null> <null> 1 refreshMatViewRow
QT_Ora9DS SYSADMIN setColumnStats <null> <null> <null> <null> 1 setColumnStats
QT_Ora9DS SYSADMIN setProperty <null> <null> <null> <null> 1 setProperty
QT_Ora9DS SYSADMIN setTableStats <null> <null> <null> <null> 1 setTableStats
-Row Count : 10
+Row Count : 12
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 QT_Ora9DS java.lang.String PROCEDURE_CAT string SYS Procedures 255 255 0 false false false false 0 true true false false
SchemaName 12 QT_Ora9DS java.lang.String PROCEDURE_SCHEM string SYS Procedures 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,257 +1,257 @@
integer integer string integer short short integer boolean boolean boolean
oid attrelid attname atttypid attlen attnum atttypmod attnotnull attisdropped atthasdef
-1 1 PART_ID 1043 -1 1 4 true false false
-2 1 PART_NAME 1043 -1 2 255 false false false
-3 1 PART_COLOR 1043 -1 3 30 false false false
-4 1 PART_WEIGHT 1043 -1 4 255 false false false
-5 2 SHIPPER_ID 21 2 1 0 true false false
-6 2 SHIPPER_NAME 1043 -1 2 30 false false false
-7 3 STATUS_ID 21 2 1 0 true false false
-8 3 STATUS_NAME 1043 -1 2 30 false false false
-9 4 SUPPLIER_ID 1043 -1 1 10 true false false
-10 4 PART_ID 1043 -1 2 4 true false false
-11 4 QUANTITY 21 2 3 0 false false false
-12 4 SHIPPER_ID 21 2 4 0 false false false
-13 5 SUPPLIER_ID 1043 -1 1 10 true false false
-14 5 SUPPLIER_NAME 1043 -1 2 30 false false false
-15 5 SUPPLIER_STATUS 21 2 3 0 false false false
-16 5 SUPPLIER_CITY 1043 -1 4 30 false false false
-17 5 SUPPLIER_STATE 1043 -1 5 2 false false false
-18 6 VDBName 1043 -1 1 255 true false false
-19 6 SchemaName 1043 -1 2 255 true false false
-20 6 Name 1043 -1 3 255 true false false
-21 6 TargetSchemaName 1043 -1 4 255 false false false
-22 6 TargetName 1043 -1 5 4000 false false false
-23 6 Valid 16 1 6 0 false false false
-24 6 LoadState 1043 -1 7 255 false false false
-25 6 Updated 1114 8 8 0 false false false
-26 6 Cardinality 23 4 9 10 false false false
-27 7 resourcePath 1043 -1 1 255 false false false
-28 7 contents 14939 -1 2 0 false false false
-29 8 VDBName 1043 -1 1 255 true false false
-30 8 SchemaName 1043 -1 2 255 false false false
-31 8 TableName 1043 -1 3 255 true false false
-32 8 Name 1043 -1 4 255 true false false
-33 8 Position 23 4 5 10 true false false
-34 8 NameInSource 1043 -1 6 255 false false false
-35 8 DataType 1043 -1 7 100 true false false
-36 8 Scale 23 4 8 10 true false false
-37 8 Length 23 4 9 10 true false false
-38 8 IsLengthFixed 16 1 10 1 true false false
-39 8 SupportsSelect 16 1 11 1 true false false
-40 8 SupportsUpdates 16 1 12 1 true false false
-41 8 IsCaseSensitive 16 1 13 1 true false false
-42 8 IsSigned 16 1 14 1 true false false
-43 8 IsCurrency 16 1 15 1 true false false
-44 8 IsAutoIncremented 16 1 16 1 true false false
-45 8 NullType 1043 -1 17 20 true false false
-46 8 MinRange 1043 -1 18 50 false false false
-47 8 MaxRange 1043 -1 19 50 false false false
-48 8 DistinctCount 23 4 20 10 false false false
-49 8 NullCount 23 4 21 10 false false false
-50 8 SearchType 1043 -1 22 20 true false false
-51 8 Format 1043 -1 23 255 false false false
-52 8 DefaultValue 1043 -1 24 255 false false false
-53 8 JavaClass 1043 -1 25 500 true false false
-54 8 Precision 23 4 26 10 true false false
-55 8 CharOctetLength 23 4 27 10 false false false
-56 8 Radix 23 4 28 10 true false false
-57 8 UID 1043 -1 29 50 true false false
-58 8 Description 1043 -1 30 255 false false false
-59 8 OID 23 4 31 10 true false false
-60 9 Name 1043 -1 1 100 true false false
-61 9 IsStandard 16 1 2 1 false false false
-62 9 IsPhysical 16 1 3 1 false false false
-63 9 TypeName 1043 -1 4 100 true false false
-64 9 JavaClass 1043 -1 5 500 true false false
-65 9 Scale 23 4 6 10 false false false
-66 9 TypeLength 23 4 7 10 true false false
-67 9 NullType 1043 -1 8 20 true false false
-68 9 IsSigned 16 1 9 1 true false false
-69 9 IsAutoIncremented 16 1 10 1 true false false
-70 9 IsCaseSensitive 16 1 11 1 true false false
-71 9 Precision 23 4 12 10 true false false
-72 9 Radix 23 4 13 10 false false false
-73 9 SearchType 1043 -1 14 20 true false false
-74 9 UID 1043 -1 15 50 true false false
-75 9 RuntimeType 1043 -1 16 64 false false false
-76 9 BaseType 1043 -1 17 64 false false false
-77 9 Description 1043 -1 18 255 false false false
-78 9 OID 23 4 19 10 true false false
-79 10 VDBName 1043 -1 1 255 true false false
-80 10 SchemaName 1043 -1 2 255 false false false
-81 10 TableName 1043 -1 3 2048 true false false
-82 10 Name 1043 -1 4 255 true false false
-83 10 KeyName 1043 -1 5 255 false false false
-84 10 KeyType 1043 -1 6 20 true false false
-85 10 RefKeyUID 1043 -1 7 50 false false false
-86 10 UID 1043 -1 8 50 true false false
-87 10 Position 23 4 9 10 false false false
-88 10 OID 23 4 10 10 true false false
-89 11 VDBName 1043 -1 1 255 true false false
-90 11 SchemaName 1043 -1 2 255 false false false
-91 11 TableName 1043 -1 3 2048 true false false
-92 11 Name 1043 -1 4 255 true false false
-93 11 Description 1043 -1 5 255 false false false
-94 11 NameInSource 1043 -1 6 255 false false false
-95 11 Type 1043 -1 7 20 true false false
-96 11 IsIndexed 16 1 8 1 true false false
-97 11 RefKeyUID 1043 -1 9 50 false false false
-98 11 UID 1043 -1 10 50 true false false
-99 11 OID 23 4 11 10 true false false
-100 12 VDBName 1043 -1 1 255 true false false
-101 12 SchemaName 1043 -1 2 255 false false false
-102 12 ProcedureName 1043 -1 3 255 true false false
-103 12 Name 1043 -1 4 255 true false false
-104 12 DataType 1043 -1 5 25 true false false
-105 12 Position 23 4 6 10 true false false
-106 12 Type 1043 -1 7 100 true false false
-107 12 Optional 16 1 8 1 true false false
-108 12 Precision 23 4 9 10 true false false
-109 12 TypeLength 23 4 10 10 true false false
-110 12 Scale 23 4 11 10 true false false
-111 12 Radix 23 4 12 10 true false false
-112 12 NullType 1043 -1 13 10 true false false
-113 12 UID 1043 -1 14 50 false false false
-114 12 Description 1043 -1 15 255 false false false
-115 12 OID 23 4 16 10 true false false
-116 13 VDBName 1043 -1 1 255 true false false
-117 13 SchemaName 1043 -1 2 255 false false false
-118 13 Name 1043 -1 3 255 true false false
-119 13 NameInSource 1043 -1 4 255 false false false
-120 13 ReturnsResults 16 1 5 1 true false false
-121 13 UID 1043 -1 6 50 true false false
-122 13 Description 1043 -1 7 255 false false false
-123 13 OID 23 4 8 10 true false false
-124 14 Name 1043 -1 1 255 true false false
-125 14 Value 1043 -1 2 255 true false false
-126 14 UID 1043 -1 3 50 true false false
-127 14 OID 23 4 4 10 true false false
-128 14 ClobValue 14939 -1 5 2097152 false false false
-129 15 PKTABLE_CAT 1043 -1 1 255 false false false
-130 15 PKTABLE_SCHEM 1043 -1 2 255 false false false
-131 15 PKTABLE_NAME 1043 -1 3 255 false false false
-132 15 PKCOLUMN_NAME 1043 -1 4 255 false false false
-133 15 FKTABLE_CAT 1043 -1 5 255 false false false
-134 15 FKTABLE_SCHEM 1043 -1 6 255 false false false
-135 15 FKTABLE_NAME 1043 -1 7 255 false false false
-136 15 FKCOLUMN_NAME 1043 -1 8 255 false false false
-137 15 KEY_SEQ 21 2 9 5 false false false
-138 15 UPDATE_RULE 23 4 10 10 false false false
-139 15 DELETE_RULE 23 4 11 10 false false false
-140 15 FK_NAME 1043 -1 12 255 false false false
-141 15 PK_NAME 1043 -1 13 255 false false false
-142 15 DEFERRABILITY 23 4 14 10 false false false
-143 16 VDBName 1043 -1 1 255 false false false
-144 16 Name 1043 -1 2 255 false false false
-145 16 IsPhysical 16 1 3 1 true false false
-146 16 UID 1043 -1 4 50 true false false
-147 16 Description 1043 -1 5 255 false false false
-148 16 PrimaryMetamodelURI 1043 -1 6 255 true false false
-149 16 OID 23 4 7 10 true false false
-150 17 VDBName 1043 -1 1 255 false false false
-151 17 SchemaName 1043 -1 2 255 false false false
-152 17 Name 1043 -1 3 255 true false false
-153 17 Type 1043 -1 4 20 true false false
-154 17 NameInSource 1043 -1 5 255 false false false
-155 17 IsPhysical 16 1 6 1 true false false
-156 17 SupportsUpdates 16 1 7 1 true false false
-157 17 UID 1043 -1 8 50 true false false
-158 17 Cardinality 23 4 9 10 true false false
-159 17 Description 1043 -1 10 255 false false false
-160 17 IsSystem 16 1 11 1 false false false
-161 17 IsMaterialized 16 1 12 0 true false false
-162 17 OID 23 4 13 10 true false false
-163 18 Name 1043 -1 1 255 true false false
-164 18 Version 1043 -1 2 50 true false false
-165 19 oid 23 4 1 0 false false false
-166 19 nspname 1043 -1 2 0 false false false
-167 20 oid 23 4 1 0 false false false
-168 20 relname 1043 -1 2 0 false false false
-169 20 relnamespace 23 4 3 0 false false false
-170 20 relkind 1042 1 4 0 false false false
-171 20 relam 23 4 5 0 false false false
-172 20 reltuples 700 4 6 0 false false false
-173 20 relpages 23 4 7 0 false false false
-174 20 relhasrules 16 1 8 0 false false false
-175 20 relhasoids 16 1 9 0 false false false
-176 21 oid 23 4 1 0 false false false
-177 21 attrelid 23 4 2 0 false false false
-178 21 attname 1043 -1 3 0 false false false
-179 21 atttypid 23 4 4 0 false false false
-180 21 attlen 21 2 5 0 false false false
-181 21 attnum 21 2 6 0 false false false
-182 21 atttypmod 23 4 7 0 false false false
-183 21 attnotnull 16 1 8 0 false false false
-184 21 attisdropped 16 1 9 0 false false false
-185 21 atthasdef 16 1 10 0 false false false
-186 22 oid 23 4 1 0 false false false
-187 22 typname 1043 -1 2 0 false false false
-188 22 typnamespace 23 4 3 0 false false false
-189 22 typlen 21 2 4 0 false false false
-190 22 typtype 1042 1 5 0 false false false
-191 22 typbasetype 23 4 6 0 false false false
-192 22 typtypmod 23 4 7 0 false false false
-193 22 typrelid 23 4 8 0 false false false
-194 22 typelem 23 4 9 0 false false false
-195 23 oid 23 4 1 0 false false false
-196 23 indexrelid 23 4 2 0 false false false
-197 23 indrelid 23 4 3 0 false false false
-198 23 indisclustered 16 1 4 0 false false false
-199 23 indisunique 16 1 5 0 false false false
-200 23 indisprimary 16 1 6 0 false false false
-201 23 indexprs 1043 -1 7 0 false false false
-202 23 indkey 1043 -1 8 0 false false false
-203 24 oid 23 4 1 0 false false false
-204 24 amname 1043 -1 2 0 false false false
-205 25 oid 23 4 1 0 false false false
-206 25 proname 1043 -1 2 0 false false false
-207 25 proretset 16 1 3 0 false false false
-208 25 prorettype 23 4 4 0 false false false
-209 25 pronargs 21 2 5 0 false false false
-210 25 proargtypes <null> <null> 6 0 false false false
-211 25 proargnames <null> <null> 7 0 false false false
-212 25 proargmodes <null> <null> 8 0 false false false
-213 25 proallargtypes <null> <null> 9 0 false false false
-214 25 pronamespace 23 4 10 0 false false false
-215 26 oid 23 4 1 0 false false false
-216 26 tgconstrrelid 23 4 2 0 false false false
-217 26 tgfoid 23 4 3 0 false false false
-218 26 tgargs 23 4 4 0 false false false
-219 26 tgnargs 23 4 5 0 false false false
-220 26 tgdeferrable 16 1 6 0 false false false
-221 26 tginitdeferred 16 1 7 0 false false false
-222 26 tgconstrname 1043 -1 8 0 false false false
-223 26 tgrelid 23 4 9 0 false false false
-224 27 adrelid 23 4 1 0 false false false
-225 27 adnum 23 4 2 0 false false false
-226 27 adbin 1043 -1 3 0 false false false
-227 27 adsrc 1043 -1 4 0 false false false
-228 28 oid 23 4 1 0 false false false
-229 28 datname 1043 -1 2 0 false false false
-230 28 encoding 23 4 3 0 false false false
-231 28 datlastsysoid 23 4 4 0 false false false
-232 28 datallowconn 1042 1 5 0 false false false
-233 28 datconfig <null> <null> 6 0 false false false
-234 28 datacl <null> <null> 7 0 false false false
-235 28 datdba 23 4 8 0 false false false
-236 28 dattablespace 23 4 9 0 false false false
-237 29 oid 23 4 1 0 false false false
-238 29 usename 1043 -1 2 0 false false false
-239 29 usecreatedb 16 1 3 0 false false false
-240 29 usesuper 16 1 4 0 false false false
-241 30 attrelid 23 4 1 0 false false false
-242 30 attnum 21 2 2 0 false false false
-243 30 attname 1043 -1 3 0 false false false
-244 30 relname 1043 -1 4 0 false false false
-245 30 nspname 1043 -1 5 0 false false false
-246 30 autoinc 16 1 6 0 false false false
-247 30 typoid 23 4 7 0 false false false
-248 31 oid 23 4 1 0 false false false
-249 31 typname 1043 -1 2 0 false false false
-250 31 name 1043 -1 3 0 false false false
-251 31 uid 1043 -1 4 0 false false false
-252 31 typlen 21 2 5 0 false false false
+1 1 PART_ID 1043 -1 1 8 true false false
+2 1 PART_NAME 1043 -1 2 259 false false false
+3 1 PART_COLOR 1043 -1 3 34 false false false
+4 1 PART_WEIGHT 1043 -1 4 259 false false false
+5 2 SHIPPER_ID 21 2 1 4 true false false
+6 2 SHIPPER_NAME 1043 -1 2 34 false false false
+7 3 STATUS_ID 21 2 1 4 true false false
+8 3 STATUS_NAME 1043 -1 2 34 false false false
+9 4 SUPPLIER_ID 1043 -1 1 14 true false false
+10 4 PART_ID 1043 -1 2 8 true false false
+11 4 QUANTITY 21 2 3 4 false false false
+12 4 SHIPPER_ID 21 2 4 4 false false false
+13 5 SUPPLIER_ID 1043 -1 1 14 true false false
+14 5 SUPPLIER_NAME 1043 -1 2 34 false false false
+15 5 SUPPLIER_STATUS 21 2 3 4 false false false
+16 5 SUPPLIER_CITY 1043 -1 4 34 false false false
+17 5 SUPPLIER_STATE 1043 -1 5 6 false false false
+18 6 VDBName 1043 -1 1 259 true false false
+19 6 SchemaName 1043 -1 2 259 true false false
+20 6 Name 1043 -1 3 259 true false false
+21 6 TargetSchemaName 1043 -1 4 259 false false false
+22 6 TargetName 1043 -1 5 4004 false false false
+23 6 Valid 16 1 6 4 false false false
+24 6 LoadState 1043 -1 7 259 false false false
+25 6 Updated 1114 8 8 4 false false false
+26 6 Cardinality 23 4 9 14 false false false
+27 7 resourcePath 1043 -1 1 259 false false false
+28 7 contents 14939 -1 2 4 false false false
+29 8 VDBName 1043 -1 1 259 true false false
+30 8 SchemaName 1043 -1 2 259 false false false
+31 8 TableName 1043 -1 3 259 true false false
+32 8 Name 1043 -1 4 259 true false false
+33 8 Position 23 4 5 14 true false false
+34 8 NameInSource 1043 -1 6 259 false false false
+35 8 DataType 1043 -1 7 104 true false false
+36 8 Scale 23 4 8 14 true false false
+37 8 Length 23 4 9 14 true false false
+38 8 IsLengthFixed 16 1 10 5 true false false
+39 8 SupportsSelect 16 1 11 5 true false false
+40 8 SupportsUpdates 16 1 12 5 true false false
+41 8 IsCaseSensitive 16 1 13 5 true false false
+42 8 IsSigned 16 1 14 5 true false false
+43 8 IsCurrency 16 1 15 5 true false false
+44 8 IsAutoIncremented 16 1 16 5 true false false
+45 8 NullType 1043 -1 17 24 true false false
+46 8 MinRange 1043 -1 18 54 false false false
+47 8 MaxRange 1043 -1 19 54 false false false
+48 8 DistinctCount 23 4 20 14 false false false
+49 8 NullCount 23 4 21 14 false false false
+50 8 SearchType 1043 -1 22 24 true false false
+51 8 Format 1043 -1 23 259 false false false
+52 8 DefaultValue 1043 -1 24 259 false false false
+53 8 JavaClass 1043 -1 25 504 true false false
+54 8 Precision 23 4 26 14 true false false
+55 8 CharOctetLength 23 4 27 14 false false false
+56 8 Radix 23 4 28 14 true false false
+57 8 UID 1043 -1 29 54 true false false
+58 8 Description 1043 -1 30 259 false false false
+59 8 OID 23 4 31 14 true false false
+60 9 Name 1043 -1 1 104 true false false
+61 9 IsStandard 16 1 2 5 false false false
+62 9 IsPhysical 16 1 3 5 false false false
+63 9 TypeName 1043 -1 4 104 true false false
+64 9 JavaClass 1043 -1 5 504 true false false
+65 9 Scale 23 4 6 14 false false false
+66 9 TypeLength 23 4 7 14 true false false
+67 9 NullType 1043 -1 8 24 true false false
+68 9 IsSigned 16 1 9 5 true false false
+69 9 IsAutoIncremented 16 1 10 5 true false false
+70 9 IsCaseSensitive 16 1 11 5 true false false
+71 9 Precision 23 4 12 14 true false false
+72 9 Radix 23 4 13 14 false false false
+73 9 SearchType 1043 -1 14 24 true false false
+74 9 UID 1043 -1 15 54 true false false
+75 9 RuntimeType 1043 -1 16 68 false false false
+76 9 BaseType 1043 -1 17 68 false false false
+77 9 Description 1043 -1 18 259 false false false
+78 9 OID 23 4 19 14 true false false
+79 10 VDBName 1043 -1 1 259 true false false
+80 10 SchemaName 1043 -1 2 259 false false false
+81 10 TableName 1043 -1 3 2052 true false false
+82 10 Name 1043 -1 4 259 true false false
+83 10 KeyName 1043 -1 5 259 false false false
+84 10 KeyType 1043 -1 6 24 true false false
+85 10 RefKeyUID 1043 -1 7 54 false false false
+86 10 UID 1043 -1 8 54 true false false
+87 10 Position 23 4 9 14 false false false
+88 10 OID 23 4 10 14 true false false
+89 11 VDBName 1043 -1 1 259 true false false
+90 11 SchemaName 1043 -1 2 259 false false false
+91 11 TableName 1043 -1 3 2052 true false false
+92 11 Name 1043 -1 4 259 true false false
+93 11 Description 1043 -1 5 259 false false false
+94 11 NameInSource 1043 -1 6 259 false false false
+95 11 Type 1043 -1 7 24 true false false
+96 11 IsIndexed 16 1 8 5 true false false
+97 11 RefKeyUID 1043 -1 9 54 false false false
+98 11 UID 1043 -1 10 54 true false false
+99 11 OID 23 4 11 14 true false false
+100 12 VDBName 1043 -1 1 259 true false false
+101 12 SchemaName 1043 -1 2 259 false false false
+102 12 ProcedureName 1043 -1 3 259 true false false
+103 12 Name 1043 -1 4 259 true false false
+104 12 DataType 1043 -1 5 29 true false false
+105 12 Position 23 4 6 14 true false false
+106 12 Type 1043 -1 7 104 true false false
+107 12 Optional 16 1 8 5 true false false
+108 12 Precision 23 4 9 14 true false false
+109 12 TypeLength 23 4 10 14 true false false
+110 12 Scale 23 4 11 14 true false false
+111 12 Radix 23 4 12 14 true false false
+112 12 NullType 1043 -1 13 14 true false false
+113 12 UID 1043 -1 14 54 false false false
+114 12 Description 1043 -1 15 259 false false false
+115 12 OID 23 4 16 14 true false false
+116 13 VDBName 1043 -1 1 259 true false false
+117 13 SchemaName 1043 -1 2 259 false false false
+118 13 Name 1043 -1 3 259 true false false
+119 13 NameInSource 1043 -1 4 259 false false false
+120 13 ReturnsResults 16 1 5 5 true false false
+121 13 UID 1043 -1 6 54 true false false
+122 13 Description 1043 -1 7 259 false false false
+123 13 OID 23 4 8 14 true false false
+124 14 Name 1043 -1 1 259 true false false
+125 14 Value 1043 -1 2 259 true false false
+126 14 UID 1043 -1 3 54 true false false
+127 14 OID 23 4 4 14 true false false
+128 14 ClobValue 14939 -1 5 2097156 false false false
+129 15 PKTABLE_CAT 1043 -1 1 259 false false false
+130 15 PKTABLE_SCHEM 1043 -1 2 259 false false false
+131 15 PKTABLE_NAME 1043 -1 3 259 false false false
+132 15 PKCOLUMN_NAME 1043 -1 4 259 false false false
+133 15 FKTABLE_CAT 1043 -1 5 259 false false false
+134 15 FKTABLE_SCHEM 1043 -1 6 259 false false false
+135 15 FKTABLE_NAME 1043 -1 7 259 false false false
+136 15 FKCOLUMN_NAME 1043 -1 8 259 false false false
+137 15 KEY_SEQ 21 2 9 9 false false false
+138 15 UPDATE_RULE 23 4 10 14 false false false
+139 15 DELETE_RULE 23 4 11 14 false false false
+140 15 FK_NAME 1043 -1 12 259 false false false
+141 15 PK_NAME 1043 -1 13 259 false false false
+142 15 DEFERRABILITY 23 4 14 14 false false false
+143 16 VDBName 1043 -1 1 259 false false false
+144 16 Name 1043 -1 2 259 false false false
+145 16 IsPhysical 16 1 3 5 true false false
+146 16 UID 1043 -1 4 54 true false false
+147 16 Description 1043 -1 5 259 false false false
+148 16 PrimaryMetamodelURI 1043 -1 6 259 true false false
+149 16 OID 23 4 7 14 true false false
+150 17 VDBName 1043 -1 1 259 false false false
+151 17 SchemaName 1043 -1 2 259 false false false
+152 17 Name 1043 -1 3 259 true false false
+153 17 Type 1043 -1 4 24 true false false
+154 17 NameInSource 1043 -1 5 259 false false false
+155 17 IsPhysical 16 1 6 5 true false false
+156 17 SupportsUpdates 16 1 7 5 true false false
+157 17 UID 1043 -1 8 54 true false false
+158 17 Cardinality 23 4 9 14 true false false
+159 17 Description 1043 -1 10 259 false false false
+160 17 IsSystem 16 1 11 5 false false false
+161 17 IsMaterialized 16 1 12 4 true false false
+162 17 OID 23 4 13 14 true false false
+163 18 Name 1043 -1 1 259 true false false
+164 18 Version 1043 -1 2 54 true false false
+165 19 oid 23 4 1 4 false false false
+166 19 nspname 1043 -1 2 4 false false false
+167 20 oid 23 4 1 4 false false false
+168 20 relname 1043 -1 2 4 false false false
+169 20 relnamespace 23 4 3 4 false false false
+170 20 relkind 1042 1 4 4 false false false
+171 20 relam 23 4 5 4 false false false
+172 20 reltuples 700 4 6 4 false false false
+173 20 relpages 23 4 7 4 false false false
+174 20 relhasrules 16 1 8 4 false false false
+175 20 relhasoids 16 1 9 4 false false false
+176 21 oid 23 4 1 4 false false false
+177 21 attrelid 23 4 2 4 false false false
+178 21 attname 1043 -1 3 4 false false false
+179 21 atttypid 23 4 4 4 false false false
+180 21 attlen 21 2 5 4 false false false
+181 21 attnum 21 2 6 4 false false false
+182 21 atttypmod 23 4 7 4 false false false
+183 21 attnotnull 16 1 8 4 false false false
+184 21 attisdropped 16 1 9 4 false false false
+185 21 atthasdef 16 1 10 4 false false false
+186 22 oid 23 4 1 4 false false false
+187 22 typname 1043 -1 2 4 false false false
+188 22 typnamespace 23 4 3 4 false false false
+189 22 typlen 21 2 4 4 false false false
+190 22 typtype 1042 1 5 4 false false false
+191 22 typbasetype 23 4 6 4 false false false
+192 22 typtypmod 23 4 7 4 false false false
+193 22 typrelid 23 4 8 4 false false false
+194 22 typelem 23 4 9 4 false false false
+195 23 oid 23 4 1 4 false false false
+196 23 indexrelid 23 4 2 4 false false false
+197 23 indrelid 23 4 3 4 false false false
+198 23 indisclustered 16 1 4 4 false false false
+199 23 indisunique 16 1 5 4 false false false
+200 23 indisprimary 16 1 6 4 false false false
+201 23 indexprs 1043 -1 7 4 false false false
+202 23 indkey 1043 -1 8 4 false false false
+203 24 oid 23 4 1 4 false false false
+204 24 amname 1043 -1 2 4 false false false
+205 25 oid 23 4 1 4 false false false
+206 25 proname 1043 -1 2 4 false false false
+207 25 proretset 16 1 3 4 false false false
+208 25 prorettype 23 4 4 4 false false false
+209 25 pronargs 21 2 5 4 false false false
+210 25 proargtypes <null> <null> 6 4 false false false
+211 25 proargnames <null> <null> 7 4 false false false
+212 25 proargmodes <null> <null> 8 4 false false false
+213 25 proallargtypes <null> <null> 9 4 false false false
+214 25 pronamespace 23 4 10 4 false false false
+215 26 oid 23 4 1 4 false false false
+216 26 tgconstrrelid 23 4 2 4 false false false
+217 26 tgfoid 23 4 3 4 false false false
+218 26 tgargs 23 4 4 4 false false false
+219 26 tgnargs 23 4 5 4 false false false
+220 26 tgdeferrable 16 1 6 4 false false false
+221 26 tginitdeferred 16 1 7 4 false false false
+222 26 tgconstrname 1043 -1 8 4 false false false
+223 26 tgrelid 23 4 9 4 false false false
+224 27 adrelid 23 4 1 4 false false false
+225 27 adnum 23 4 2 4 false false false
+226 27 adbin 1043 -1 3 4 false false false
+227 27 adsrc 1043 -1 4 4 false false false
+228 28 oid 23 4 1 4 false false false
+229 28 datname 1043 -1 2 4 false false false
+230 28 encoding 23 4 3 4 false false false
+231 28 datlastsysoid 23 4 4 4 false false false
+232 28 datallowconn 1042 1 5 4 false false false
+233 28 datconfig <null> <null> 6 4 false false false
+234 28 datacl <null> <null> 7 4 false false false
+235 28 datdba 23 4 8 4 false false false
+236 28 dattablespace 23 4 9 4 false false false
+237 29 oid 23 4 1 4 false false false
+238 29 usename 1043 -1 2 4 false false false
+239 29 usecreatedb 16 1 3 4 false false false
+240 29 usesuper 16 1 4 4 false false false
+241 30 attrelid 23 4 1 4 false false false
+242 30 attnum 21 2 2 4 false false false
+243 30 attname 1043 -1 3 4 false false false
+244 30 relname 1043 -1 4 4 false false false
+245 30 nspname 1043 -1 5 4 false false false
+246 30 autoinc 16 1 6 4 false false false
+247 30 typoid 23 4 7 4 false false false
+248 31 oid 23 4 1 4 false false false
+249 31 typname 1043 -1 2 4 false false false
+250 31 name 1043 -1 3 4 false false false
+251 31 uid 1043 -1 4 4 false false false
+252 31 typlen 21 2 5 4 false false false
Row Count : 252
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
oid 4 PartsSupplier java.lang.Integer oid integer pg_catalog pg_attribute 11 10 0 false false false false 2 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -2,6 +2,13 @@
VDBName SchemaName ProcedureName Name COLUMN_TYPE DATA_TYPE DataType PRECISION LENGTH SCALE Radix NULLABLE Description COLUMN_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH Position IS_NULLABLE ProcedureName
PartsSupplier SYS getXMLSchemas document 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 1 NO getXMLSchemas
PartsSupplier SYS getXMLSchemas schema 3 2009 xml 2147483647 2147483647 0 10 1 <null> <null> <null> <null> <null> 1 YES getXMLSchemas
+PartsSupplier SYSADMIN isLoggable level 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 2 NO isLoggable
+PartsSupplier SYSADMIN isLoggable context 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 3 NO isLoggable
+PartsSupplier SYSADMIN isLoggable loggable 5 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 1 NO isLoggable
+PartsSupplier SYSADMIN logMsg level 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 2 NO logMsg
+PartsSupplier SYSADMIN logMsg context 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 3 NO logMsg
+PartsSupplier SYSADMIN logMsg msg 1 2000 object 2147483647 2147483647 0 10 0 <null> <null> <null> <null> <null> 4 NO logMsg
+PartsSupplier SYSADMIN logMsg logged 5 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 1 NO logMsg
PartsSupplier SYSADMIN refreshMatView ViewName 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 1 NO refreshMatView
PartsSupplier SYSADMIN refreshMatView Invalidate 1 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 2 NO refreshMatView
PartsSupplier SYSADMIN refreshMatView RowsUpdated 5 4 integer 10 10 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatView
@@ -20,7 +27,7 @@
PartsSupplier SYSADMIN setProperty OldValue 5 2005 clob 2147483647 2097152 0 10 0 <null> <null> <null> <null> <null> 1 NO setProperty
PartsSupplier SYSADMIN setTableStats tableName 1 12 string 4000 4000 0 10 0 <null> <null> <null> <null> <null> 1 NO setTableStats
PartsSupplier SYSADMIN setTableStats cardinality 1 4 integer 10 10 0 10 0 <null> <null> <null> <null> <null> 2 NO setTableStats
-Row Count : 20
+Row Count : 27
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String PROCEDURE_CAT string SYS ProcedureParams 255 255 0 false false false false 0 true true false false
SchemaName 12 PartsSupplier java.lang.String PROCEDURE_SCHEM string SYS ProcedureParams 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedures.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedures.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedures.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,12 +1,14 @@
string string string string string string string short string
VDBName SchemaName Name RESERVED_1 RESERVED_2 RESERVED_3 Description PROCEDURE_TYPE Name
PartsSupplier SYS getXMLSchemas <null> <null> <null> <null> 2 getXMLSchemas
+PartsSupplier SYSADMIN isLoggable <null> <null> <null> <null> 1 isLoggable
+PartsSupplier SYSADMIN logMsg <null> <null> <null> <null> 1 logMsg
PartsSupplier SYSADMIN refreshMatView <null> <null> <null> <null> 1 refreshMatView
PartsSupplier SYSADMIN refreshMatViewRow <null> <null> <null> <null> 1 refreshMatViewRow
PartsSupplier SYSADMIN setColumnStats <null> <null> <null> <null> 1 setColumnStats
PartsSupplier SYSADMIN setProperty <null> <null> <null> <null> 1 setProperty
PartsSupplier SYSADMIN setTableStats <null> <null> <null> <null> 1 setTableStats
-Row Count : 6
+Row Count : 8
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String PROCEDURE_CAT string SYS Procedures 255 255 0 false false false false 0 true true false false
SchemaName 12 PartsSupplier java.lang.String PROCEDURE_SCHEM string SYS Procedures 255 255 0 false true false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,26 +1,33 @@
string string string string string integer string boolean integer integer integer integer string string string integer
VDBName SchemaName ProcedureName Name DataType Position Type Optional Precision TypeLength Scale Radix NullType UID Description OID
-PartsSupplier SYSADMIN refreshMatView Invalidate boolean 2 In false 0 0 0 10 No Nulls mmuuid:5736cfd3-750f-42d8-b083-102061e11c60 <null> 5
-PartsSupplier SYSADMIN refreshMatViewRow Key object 2 In false 0 0 0 10 No Nulls mmuuid:7af5a63b-1b91-4d1e-912e-846a7e84c579 <null> 2
-PartsSupplier SYSADMIN setProperty Name string 3 In false 0 0 0 10 No Nulls mmuuid:ea92812c-1516-4c75-b5d3-c531fdbd8475 <null> 15
-PartsSupplier SYSADMIN setProperty OldValue clob 1 ReturnValue false 0 2097152 0 10 No Nulls mmuuid:48034d50-dd11-4653-aeae-b0d8d3d55656 <null> 13
-PartsSupplier SYSADMIN refreshMatViewRow RowsUpdated integer 3 ReturnValue false 0 0 0 10 No Nulls mmuuid:05a6a9be-c014-4d06-bcac-746cee4f118b <null> 3
-PartsSupplier SYSADMIN refreshMatView RowsUpdated integer 3 ReturnValue false 0 0 0 10 No Nulls mmuuid:d07a6a75-aa12-4dac-8eab-b2acdbaaffd8 <null> 6
-PartsSupplier SYSADMIN setProperty UID string 2 In false 0 50 0 10 No Nulls mmuuid:d377510e-2ec5-445e-bdf0-59c7c0380962 <null> 14
-PartsSupplier SYSADMIN setProperty Value clob 4 In false 0 2097152 0 10 Nullable mmuuid:ac5beeb8-2d0d-48ff-a533-4237d53b67e8 <null> 16
-PartsSupplier SYSADMIN refreshMatViewRow ViewName string 1 In false 0 0 0 10 No Nulls mmuuid:ba635c44-a052-496d-9c35-ca010c0ebebe <null> 1
-PartsSupplier SYSADMIN refreshMatView ViewName string 1 In false 0 0 0 10 No Nulls mmuuid:e0c28e00-d987-48e4-8c60-5f637f10bf33 <null> 4
-PartsSupplier SYSADMIN setTableStats cardinality integer 2 In false 0 0 0 10 No Nulls mmuuid:0aba7849-7fd3-4bc6-a3d3-dfe433bc67a4 <null> 18
-PartsSupplier SYSADMIN setColumnStats columnName string 2 In false 0 0 0 10 No Nulls mmuuid:76553706-632f-4e60-8489-9d0361f58541 <null> 8
-PartsSupplier SYSADMIN setColumnStats distinctCount integer 3 In false 0 0 0 10 Nullable mmuuid:2c61976e-abb5-4c74-bdae-278681b82aa3 <null> 9
-PartsSupplier SYS getXMLSchemas document string 1 In false 0 0 0 10 No Nulls mmuuid:85b88af5-f0b8-401f-b35a-ccee56155492 <null> 19
-PartsSupplier SYSADMIN setColumnStats max string 5 In false 0 0 0 10 Nullable mmuuid:8f42e701-3609-413d-8c10-77e32cd816f2 <null> 11
-PartsSupplier SYSADMIN setColumnStats min string 6 In false 0 0 0 10 Nullable mmuuid:4511ea3f-f2d2-4abf-b363-afb5186bc2d2 <null> 12
-PartsSupplier SYSADMIN setColumnStats nullCount integer 4 In false 0 0 0 10 Nullable mmuuid:44b8c83c-9fcd-4bd2-a730-76e401205536 <null> 10
-PartsSupplier SYS getXMLSchemas schema xml 1 ResultSet false 0 0 0 10 Nullable mmuuid:003980bb-38bb-41ad-b8c2-c87ca47aa554 <null> 20
-PartsSupplier SYSADMIN setColumnStats tableName string 1 In false 0 0 0 10 No Nulls mmuuid:4dcab018-ca4a-467b-96cc-7f28734c840e <null> 7
-PartsSupplier SYSADMIN setTableStats tableName string 1 In false 0 0 0 10 No Nulls mmuuid:28d8ad4a-e091-4934-afd9-7d27310bd370 <null> 17
-Row Count : 20
+PartsSupplier SYSADMIN refreshMatView Invalidate boolean 2 In false 0 0 0 10 No Nulls mmuuid:5736cfd3-750f-42d8-b083-102061e11c60 <null> 12
+PartsSupplier SYSADMIN refreshMatViewRow Key object 2 In false 0 0 0 10 No Nulls mmuuid:7af5a63b-1b91-4d1e-912e-846a7e84c579 <null> 9
+PartsSupplier SYSADMIN setProperty Name string 3 In false 0 0 0 10 No Nulls mmuuid:ea92812c-1516-4c75-b5d3-c531fdbd8475 <null> 22
+PartsSupplier SYSADMIN setProperty OldValue clob 1 ReturnValue false 0 2097152 0 10 No Nulls mmuuid:48034d50-dd11-4653-aeae-b0d8d3d55656 <null> 20
+PartsSupplier SYSADMIN refreshMatViewRow RowsUpdated integer 3 ReturnValue false 0 0 0 10 No Nulls mmuuid:05a6a9be-c014-4d06-bcac-746cee4f118b <null> 10
+PartsSupplier SYSADMIN refreshMatView RowsUpdated integer 3 ReturnValue false 0 0 0 10 No Nulls mmuuid:d07a6a75-aa12-4dac-8eab-b2acdbaaffd8 <null> 13
+PartsSupplier SYSADMIN setProperty UID string 2 In false 0 50 0 10 No Nulls mmuuid:d377510e-2ec5-445e-bdf0-59c7c0380962 <null> 21
+PartsSupplier SYSADMIN setProperty Value clob 4 In false 0 2097152 0 10 Nullable mmuuid:ac5beeb8-2d0d-48ff-a533-4237d53b67e8 <null> 23
+PartsSupplier SYSADMIN refreshMatViewRow ViewName string 1 In false 0 0 0 10 No Nulls mmuuid:ba635c44-a052-496d-9c35-ca010c0ebebe <null> 8
+PartsSupplier SYSADMIN refreshMatView ViewName string 1 In false 0 0 0 10 No Nulls mmuuid:e0c28e00-d987-48e4-8c60-5f637f10bf33 <null> 11
+PartsSupplier SYSADMIN setTableStats cardinality integer 2 In false 0 0 0 10 No Nulls mmuuid:0aba7849-7fd3-4bc6-a3d3-dfe433bc67a4 <null> 25
+PartsSupplier SYSADMIN setColumnStats columnName string 2 In false 0 0 0 10 No Nulls mmuuid:76553706-632f-4e60-8489-9d0361f58541 <null> 15
+PartsSupplier SYSADMIN isLoggable context string 3 In false 0 0 0 10 No Nulls mmuuid:d62e3ceb-8e58-4c22-96b7-d76ee923e180 <null> 3
+PartsSupplier SYSADMIN logMsg context string 3 In false 0 0 0 10 No Nulls mmuuid:c3f22b88-7f80-4ae3-8e60-6953722b8c38 <null> 6
+PartsSupplier SYSADMIN setColumnStats distinctCount integer 3 In false 0 0 0 10 Nullable mmuuid:2c61976e-abb5-4c74-bdae-278681b82aa3 <null> 16
+PartsSupplier SYS getXMLSchemas document string 1 In false 0 0 0 10 No Nulls mmuuid:85b88af5-f0b8-401f-b35a-ccee56155492 <null> 26
+PartsSupplier SYSADMIN isLoggable level string 2 In false 0 0 0 10 No Nulls mmuuid:995ab23a-3fd8-4ce0-aedd-6dcf99a65be1 <null> 2
+PartsSupplier SYSADMIN logMsg level string 2 In false 0 0 0 10 No Nulls mmuuid:ce0fd267-0038-49d5-ab1c-d8166d556b72 <null> 5
+PartsSupplier SYSADMIN isLoggable loggable boolean 1 ReturnValue false 0 0 0 10 No Nulls mmuuid:589773e4-2f8c-4972-ac0d-d694e317f154 <null> 1
+PartsSupplier SYSADMIN logMsg logged boolean 1 ReturnValue false 0 0 0 10 No Nulls mmuuid:3086a5d9-ae1a-4c99-a649-ad9b8d3db8da <null> 4
+PartsSupplier SYSADMIN setColumnStats max string 5 In false 0 0 0 10 Nullable mmuuid:8f42e701-3609-413d-8c10-77e32cd816f2 <null> 18
+PartsSupplier SYSADMIN setColumnStats min string 6 In false 0 0 0 10 Nullable mmuuid:4511ea3f-f2d2-4abf-b363-afb5186bc2d2 <null> 19
+PartsSupplier SYSADMIN logMsg msg object 4 In false 0 0 0 10 No Nulls mmuuid:81b921cc-9417-4655-898b-3d587ad3af16 <null> 7
+PartsSupplier SYSADMIN setColumnStats nullCount integer 4 In false 0 0 0 10 Nullable mmuuid:44b8c83c-9fcd-4bd2-a730-76e401205536 <null> 17
+PartsSupplier SYS getXMLSchemas schema xml 1 ResultSet false 0 0 0 10 Nullable mmuuid:003980bb-38bb-41ad-b8c2-c87ca47aa554 <null> 27
+PartsSupplier SYSADMIN setColumnStats tableName string 1 In false 0 0 0 10 No Nulls mmuuid:4dcab018-ca4a-467b-96cc-7f28734c840e <null> 14
+PartsSupplier SYSADMIN setTableStats tableName string 1 In false 0 0 0 10 No Nulls mmuuid:28d8ad4a-e091-4934-afd9-7d27310bd370 <null> 24
+Row Count : 27
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String VDBName string SYS ProcedureParams 255 255 0 false false false false 0 true true false false
SchemaName 12 PartsSupplier java.lang.String SchemaName string SYS ProcedureParams 255 255 0 false true false true 1 false true true true
Property changes on: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected:3220-3275
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected 2011-06-28 03:47:29 UTC (rev 3280)
@@ -1,12 +1,14 @@
string string string string boolean string string integer
VDBName SchemaName Name NameInSource ReturnsResults UID Description OID
-PartsSupplier SYS getXMLSchemas <null> true mmuuid:68497bd9-30f5-461b-bf13-6b26aeb2fc4f <null> 6
-PartsSupplier SYSADMIN refreshMatView <null> false mmuuid:52178344-dca8-4c76-8549-00a4515c7044 <null> 2
-PartsSupplier SYSADMIN refreshMatViewRow <null> false mmuuid:1674912b-af56-465a-a1b9-d1de8b761f10 <null> 1
-PartsSupplier SYSADMIN setColumnStats <null> false mmuuid:49c367be-918f-43be-8b9e-99e275179859 <null> 3
-PartsSupplier SYSADMIN setProperty <null> false mmuuid:8db9b08e-3d6e-415a-9ceb-3fef726f424c <null> 4
-PartsSupplier SYSADMIN setTableStats <null> false mmuuid:6d167c35-04d1-41f6-83ff-888c39423823 <null> 5
-Row Count : 6
+PartsSupplier SYS getXMLSchemas <null> true mmuuid:68497bd9-30f5-461b-bf13-6b26aeb2fc4f <null> 8
+PartsSupplier SYSADMIN isLoggable <null> false mmuuid:36769e93-4cc3-417b-853e-5ee5e6653d01 <null> 1
+PartsSupplier SYSADMIN logMsg <null> false mmuuid:9a754e95-853b-40b2-a085-56d57f45953d <null> 2
+PartsSupplier SYSADMIN refreshMatView <null> false mmuuid:52178344-dca8-4c76-8549-00a4515c7044 <null> 4
+PartsSupplier SYSADMIN refreshMatViewRow <null> false mmuuid:1674912b-af56-465a-a1b9-d1de8b761f10 <null> 3
+PartsSupplier SYSADMIN setColumnStats <null> false mmuuid:49c367be-918f-43be-8b9e-99e275179859 <null> 5
+PartsSupplier SYSADMIN setProperty <null> false mmuuid:8db9b08e-3d6e-415a-9ceb-3fef726f424c <null> 6
+PartsSupplier SYSADMIN setTableStats <null> false mmuuid:6d167c35-04d1-41f6-83ff-888c39423823 <null> 7
+Row Count : 8
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String VDBName string SYS Procedures 255 255 0 false false false false 0 true true false false
SchemaName 12 PartsSupplier java.lang.String SchemaName string SYS Procedures 255 255 0 false true false true 1 false true true true
Property changes on: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.4.x/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedures.expected:3220-3275
Modified: trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java 2011-06-28 03:27:07 UTC (rev 3279)
+++ trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java 2011-06-28 03:47:29 UTC (rev 3280)
@@ -40,7 +40,7 @@
private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/vdbless/dqp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "VDBLess"; //$NON-NLS-1$
- @Test public void testExecution() {
+ @Test public void testExecution() throws Exception {
getConnection(VDB, DQP_PROP_FILE);
executeAndAssertResults("select * from Example", new String[] { //$NON-NLS-1$
"TRADEID[string] NOTIONAL[integer]", //$NON-NLS-1$
@@ -51,7 +51,7 @@
closeConnection();
}
- @Test public void testIntegrationExecution() {
+ @Test public void testIntegrationExecution() throws Exception {
getConnection(VDB, DQP_PROP_FILE);
executeAndAssertResults("select * from Example, Smalla where notional = intkey", new String[] { //$NON-NLS-1$
"TRADEID[string] NOTIONAL[integer] INTKEY[integer] STRINGKEY[string] INTNUM[integer] STRINGNUM[string] FLOATNUM[float] LONGNUM[long] DOUBLENUM[double] BYTENUM[short] DATEVALUE[date] TIMEVALUE[time] TIMESTAMPVALUE[timestamp] BOOLEANVALUE[short] CHARVALUE[string] SHORTVALUE[short] BIGINTEGERVALUE[long] BIGDECIMALVALUE[bigdecimal] OBJECTVALUE[string]", //$NON-NLS-1$
@@ -64,7 +64,7 @@
/**
* We have no results to assert here since derby does not provide procedure resultset columns in their metadata.
*/
- @Test public void testProcedureExecution() {
+ @Test public void testProcedureExecution() throws Exception {
getConnection(VDB, DQP_PROP_FILE);
execute("exec Derby.SQLUDTS(null, null, null, null, null)"); //$NON-NLS-1$
closeConnection();
13 years, 6 months
teiid SVN: r3278 - in branches/7.1.1.CP3: engine/src/main/resources/org/teiid/query and 2 other directories.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-06-27 17:48:28 -0400 (Mon, 27 Jun 2011)
New Revision: 3278
Modified:
branches/7.1.1.CP3/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.1.1.CP3/engine/src/main/resources/org/teiid/query/i18n.properties
branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/7.1.1.CP3/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
Log:
TEIID-1493 changing the listener logic to prevent unnecessary cache clearing
Modified: branches/7.1.1.CP3/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.1.1.CP3/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-06-27 21:46:26 UTC (rev 3277)
+++ branches/7.1.1.CP3/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-06-27 21:48:28 UTC (rev 3278)
@@ -557,7 +557,7 @@
}
private void clearPlanCache(String vdbName, int version){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache_for_vdb", vdbName, version)); //$NON-NLS-1$
this.prepPlanCache.clearForVDB(vdbName, version);
}
Modified: branches/7.1.1.CP3/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.1.1.CP3/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-27 21:46:26 UTC (rev 3277)
+++ branches/7.1.1.CP3/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-27 21:48:28 UTC (rev 3278)
@@ -811,6 +811,8 @@
DQPCore.Unable_to_load_metadata_for_VDB_name__{0},_version__{1}=Unable to load metadata for VDB name= {0}, version= {1}
DQPCore.Unknown_query_metadata_exception_while_registering_query__{0}.=Unknown query metadata exception while registering query: {0}.
DQPCore.Clearing_prepared_plan_cache=Clearing prepared plan cache
+DQPCore.Clearing_prepared_plan_cache_for_vdb=Clearing prepared plan cache for vdb {0}.{1}
+DQPCore.clearing_resultset_cache=Clearing the resultset cache for vdb {0}.{1}
DQPCore.The_request_has_been_closed.=The request {0} has been closed.
DQPCore.The_atomic_request_has_been_cancelled=The atomic request {0} has been canceled.
DQPCore.failed_to_cancel=Failed to Cancel request, as request already finished processing
Modified: branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-06-27 21:46:26 UTC (rev 3277)
+++ branches/7.1.1.CP3/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-06-27 21:48:28 UTC (rev 3278)
@@ -32,9 +32,11 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Properties;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -78,6 +80,7 @@
import org.teiid.core.ComponentNotFoundException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.LRUCache;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.process.DQPConfiguration;
@@ -101,6 +104,7 @@
import org.teiid.transport.ODBCSocketListener;
import org.teiid.transport.SocketConfiguration;
import org.teiid.transport.SocketListener;
+import org.teiid.vdb.runtime.VDBKey;
@ManagementObject(name="RuntimeEngineDeployer", isRuntime=true, componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
@@ -212,14 +216,19 @@
// add vdb life cycle listeners
this.vdbRepository.addListener(new VDBLifeCycleListener() {
-
+
+ private Set<VDBKey> recentlyRemoved = Collections.newSetFromMap(new LRUCache<VDBKey, Boolean>(10000));
+
@Override
public void removed(String name, int version) {
-
+ recentlyRemoved.add(new VDBKey(name, version));
}
@Override
public void added(String name, int version) {
+ if (!recentlyRemoved.remove(new VDBKey(name, version))) {
+ return;
+ }
// terminate all the previous sessions
try {
Collection<SessionMetadata> sessions = sessionService.getActiveSessions();
Modified: branches/7.1.1.CP3/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.1.1.CP3/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-06-27 21:46:26 UTC (rev 3277)
+++ branches/7.1.1.CP3/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-06-27 21:48:28 UTC (rev 3278)
@@ -31,6 +31,7 @@
import java.util.NavigableMap;
import java.util.Properties;
import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.jboss.deployers.spi.DeploymentException;
import org.teiid.adminapi.AdminException;
@@ -60,7 +61,7 @@
private MetadataStore systemStore;
private MetadataStore odbcStore;
private boolean odbcEnabled = false;
- private List<VDBLifeCycleListener> listeners = new ArrayList<VDBLifeCycleListener>();
+ private List<VDBLifeCycleListener> listeners = new CopyOnWriteArrayList<VDBLifeCycleListener>();
private SystemFunctionManager systemFunctionManager;
public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws DeploymentException {
@@ -157,7 +158,7 @@
this.odbcEnabled = true;
}
- public synchronized boolean removeVDB(String vdbName, int vdbVersion) {
+ public boolean removeVDB(String vdbName, int vdbVersion) {
VDBKey key = new VDBKey(vdbName, vdbVersion);
CompositeVDB removed = this.vdbRepo.remove(key);
if (removed != null) {
@@ -214,11 +215,11 @@
}
}
- public synchronized void addListener(VDBLifeCycleListener listener) {
+ public void addListener(VDBLifeCycleListener listener) {
this.listeners.add(listener);
}
- public synchronized void removeListener(VDBLifeCycleListener listener) {
+ public void removeListener(VDBLifeCycleListener listener) {
this.listeners.remove(listener);
}
13 years, 6 months
teiid SVN: r3277 - in branches/7.1.1.CP3/engine/src: main/java/org/teiid/query/sql/symbol and 1 other directories.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-06-27 17:46:26 -0400 (Mon, 27 Jun 2011)
New Revision: 3277
Modified:
branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
branches/7.1.1.CP3/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
Log:
TEIID-1656 adding support for pushdown of aggs over unions with grouping expressions
Modified: branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2011-06-27 21:44:19 UTC (rev 3276)
+++ branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java 2011-06-27 21:46:26 UTC (rev 3277)
@@ -29,6 +29,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
@@ -45,6 +46,7 @@
import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -58,6 +60,7 @@
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.rewriter.QueryRewriter;
+import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.LanguageObject.Util;
import org.teiid.query.sql.lang.CompareCriteria;
import org.teiid.query.sql.lang.Criteria;
@@ -116,7 +119,7 @@
PlanNode setOp = child.getFirstChild();
try {
- pushGroupNodeOverUnion(plan, metadata, capFinder, groupNode, child, groupingExpressions, setOp);
+ pushGroupNodeOverUnion(plan, metadata, capFinder, groupNode, child, groupingExpressions, setOp, context, analysisRecord);
} catch (QueryResolverException e) {
throw new TeiidComponentException(e);
}
@@ -154,21 +157,66 @@
* source
* child 1
* ...
- *
+ *
* Or if the child does not support pushdown we add dummy aggregate projection
* count(*) = 1, count(x) = case x is null then 0 else 1 end, avg(x) = x, etc.
*/
private void pushGroupNodeOverUnion(PlanNode plan,
QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
- PlanNode groupNode, PlanNode child,
- List<SingleElementSymbol> groupingExpressions, PlanNode setOp)
+ PlanNode groupNode, PlanNode unionSourceParent,
+ List<SingleElementSymbol> groupingExpressions, PlanNode setOp, CommandContext context, AnalysisRecord record)
throws TeiidComponentException, QueryMetadataException,
QueryPlannerException, QueryResolverException {
- if (setOp == null || setOp.getType() != NodeConstants.Types.SET_OP || setOp.getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
- return; //must not be a union
+ if (setOp == null) {
+ return;
}
+ PlanNode intermediateView = null;
+ if (setOp.getType() != NodeConstants.Types.SET_OP) {
+ if (setOp.getType() != NodeConstants.Types.PROJECT) {
+ return;
+ }
+ intermediateView = unionSourceParent;
+ unionSourceParent = setOp.getFirstChild();
+ if (unionSourceParent == null || unionSourceParent.getType() != NodeConstants.Types.SOURCE || unionSourceParent.getFirstChild() == null
+ || unionSourceParent.getFirstChild().getType() != NodeConstants.Types.SET_OP || unionSourceParent.getFirstChild().getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
+ return; //not an eligible union
+ }
+ setOp = unionSourceParent.getFirstChild();
+ if (groupingExpressions == null) {
+ return; //shouldn't happen - the view should have been removed
+ }
+ }
+ if (setOp.getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
+ return;
+ }
LinkedHashSet<AggregateSymbol> aggregates = collectAggregates(groupNode);
+ //check to see if any aggregate is dependent upon cardinality
+ boolean cardinalityDependent = RuleRemoveOptionalJoins.areAggregatesCardinalityDependent(aggregates);
+
+ LinkedList<PlanNode> unionChildren = new LinkedList<PlanNode>();
+ findUnionChildren(unionChildren, cardinalityDependent, setOp);
+
+ SymbolMap parentMap = (SymbolMap)unionSourceParent.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ List<ElementSymbol> virtualElements = parentMap.getKeys();
+ GroupSymbol virtualGroup = unionSourceParent.getGroups().iterator().next();
+
+ List<SingleElementSymbol> actualGroupingExpressions = groupingExpressions;
+ if (intermediateView != null) {
+ actualGroupingExpressions = new ArrayList<SingleElementSymbol>(groupingExpressions.size());
+ SymbolMap viewMap = (SymbolMap)intermediateView.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ for (SingleElementSymbol ses : groupingExpressions) {
+ Expression ex = viewMap.getMappedExpression((ElementSymbol)ses);
+ SingleElementSymbol newCol = null;
+ if (ex instanceof SingleElementSymbol) {
+ newCol = (SingleElementSymbol)ex;
+ } else {
+ newCol = new ExpressionSymbol("grouping", ex); //$NON-NLS-1$
+ }
+ actualGroupingExpressions.add(newCol);
+ }
+ }
+
/*
* if there are no aggregates, this is just duplicate removal
* mark the union as not all, which should be removed later but
@@ -181,26 +229,19 @@
return;
}
- //check to see if any aggregate is dependent upon cardinality
- boolean cardinalityDependent = RuleRemoveOptionalJoins.areAggregatesCardinalityDependent(aggregates);
-
- LinkedList<PlanNode> unionChildren = new LinkedList<PlanNode>();
- findUnionChildren(unionChildren, cardinalityDependent, setOp);
-
if (unionChildren.size() < 2) {
return;
}
- SymbolMap parentMap = (SymbolMap)child.getProperty(NodeConstants.Info.SYMBOL_MAP);
- List<ElementSymbol> virtualElements = parentMap.getKeys();
List<SingleElementSymbol> copy = new ArrayList<SingleElementSymbol>(aggregates);
aggregates.clear();
Map<AggregateSymbol, Expression> aggMap = buildAggregateMap(copy, metadata, aggregates);
boolean shouldPushdown = false;
List<Boolean> pushdownList = new ArrayList<Boolean>(unionChildren.size());
+
for (PlanNode planNode : unionChildren) {
- boolean pushdown = canPushGroupByToUnionChild(metadata, capFinder, groupingExpressions, aggregates, planNode);
+ boolean pushdown = canPushGroupByToUnionChild(metadata, capFinder, actualGroupingExpressions, aggregates, planNode, record);
pushdownList.add(pushdown);
shouldPushdown |= pushdown;
}
@@ -209,17 +250,70 @@
return;
}
+ if (intermediateView != null) {
+ parentMap = pushGroupByView(plan, metadata, capFinder, unionSourceParent,
+ setOp, intermediateView, cardinalityDependent,
+ unionChildren, virtualElements, virtualGroup);
+ virtualElements = parentMap.getKeys();
+ virtualGroup = unionSourceParent.getGroups().iterator().next();
+ }
+
Iterator<Boolean> pushdownIterator = pushdownList.iterator();
for (PlanNode planNode : unionChildren) {
- addView(plan, planNode, pushdownIterator.next(), groupingExpressions, aggregates, virtualElements, metadata, capFinder);
+ addView(plan, planNode, pushdownIterator.next(), new GroupSymbol("X"), groupingExpressions, aggregates, virtualElements, metadata, capFinder, null); //$NON-NLS-1$
}
//update the parent plan with the staged aggregates and the new projected symbols
- List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(child, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
- List<ElementSymbol> updatedVirturalElement = new ArrayList<ElementSymbol>(virtualElements);
+ List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(unionSourceParent, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
//hack to introduce aggregate symbols to the parent view TODO: this should change the metadata properly.
- GroupSymbol virtualGroup = child.getGroups().iterator().next();
+ SymbolMap newParentMap = modifyUnionSourceParent(unionSourceParent, virtualGroup, projectedViewSymbols, virtualElements);
+ Map<AggregateSymbol, ElementSymbol> projectedMap = new HashMap<AggregateSymbol, ElementSymbol>();
+ Iterator<AggregateSymbol> aggIter = aggregates.iterator();
+ for (ElementSymbol projectedViewSymbol : newParentMap.getKeys().subList(projectedViewSymbols.size() - aggregates.size(), projectedViewSymbols.size())) {
+ projectedMap.put(aggIter.next(), projectedViewSymbol);
+ }
+ for (Expression expr : aggMap.values()) {
+ ExpressionMappingVisitor.mapExpressions(expr, projectedMap);
+ }
+ mapExpressions(groupNode.getParent(), aggMap, metadata);
+ }
+
+ private SymbolMap pushGroupByView(PlanNode plan,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
+ PlanNode unionSourceParent, PlanNode setOp,
+ PlanNode intermediateView, boolean cardinalityDependent,
+ LinkedList<PlanNode> unionChildren,
+ List<ElementSymbol> virtualElements, GroupSymbol virtualGroup)
+ throws TeiidComponentException, QueryPlannerException,
+ QueryResolverException {
+ //perform view pushing
+ /*
+ * TODO: this introduces yet another potentially unneeded view, but cannot be removed by the normal merge virtual logic
+ * due to an intervening access node
+ */
+ PlanNode intermediateProject = intermediateView.getFirstChild();
+ List<SingleElementSymbol> projectedViewSymbols = (List<SingleElementSymbol>)intermediateProject.getProperty(NodeConstants.Info.PROJECT_COLS);
+ for (PlanNode planNode : unionChildren) {
+ addView(plan, planNode, false, (GroupSymbol) virtualGroup.clone(), null, Collections.EMPTY_SET, virtualElements, metadata, capFinder, LanguageObject.Util.deepClone(projectedViewSymbols, SingleElementSymbol.class));
+ }
+ unionChildren.clear();
+ findUnionChildren(unionChildren, cardinalityDependent, setOp);
+ virtualGroup = intermediateView.getGroups().iterator().next();
+ unionSourceParent.getGroups().clear();
+ unionSourceParent.addGroup(virtualGroup);
+ projectedViewSymbols = (List<SingleElementSymbol>)NodeEditor.findNodePreOrder(unionSourceParent, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS);
+ SymbolMap parentMap = modifyUnionSourceParent(unionSourceParent, virtualGroup, projectedViewSymbols, Collections.EMPTY_LIST);
+ //remove the old view
+ NodeEditor.removeChildNode(intermediateView, intermediateProject);
+ NodeEditor.removeChildNode(intermediateView.getParent(), intermediateView);
+ return parentMap;
+ }
+
+ private SymbolMap modifyUnionSourceParent(PlanNode unionSourceParent,
+ GroupSymbol virtualGroup,
+ List<SingleElementSymbol> projectedViewSymbols, List<ElementSymbol> baseVirtualElements) {
+ List<ElementSymbol> updatedVirturalElement = new ArrayList<ElementSymbol>(baseVirtualElements);
for (int i = updatedVirturalElement.size(); i < projectedViewSymbols.size(); i++) {
SingleElementSymbol symbol = projectedViewSymbols.get(i);
String name = symbol.getShortName();
@@ -227,25 +321,18 @@
ElementSymbol virtualElement = new ElementSymbol(virtualElementName);
virtualElement.setGroupSymbol(virtualGroup);
virtualElement.setType(symbol.getType());
+ virtualElement.setMetadataID(new TempMetadataID(virtualElementName, symbol.getType()));
updatedVirturalElement.add(virtualElement);
}
SymbolMap newParentMap = SymbolMap.createSymbolMap(updatedVirturalElement, projectedViewSymbols);
- child.setProperty(NodeConstants.Info.SYMBOL_MAP, newParentMap);
- Map<AggregateSymbol, ElementSymbol> projectedMap = new HashMap<AggregateSymbol, ElementSymbol>();
- Iterator<AggregateSymbol> aggIter = aggregates.iterator();
- for (ElementSymbol projectedViewSymbol : newParentMap.getKeys().subList(projectedViewSymbols.size() - aggregates.size(), projectedViewSymbols.size())) {
- projectedMap.put(aggIter.next(), projectedViewSymbol);
- }
- for (Expression expr : aggMap.values()) {
- ExpressionMappingVisitor.mapExpressions(expr, projectedMap);
- }
- mapExpressions(groupNode.getParent(), aggMap, metadata);
+ unionSourceParent.setProperty(NodeConstants.Info.SYMBOL_MAP, newParentMap);
+ return newParentMap;
}
private boolean canPushGroupByToUnionChild(QueryMetadataInterface metadata,
CapabilitiesFinder capFinder,
List<SingleElementSymbol> groupingExpressions,
- LinkedHashSet<AggregateSymbol> aggregates, PlanNode planNode)
+ LinkedHashSet<AggregateSymbol> aggregates, PlanNode planNode, AnalysisRecord record)
throws QueryMetadataException, TeiidComponentException {
if (planNode.getType() != NodeConstants.Types.ACCESS) {
return false;
@@ -260,8 +347,16 @@
return false;
}
}
- if ((groupingExpressions == null || groupingExpressions.isEmpty()) && !CapabilitiesUtil.supports(Capability.QUERY_AGGREGATES_COUNT_STAR, modelId, metadata, capFinder)) {
- return false;
+ if ((groupingExpressions == null || groupingExpressions.isEmpty())) {
+ if (!CapabilitiesUtil.supports(Capability.QUERY_AGGREGATES_COUNT_STAR, modelId, metadata, capFinder)) {
+ return false;
+ }
+ } else {
+ for (SingleElementSymbol ses : groupingExpressions) {
+ if(! CriteriaCapabilityValidatorVisitor.canPushLanguageObject(ses, modelId, metadata, capFinder, record)) {
+ return false;
+ }
+ }
}
//TODO: check to see if we are distinct
return true;
@@ -270,7 +365,7 @@
/**
* Recursively searches the union tree for all applicable source nodes
*/
- private PlanNode findUnionChildren(List<PlanNode> unionChildren, boolean carinalityDependent, PlanNode setOp) {
+ static PlanNode findUnionChildren(List<PlanNode> unionChildren, boolean carinalityDependent, PlanNode setOp) {
if (setOp.getType() != NodeConstants.Types.SET_OP || setOp.getProperty(NodeConstants.Info.SET_OPERATION) != Operation.UNION) {
return setOp;
}
@@ -292,11 +387,14 @@
return null;
}
- public void addView(PlanNode root, PlanNode unionSource, boolean pushdown, List<SingleElementSymbol> groupingExpressions,
+ public void addView(PlanNode root, PlanNode unionSource, boolean pushdown, GroupSymbol group, List<SingleElementSymbol> groupingExpressions,
Set<AggregateSymbol> aggregates, List<ElementSymbol> virtualElements,
- QueryMetadataInterface metadata, CapabilitiesFinder capFinder)
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder, List<SingleElementSymbol> actualProject)
throws TeiidComponentException, QueryPlannerException, QueryResolverException {
- PlanNode originalNode = unionSource;
+ PlanNode accessNode = null;
+ if (pushdown) {
+ accessNode = NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.ACCESS);
+ }
//branches other than the first need to have their projected column names updated
PlanNode sortNode = NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
List<SingleElementSymbol> sortOrder = null;
@@ -320,34 +418,23 @@
updateSymbolName(projectCols, i, virtualElem, projectedSymbol);
}
}
- PlanNode intermediateView = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
- unionSource.addAsParent(intermediateView);
+ PlanNode intermediateView = createView(group, virtualElements, unionSource, metadata);
+ SymbolMap symbolMap = (SymbolMap)intermediateView.getProperty(Info.SYMBOL_MAP);
unionSource = intermediateView;
- TempMetadataStore store = new TempMetadataStore();
- TempMetadataAdapter tma = new TempMetadataAdapter(metadata, store);
- GroupSymbol group = new GroupSymbol("X"); //$NON-NLS-1$
- try {
- group.setMetadataID(ResolverUtil.addTempGroup(tma, group, virtualElements, false));
- } catch (QueryResolverException e) {
- throw new TeiidComponentException(e);
- }
- intermediateView.addGroup(group);
- List<ElementSymbol> projectedSymbols = ResolverUtil.resolveElementsInGroup(group, metadata);
- SymbolMap symbolMap = SymbolMap.createSymbolMap(projectedSymbols,
- (List<Expression>)NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS));
- intermediateView.setProperty(NodeConstants.Info.SYMBOL_MAP, symbolMap);
Set<SingleElementSymbol> newGroupingExpressions = Collections.emptySet();
if (groupingExpressions != null) {
newGroupingExpressions = new HashSet<SingleElementSymbol>();
for (SingleElementSymbol singleElementSymbol : groupingExpressions) {
- newGroupingExpressions.add((SingleElementSymbol)symbolMap.getKeys().get(virtualElements.indexOf(singleElementSymbol)).clone());
+ newGroupingExpressions.add((SingleElementSymbol) symbolMap.getKeys().get(virtualElements.indexOf(singleElementSymbol)).clone());
}
}
- List<SingleElementSymbol> projectedViewSymbols = Util.deepClone(projectedSymbols, SingleElementSymbol.class);
+ List<SingleElementSymbol> projectedViewSymbols = Util.deepClone(symbolMap.getKeys(), SingleElementSymbol.class);
- SymbolMap viewMapping = SymbolMap.createSymbolMap(NodeEditor.findParent(unionSource, NodeConstants.Types.SOURCE).getGroups().iterator().next(), projectedSymbols, metadata);
+ PlanNode parent = NodeEditor.findParent(unionSource, NodeConstants.Types.SOURCE);
+ SymbolMap parentMap = (SymbolMap) parent.getProperty(NodeConstants.Info.SYMBOL_MAP);
+ SymbolMap viewMapping = SymbolMap.createSymbolMap(parentMap.getKeys(), projectedViewSymbols);
for (AggregateSymbol agg : aggregates) {
agg = (AggregateSymbol)agg.clone();
ExpressionMappingVisitor.mapExpressions(agg, viewMapping.asMap());
@@ -380,18 +467,50 @@
unionSource = projectPlanNode;
//create proper names for the aggregate symbols
- Select select = new Select(projectedViewSymbols);
+ Select select = null;
+ if (actualProject == null) {
+ select = new Select(projectedViewSymbols);
+ } else {
+ select = new Select(actualProject);
+ }
QueryRewriter.makeSelectUnique(select, false);
projectedViewSymbols = select.getProjectedSymbols();
projectPlanNode.setProperty(NodeConstants.Info.PROJECT_COLS, projectedViewSymbols);
projectPlanNode.addGroup(group);
if (pushdown) {
- while (RuleRaiseAccess.raiseAccessNode(root, originalNode, metadata, capFinder, true, null) != null) {
+ while (RuleRaiseAccess.raiseAccessNode(root, accessNode, metadata, capFinder, true, null) != null) {
//continue to raise
}
}
}
+
+ static PlanNode createView(GroupSymbol group, List<? extends SingleElementSymbol> virtualElements, PlanNode child, QueryMetadataInterface metadata) throws TeiidComponentException {
+ SymbolMap symbolMap = createSymbolMap(group, virtualElements, child, metadata);
+ PlanNode branchSource = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
+ branchSource.addGroup(group);
+ PlanNode projectNode = NodeEditor.findNodePreOrder(child, NodeConstants.Types.PROJECT);
+ branchSource.setProperty(Info.SYMBOL_MAP, SymbolMap.createSymbolMap(symbolMap.getKeys(), (List<? extends SingleElementSymbol>)projectNode.getProperty(Info.PROJECT_COLS)));
+ child.addAsParent(branchSource);
+ return branchSource;
+ }
+ private static SymbolMap createSymbolMap(GroupSymbol group,
+ List<? extends SingleElementSymbol> virtualElements,
+ PlanNode child, QueryMetadataInterface metadata)
+ throws TeiidComponentException, QueryMetadataException {
+ TempMetadataStore store = new TempMetadataStore();
+ TempMetadataAdapter tma = new TempMetadataAdapter(metadata, store);
+ try {
+ group.setMetadataID(ResolverUtil.addTempGroup(tma, group, virtualElements, false));
+ } catch (QueryResolverException e) {
+ throw new TeiidComponentException(e);
+ }
+ List<ElementSymbol> projectedSymbols = ResolverUtil.resolveElementsInGroup(group, metadata);
+ SymbolMap symbolMap = SymbolMap.createSymbolMap(projectedSymbols,
+ (List<Expression>)NodeEditor.findNodePreOrder(child, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS));
+ return symbolMap;
+ }
+
private void updateSymbolName(List<SingleElementSymbol> projectCols, int i,
ElementSymbol virtualElem, SingleElementSymbol projectedSymbol) {
if (projectedSymbol instanceof AliasSymbol) {
@@ -450,20 +569,19 @@
}
Map<PlanNode, List<SingleElementSymbol>> groupingMap = createNodeMapping(groupNode, groupingExpressions, false);
- Set<PlanNode> possibleTargetNodes = new HashSet<PlanNode>(aggregateMap.keySet());
+ Set<PlanNode> possibleTargetNodes = new LinkedHashSet<PlanNode>(aggregateMap.keySet());
possibleTargetNodes.addAll(groupingMap.keySet());
for (PlanNode planNode : possibleTargetNodes) {
Set<SingleElementSymbol> stagedGroupingSymbols = new LinkedHashSet<SingleElementSymbol>();
List<AggregateSymbol> aggregates = aggregateMap.get(planNode);
- List<SingleElementSymbol> groupBy = groupingMap.get(planNode);
if (!canPush(groupNode, stagedGroupingSymbols, planNode)) {
continue;
}
- if (groupBy != null) {
- stagedGroupingSymbols.addAll(groupBy);
+ if (groupingExpressions != null) {
+ filterJoinColumns(stagedGroupingSymbols, planNode.getGroups(), groupingExpressions);
}
collectSymbolsFromOtherAggregates(allAggregates, aggregates, planNode, stagedGroupingSymbols);
@@ -625,7 +743,7 @@
private <T extends SingleElementSymbol> Map<PlanNode, List<T>> createNodeMapping(PlanNode groupNode,
Collection<T> expressions, boolean aggs) {
- Map<PlanNode, List<T>> result = new HashMap<PlanNode, List<T>>();
+ Map<PlanNode, List<T>> result = new LinkedHashMap<PlanNode, List<T>>();
if (expressions == null) {
return result;
}
@@ -657,7 +775,7 @@
if (originatingNode.getParent() == groupNode) {
//anything logically applied after the join and is
//dependent upon the cardinality prevents us from optimizing.
- if (aggs && RuleRemoveOptionalJoins.isCardinalityDependent((AggregateSymbol)aggregateSymbol)) {
+ if (aggs && ((AggregateSymbol)aggregateSymbol).isCardinalityDependent()) {
return null;
}
continue;
@@ -753,7 +871,8 @@
nestedAggregates.add(countAgg);
nestedAggregates.add(sumAgg);
nestedAggregates.add(sumSqAgg);
- } else {
+ }
+ else {
//AGG(X) -> AGG(AGG(X))
newExpression = new AggregateSymbol("stagedAgg", aggFunction.name(), false, partitionAgg); //$NON-NLS-1$
nestedAggregates.add(partitionAgg);
@@ -787,4 +906,5 @@
public String toString() {
return "PushAggregates"; //$NON-NLS-1$
}
+
}
Modified: branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
===================================================================
--- branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2011-06-27 21:44:19 UTC (rev 3276)
+++ branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2011-06-27 21:46:26 UTC (rev 3277)
@@ -299,30 +299,13 @@
static boolean areAggregatesCardinalityDependent(Set<AggregateSymbol> aggs) {
for (AggregateSymbol aggregateSymbol : aggs) {
- if (isCardinalityDependent(aggregateSymbol)) {
+ if (aggregateSymbol.isCardinalityDependent()) {
return true;
}
}
return false;
}
- static boolean isCardinalityDependent(AggregateSymbol aggregateSymbol) {
- if (aggregateSymbol.isDistinct()) {
- return false;
- }
- switch (aggregateSymbol.getAggregateFunction()) {
- case COUNT:
- case AVG:
- case STDDEV_POP:
- case STDDEV_SAMP:
- case VAR_POP:
- case VAR_SAMP:
- case SUM:
- return true;
- }
- return false;
- }
-
public String toString() {
return "RuleRemoveOptionalJoins"; //$NON-NLS-1$
}
Modified: branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
===================================================================
--- branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2011-06-27 21:44:19 UTC (rev 3276)
+++ branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2011-06-27 21:46:26 UTC (rev 3277)
@@ -243,5 +243,22 @@
&& EquivalenceUtil.areEqual(this.getExpression(), other.getExpression())
&& EquivalenceUtil.areEqual(this.getOrderBy(), other.getOrderBy());
}
+
+ public boolean isCardinalityDependent() {
+ if (isDistinct()) {
+ return false;
+ }
+ switch (getAggregateFunction()) {
+ case COUNT:
+ case AVG:
+ case STDDEV_POP:
+ case STDDEV_SAMP:
+ case VAR_POP:
+ case VAR_SAMP:
+ case SUM:
+ return true;
+ }
+ return false;
+ }
}
Modified: branches/7.1.1.CP3/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- branches/7.1.1.CP3/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2011-06-27 21:44:19 UTC (rev 3276)
+++ branches/7.1.1.CP3/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2011-06-27 21:46:26 UTC (rev 3277)
@@ -22,7 +22,10 @@
package org.teiid.query.optimizer;
-import static org.teiid.query.optimizer.TestOptimizer.*;
+import static org.teiid.query.optimizer.TestOptimizer.SHOULD_SUCCEED;
+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 org.junit.Test;
import org.teiid.query.metadata.QueryMetadataInterface;
@@ -35,6 +38,7 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.unittest.FakeMetadataFacade;
import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings("nls")
@@ -899,6 +903,37 @@
}
/**
+ * pushdown won't happen since searched case is not supported
+ */
+ @Test public void testPushDownOverUnionGroupingExpression() throws Exception {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = getAggregateCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", getAggregateCapabilities()); //$NON-NLS-1$
+
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), case when e1 is null then 0 else 1 end from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z group by case when e1 is null then 0 else 1 end", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ new String[]{"SELECT v_1.c_0, MAX(v_1.c_1) FROM (SELECT CASE WHEN v_0.c_0 IS NULL THEN 0 ELSE 1 END AS c_0, v_0.c_1 FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0) AS v_1 GROUP BY v_1.c_0", //$NON-NLS-1$
+ "SELECT g_0.e1, g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 2, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 0, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 3, // Project
+ 0, // Select
+ 0, // Sort
+ 1 // UnionAll
+ });
+ }
+
+ /**
* Ensures that we do not raise criteria over a group by
* TODO: check if the criteria only depends on grouping columns
*/
13 years, 6 months
teiid SVN: r3276 - in branches/7.1.1.CP3: engine/src/main/java/org/teiid/query/tempdata and 2 other directories.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-06-27 17:44:19 -0400 (Mon, 27 Jun 2011)
New Revision: 3276
Modified:
branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java
Log:
TEIID-1657 changes to ensure that matview refresh is handled properly with distributed caching enabled.
Modified: branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-06-27 18:58:27 UTC (rev 3275)
+++ branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-06-27 21:44:19 UTC (rev 3276)
@@ -80,6 +80,18 @@
*/
public class TransformationMetadata extends BasicQueryMetadata implements Serializable {
+ private static final class LiveTableQueryNode extends QueryNode {
+ Table t;
+ private LiveTableQueryNode(Table t) {
+ super(t.getFullName(), null);
+ this.t = t;
+ }
+
+ public String getQuery() {
+ return t.getSelectTransformation();
+ }
+ }
+
private final class VirtualFileInputStreamFactory extends
InputStreamFactory {
private final VirtualFile f;
@@ -480,8 +492,7 @@
if (!tableRecord.isVirtual()) {
throw new QueryMetadataException(QueryPlugin.Util.getString("TransformationMetadata.QueryPlan_could_not_be_found_for_physical_group__6")+tableRecord.getFullName()); //$NON-NLS-1$
}
- String transQuery = tableRecord.getSelectTransformation();
- QueryNode queryNode = new QueryNode(tableRecord.getFullName(), transQuery);
+ LiveTableQueryNode queryNode = new LiveTableQueryNode(tableRecord);
// get any bindings and add them onto the query node
List bindings = tableRecord.getBindings();
Modified: branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-06-27 18:58:27 UTC (rev 3275)
+++ branches/7.1.1.CP3/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-06-27 21:44:19 UTC (rev 3276)
@@ -303,7 +303,7 @@
String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
MatTableInfo info = globalStore.getMatTableInfo(matTableName);
- boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(1).getExpression()).getValue());
+ boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(2).getExpression()).getValue());
if (invalidate) {
touchTable(context, matTableName, false);
}
@@ -316,7 +316,7 @@
Object matTableId = RelationalPlanner.getGlobalTempTableMetadataId(group, matTableName, context, metadata, AnalysisRecord.createNonRecordingRecord());
GroupSymbol matTable = new GroupSymbol(matTableName);
matTable.setMetadataID(matTableId);
- int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null);
+ int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore, info, null, false);
return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
} else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
Object groupID = validateMatView(metadata, proc);
@@ -396,18 +396,19 @@
key.vdb = new VDBKey(context.getVdbName(), context.getVdbVersion());
MatTableEntry entry = this.tables.get(key);
- boolean firstload = !info.isValid();
- if (entry != null && entry.lastUpdate > info.getUpdateTime() && info.getState() != MatState.LOADING) {
- //remote load
- info.setState(MatState.NEEDS_LOADING, firstload?false:entry.valid, null);
+ boolean notValid = !info.isValid();
+ if (entry != null && entry.lastUpdate > info.getUpdateTime()
+ && info.getState() != MatState.LOADING) {
+ //trigger a remote load due to the cache being more up to date than the local copy
+ info.setState(MatState.NEEDS_LOADING, notValid?false:entry.valid, null);
loadTime = entry.lastUpdate;
- }
+ }
}
boolean load = info.shouldLoad();
if (load) {
if (!info.isValid()) {
//blocking load
- loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
+ loadGlobalTable(context, group, tableName, globalStore, info, loadTime, true);
} else {
loadAsynch(context, group, tableName, globalStore, info, loadTime);
}
@@ -440,7 +441,7 @@
Callable<Integer> toCall = new Callable<Integer>() {
@Override
public Integer call() throws Exception {
- return loadGlobalTable(context, group, tableName, globalStore, info, loadTime);
+ return loadGlobalTable(context, group, tableName, globalStore, info, loadTime, true);
}
};
FutureTask<Integer> task = new FutureTask<Integer>(toCall);
@@ -449,7 +450,7 @@
private int loadGlobalTable(CommandContext context,
GroupSymbol group, final String tableName,
- TempTableStore globalStore, MatTableInfo info, Long loadTime)
+ TempTableStore globalStore, MatTableInfo info, Long loadTime, boolean useCache)
throws TeiidComponentException, TeiidProcessingException {
LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loading", tableName)); //$NON-NLS-1$
QueryMetadataInterface metadata = context.getMetadata();
@@ -483,9 +484,11 @@
if (distributedCache != null) {
cid = new CacheID(new ParseInfo(), fullName, context.getVdbName(),
context.getVdbVersion(), context.getConnectionID(), context.getUserName());
- CachedResults cr = this.distributedCache.get(cid);
- if (cr != null) {
- ts = cr.getResults().createIndexedTupleSource();
+ if (useCache) {
+ CachedResults cr = this.distributedCache.get(cid);
+ if (cr != null) {
+ ts = cr.getResults().createIndexedTupleSource();
+ }
}
}
Modified: branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-06-27 18:58:27 UTC (rev 3275)
+++ branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-06-27 21:44:19 UTC (rev 3276)
@@ -22,6 +22,9 @@
package org.teiid.jdbc;
import java.io.File;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Properties;
import org.jboss.deployers.spi.DeploymentException;
@@ -31,11 +34,12 @@
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.client.DQP;
import org.teiid.client.security.ILogon;
import org.teiid.deployers.MetadataStoreGroup;
+import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBRepository;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
@@ -48,6 +52,8 @@
import org.teiid.metadata.index.IndexMetadataFactory;
import org.teiid.metadata.index.VDBMetadataFactory;
import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.query.function.metadata.FunctionMethod;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
import org.teiid.services.SessionServiceImpl;
@@ -66,6 +72,10 @@
private ConnectorManagerRepository cmr;
public FakeServer() {
+ this(new DQPConfiguration());
+ }
+
+ public FakeServer(DQPConfiguration config) {
this.logon = new LogonImpl(sessionService, null);
this.repo.setSystemStore(VDBMetadataFactory.getSystem());
@@ -86,9 +96,13 @@
}
});
- DQPConfiguration config = new DQPConfiguration();
config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
- this.dqp.setCacheFactory(new DefaultCacheFactory());
+ this.dqp.setCacheFactory(new DefaultCacheFactory() {
+ @Override
+ public boolean isReplicated() {
+ return true; //pretend to be replicated for matview tests
+ }
+ });
this.dqp.start(config);
this.sessionService.setDqp(this.dqp);
@@ -96,12 +110,29 @@
registerClientService(DQP.class, dqp, null);
}
+ public void stop() {
+ this.dqp.stop();
+ }
+
public void deployVDB(String vdbName, String vdbPath) throws Exception {
-
+ deployVDB(vdbName, vdbPath, null);
+ }
+
+ public void deployVDB(String vdbName, String vdbPath, Map<String, Collection<FunctionMethod>> udfs) throws Exception {
IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(new File(vdbPath).toURI().toURL());
MetadataStore metadata = imf.getMetadataStore(repo.getSystemStore().getDatatypes());
-
- VDBMetaData vdbMetaData = new VDBMetaData();
+ LinkedHashMap<String, Resource> entries = imf.getEntriesPlusVisibilities();
+ deployVDB(vdbName, metadata, entries, udfs);
+ }
+
+ public void deployVDB(String vdbName, MetadataStore metadata,
+ LinkedHashMap<String, Resource> entries) {
+ deployVDB(vdbName, metadata, entries, null);
+ }
+
+ public void deployVDB(String vdbName, MetadataStore metadata,
+ LinkedHashMap<String, Resource> entries, Map<String, Collection<FunctionMethod>> udfs) {
+ VDBMetaData vdbMetaData = new VDBMetaData();
vdbMetaData.setName(vdbName);
vdbMetaData.setStatus(VDB.Status.ACTIVE);
@@ -120,10 +151,17 @@
try {
MetadataStoreGroup stores = new MetadataStoreGroup();
stores.addStore(metadata);
- this.repo.addVDB(vdbMetaData, stores, imf.getEntriesPlusVisibilities(), null, cmr);
+ UDFMetaData udfMetaData = null;
+ if (udfs != null) {
+ udfMetaData = new UDFMetaData();
+ for (Map.Entry<String, Collection<FunctionMethod>> entry : udfs.entrySet()) {
+ udfMetaData.addFunctions(entry.getValue());
+ }
+ }
+ this.repo.addVDB(vdbMetaData, stores, entries, udfMetaData, cmr);
} catch (DeploymentException e) {
throw new RuntimeException(e);
- }
+ }
}
public void removeVDB(String vdbName) {
Modified: branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java
===================================================================
--- branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java 2011-06-27 18:58:27 UTC (rev 3275)
+++ branches/7.1.1.CP3/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViews.java 2011-06-27 21:44:19 UTC (rev 3276)
@@ -22,20 +22,30 @@
package org.teiid.systemmodel;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.FakeServer;
import org.teiid.jdbc.TeiidSQLException;
import org.teiid.metadata.Table;
+import org.teiid.query.function.metadata.FunctionMethod;
+import org.teiid.query.function.metadata.FunctionParameter;
import org.teiid.query.metadata.TransformationMetadata;
@SuppressWarnings("nls")
@@ -44,13 +54,32 @@
private static final String MATVIEWS = "matviews";
private Connection conn;
private FakeServer server;
+
+ private static int count = 0;
+
+ public static int pause() throws InterruptedException {
+ synchronized (TestMatViews.class) {
+ count++;
+ TestMatViews.class.notify();
+ while (count < 2) {
+ TestMatViews.class.wait();
+ }
+ }
+ return 1;
+ }
@Before public void setUp() throws Exception {
server = new FakeServer();
- server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() + "/matviews.vdb");
+ HashMap<String, Collection<FunctionMethod>> udfs = new HashMap<String, Collection<FunctionMethod>>();
+ udfs.put("funcs", Arrays.asList(new FunctionMethod("pause", null, null, FunctionMethod.CANNOT_PUSHDOWN, TestMatViews.class.getName(), "pause", null, new FunctionParameter("return", DataTypeManager.DefaultDataTypes.INTEGER), false, FunctionMethod.NONDETERMINISTIC)));
+ server.deployVDB(MATVIEWS, UnitTestUtil.getTestDataPath() + "/matviews.vdb", udfs);
conn = server.createConnection("jdbc:teiid:matviews");
}
+ @After public void tearDown() throws Exception {
+ server.stop();
+ }
+
@Test public void testSystemMatViewsWithImplicitLoad() throws Exception {
Statement s = conn.createStatement();
ResultSet rs = s.executeQuery("select * from MatViews order by name");
@@ -80,6 +109,34 @@
@Test public void testSystemMatViewsWithExplicitRefresh() throws Exception {
Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ rs = s.executeQuery("select * from MatViews where name = 'RandomView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
+ rs = s.executeQuery("select x from TEST.RANDOMVIEW");
+ assertTrue(rs.next());
+ double key = rs.getDouble(1);
+
+ rs = s.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ rs = s.executeQuery("select * from MatViews where name = 'RandomView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
+ rs = s.executeQuery("select x from TEST.RANDOMVIEW");
+ assertTrue(rs.next());
+ double key1 = rs.getDouble(1);
+
+ //ensure that invalidate with distributed caching works
+ assertTrue(key1 != key);
+ }
+
+ @Test public void testSystemManViewsWithExplictRefreshAndInvalidate() throws Exception {
+ Statement s = conn.createStatement();
ResultSet rs = s.executeQuery("select * from (call refreshMatView('TEST.MATVIEW', false)) p");
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
@@ -87,6 +144,47 @@
assertTrue(rs.next());
assertEquals("LOADED", rs.getString("loadstate"));
assertEquals(true, rs.getBoolean("valid"));
+
+ count = 0;
+
+ VDBMetaData vdb = server.getVDB(MATVIEWS);
+ TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
+ Table tbl = tm.getGroupID("TEST.MATVIEW");
+ tbl.setSelectTransformation("select pause() as x");
+
+ Thread t = new Thread() {
+ public void run() {
+ try {
+ Statement s1 = conn.createStatement();
+ ResultSet rs = s1.executeQuery("select * from (call refreshMatView('TEST.MATVIEW', true)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ } catch (Exception e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ };
+ t.start();
+ synchronized (TestMatViews.class) {
+ while (count < 1) {
+ TestMatViews.class.wait();
+ }
+ }
+ rs = s.executeQuery("select * from MatViews where name = 'MatView'");
+ assertTrue(rs.next());
+ assertEquals("NEEDS_LOADING", rs.getString("loadstate"));
+ assertEquals(false, rs.getBoolean("valid"));
+
+ synchronized (TestMatViews.class) {
+ count++;
+ TestMatViews.class.notify();
+ }
+ t.join();
+
+ rs = s.executeQuery("select * from MatViews where name = 'MatView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
}
@Test(expected=TeiidSQLException.class) public void testSystemMatViewsInvalidView() throws Exception {
@@ -99,14 +197,34 @@
s.execute("call refreshMatView('foo', false)");
}
+ @Test(expected=TeiidSQLException.class) public void testSystemMatViewsWithRowRefreshNotAllowed() throws Exception {
+ Statement s = conn.createStatement();
+ VDBMetaData vdb = server.getVDB(MATVIEWS);
+ TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
+ Table t = tm.getGroupID("TEST.RANDOMVIEW");
+ t.setSelectTransformation("select rand() as x, rand() as y");
+ ResultSet rs = s.executeQuery("select * from (call refreshMatView('TEST.RANDOMVIEW', false)) p");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ rs = s.executeQuery("select * from MatViews where name = 'RandomView'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+ assertEquals(true, rs.getBoolean("valid"));
+ rs = s.executeQuery("select x from TEST.RANDOMVIEW");
+ assertTrue(rs.next());
+ double key = rs.getDouble(1);
+
+ rs = s.executeQuery("select * from (call refreshMatViewRow('TEST.RANDOMVIEW', "+key+")) p");
+ }
+
@Test public void testSystemMatViewsWithRowRefresh() throws Exception {
- //TOOD: remove this. it's a workaround for TEIIDDES-549
+ Statement s = conn.createStatement();
+
VDBMetaData vdb = server.getVDB(MATVIEWS);
TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
Table t = tm.getGroupID("TEST.RANDOMVIEW");
t.setSelectTransformation("/*+ cache(updatable) */ " + t.getSelectTransformation());
- Statement s = conn.createStatement();
//prior to load refresh of a single row returns -1
ResultSet rs = s.executeQuery("select * from (call refreshMatViewRow('TEST.RANDOMVIEW', 0)) p");
assertTrue(rs.next());
13 years, 6 months