teiid SVN: r3265 - in branches/7.4.x/engine/src: main/resources/org/teiid/query and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-23 14:19:58 -0400 (Thu, 23 Jun 2011)
New Revision: 3265
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
Log:
TEIID-1654 ensuring that missing cache entries are not restored
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-06-23 17:31:30 UTC (rev 3264)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-06-23 18:19:58 UTC (rev 3265)
@@ -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: 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-23 17:31:30 UTC (rev 3264)
+++ branches/7.4.x/engine/src/main/resources/org/teiid/query/i18n.properties 2011-06-23 18:19:58 UTC (rev 3265)
@@ -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.
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-06-23 17:31:30 UTC (rev 3264)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-06-23 18:19:58 UTC (rev 3265)
@@ -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));
}
}
13 years, 6 months
teiid SVN: r3264 - branches/7.4.x/build/kits/jboss-container.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-23 13:31:30 -0400 (Thu, 23 Jun 2011)
New Revision: 3264
Modified:
branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
Log:
TEIID-1648 adding a ki
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-23 15:53:01 UTC (rev 3263)
+++ branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2011-06-23 17:31:30 UTC (rev 3264)
@@ -192,7 +192,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>
13 years, 6 months
teiid SVN: r3263 - branches/7.4.x/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-23 11:53:01 -0400 (Thu, 23 Jun 2011)
New Revision: 3263
Modified:
branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1650 adding the importer property importer.useCatalogName
Modified: branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-06-23 15:37:30 UTC (rev 3262)
+++ branches/7.4.x/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-06-23 15:53:01 UTC (rev 3263)
@@ -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>
13 years, 6 months
teiid SVN: r3262 - in branches/7.4.x/client/src: test/java/org/teiid/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-23 11:37:30 -0400 (Thu, 23 Jun 2011)
New Revision: 3262
Modified:
branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java
Log:
TEIID-1640 fix for client query timeout setting
Modified: branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-23 15:19:05 UTC (rev 3261)
+++ branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-23 15:37:30 UTC (rev 3262)
@@ -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
}
Modified: branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-23 15:19:05 UTC (rev 3261)
+++ branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-23 15:37:30 UTC (rev 3262)
@@ -136,4 +136,13 @@
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());
+ }
+
}
13 years, 6 months
teiid SVN: r3261 - in branches/7.4.x: test-integration/common/src/test/java/org/teiid/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-23 11:19:05 -0400 (Thu, 23 Jun 2011)
New Revision: 3261
Modified:
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java
Log:
TEIID-1650 adding the importer property importer.useCatalogName
Modified: branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2011-06-23 12:07:40 UTC (rev 3260)
+++ branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2011-06-23 15:19:05 UTC (rev 3261)
@@ -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: branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java
===================================================================
--- branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java 2011-06-23 12:07:40 UTC (rev 3260)
+++ branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java 2011-06-23 15:19:05 UTC (rev 3261)
@@ -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());
+ }
}
13 years, 6 months
teiid SVN: r3260 - in branches/7.4.x/engine/src: main/java/org/teiid/query/rewriter and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-23 08:07:40 -0400 (Thu, 23 Jun 2011)
New Revision: 3260
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
branches/7.4.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
Log:
TEIID-1645 fix for nested implicit grouping
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java 2011-06-22 22:41:08 UTC (rev 3259)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleAssignOutputElements.java 2011-06-23 12:07:40 UTC (rev 3260)
@@ -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: branches/7.4.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2011-06-22 22:41:08 UTC (rev 3259)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2011-06-23 12:07:40 UTC (rev 3260)
@@ -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: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2011-06-22 22:41:08 UTC (rev 3259)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2011-06-23 12:07:40 UTC (rev 3260)
@@ -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;
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2011-06-22 22:41:08 UTC (rev 3259)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2011-06-23 12:07:40 UTC (rev 3260)
@@ -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 {
13 years, 6 months
teiid SVN: r3259 - branches/7.1.1.CP3/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-06-22 18:41:08 -0400 (Wed, 22 Jun 2011)
New Revision: 3259
Modified:
branches/7.1.1.CP3/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
Log:
SOA-3103 supportsOuterJoins=false was removed, teradata does support this.
Modified: branches/7.1.1.CP3/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
===================================================================
--- branches/7.1.1.CP3/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java 2011-06-22 20:55:12 UTC (rev 3258)
+++ branches/7.1.1.CP3/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java 2011-06-22 22:41:08 UTC (rev 3259)
@@ -56,7 +56,6 @@
protected ConvertModifier convert = new ConvertModifier();
public TeradataExecutionFactory() {
- setSupportsOuterJoins(false);
}
@Override
13 years, 6 months
teiid SVN: r3258 - branches.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-06-22 16:55:12 -0400 (Wed, 22 Jun 2011)
New Revision: 3258
Added:
branches/7.1.1.CP3/
Log:
Branch for 7.1.1 CP3
13 years, 6 months
teiid SVN: r3257 - in branches/7.4.x/engine/src: test/java/org/teiid/dqp/internal/process and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-22 16:23:26 -0400 (Wed, 22 Jun 2011)
New Revision: 3257
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
Log:
TEIID-1647 adding synchronization to prevent lob exception
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-06-18 12:21:26 UTC (rev 3256)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-06-22 20:23:26 UTC (rev 3257)
@@ -445,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$
+ }
}
}
}
@@ -668,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);
@@ -683,7 +685,7 @@
}
public void removeLobStream(int streamRequestId) {
- this.lobStreams.remove(new Integer(streamRequestId));
+ this.lobStreams.remove(streamRequestId);
}
public boolean requestCancel() throws TeiidComponentException {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-06-18 12:21:26 UTC (rev 3256)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-06-22 20:23:26 UTC (rev 3257)
@@ -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);
13 years, 6 months
teiid SVN: r3256 - in branches/7.4.x/client/src: test/java/org/teiid/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-18 08:21:26 -0400 (Sat, 18 Jun 2011)
New Revision: 3256
Modified:
branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java
Log:
TEIID-1641 fix for npe
Modified: branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-18 12:20:53 UTC (rev 3255)
+++ branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-18 12:21:26 UTC (rev 3256)
@@ -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;
@@ -243,24 +243,15 @@
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
@@ -272,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();
@@ -284,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;
@@ -346,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;
}
Modified: branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-18 12:20:53 UTC (rev 3255)
+++ branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-18 12:21:26 UTC (rev 3256)
@@ -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()));
13 years, 6 months