teiid SVN: r4607 - in branches/7.7.x/engine/src: main/java/org/teiid/query/processor/relational and 4 other directories.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2013-10-30 10:48:09 -0400 (Wed, 30 Oct 2013)
New Revision: 4607
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/WindowFunctionProjectNode.java
branches/7.7.x/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java
branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/TestSTree.java
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestQueryProcessor.java
branches/7.7.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
Log:
TEIID-2626: If a column type is not set, null values will be written into persisted batches
Modified: branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -56,6 +56,7 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.DataTypeManager.WeakReferenceHashedValueCache;
import org.teiid.core.types.Streamable;
+import org.teiid.core.util.Assertion;
import org.teiid.dqp.internal.process.DQPConfiguration;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
@@ -510,7 +511,9 @@
Class<?>[] types = new Class[elements.size()];
for (ListIterator<? extends Expression> i = elements.listIterator(); i.hasNext();) {
Expression expr = i.next();
- types[i.previousIndex()] = expr.getType();
+ Class<?> type = expr.getType();
+ Assertion.isNotNull(type);
+ types[i.previousIndex()] = type;
}
return types;
}
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/WindowFunctionProjectNode.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/WindowFunctionProjectNode.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/processor/relational/WindowFunctionProjectNode.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -330,7 +330,7 @@
ElementSymbol key = new ElementSymbol("rowId"); //$NON-NLS-1$
key.setType(DataTypeManager.DefaultDataClasses.INTEGER);
ElementSymbol value = new ElementSymbol("partitionId"); //$NON-NLS-1$
- key.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ value.setType(DataTypeManager.DefaultDataClasses.INTEGER);
List<ElementSymbol> elements = Arrays.asList(key, value);
partitionMapping[specIndex] = this.getBufferManager().createSTree(elements, this.getConnectionID(), 1);
}
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/sql/symbol/ElementSymbol.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -69,9 +69,20 @@
super(name);
}
- public ElementSymbol(String shortName, String shortCanonical, GroupSymbol group) {
- super(shortName, shortCanonical);
+ public ElementSymbol(String shortName, GroupSymbol group) {
+ this(shortName, group, null);
+ }
+
+ public ElementSymbol(String elementName, String canonicalString,
+ GroupSymbol group) {
+ this(elementName,group,null);
+ }
+
+ public ElementSymbol(String shortName, GroupSymbol group, Class<?> type) {
+ super(shortName);
+ this.setShortName(shortName);
this.groupSymbol = group;
+ this.type = type;
}
/**
@@ -83,8 +94,8 @@
super(name);
setDisplayFullyQualified(displayFullyQualified);
}
-
- @Override
+
+ @Override
public String getName() {
if (this.groupSymbol != null) {
return this.groupSymbol.getName() + SingleElementSymbol.SEPARATOR + this.getShortName();
Modified: branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/BufferManagerFactory.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -82,6 +82,7 @@
public static BufferManagerImpl initBufferManager(BufferManagerImpl bufferManager) {
try {
bufferManager.initialize();
+ bufferManager.setUseWeakReferences(false);
MemoryStorageManager storageManager = new MemoryStorageManager();
SplittableStorageManager ssm = new SplittableStorageManager(storageManager);
ssm.setMaxFileSizeDirect(MemoryStorageManager.MAX_FILE_SIZE);
Modified: branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/TestSTree.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/TestSTree.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/test/java/org/teiid/common/buffer/TestSTree.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -140,7 +140,7 @@
ElementSymbol e1 = new ElementSymbol("x");
e1.setType(Integer.class);
ElementSymbol e2 = new ElementSymbol("x");
- e1.setType(Integer.class);
+ e2.setType(Integer.class);
List elements = Arrays.asList(e1, e2);
STree map = bm.createSTree(elements, "1", 2);
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -428,7 +428,6 @@
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);
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -32,6 +32,7 @@
import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.core.types.DataTypeManager;
import org.teiid.query.processor.relational.FakeRelationalNode;
import org.teiid.query.sql.symbol.ElementSymbol;
@@ -46,7 +47,7 @@
Arrays.asList(1)
}, 1));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
- bi.setBuffer(bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x")), "test", TupleSourceType.PROCESSOR), true); //$NON-NLS-1$
+ bi.setBuffer(bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR), true); //$NON-NLS-1$
bi.mark();
bi.nextTuple();
bi.nextTuple();
@@ -61,7 +62,7 @@
Arrays.asList(3)
}, 2));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
- TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x")), "test", TupleSourceType.PROCESSOR);
+ TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR);
bi.setBuffer(tb, true); //$NON-NLS-1$
bi.nextTuple();
bi.mark();
@@ -77,7 +78,7 @@
Arrays.asList(2),
}, 2));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
- TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x")), "test", TupleSourceType.PROCESSOR);
+ TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR);
bi.setBuffer(tb, true); //$NON-NLS-1$
bi.hasNext();
bi.mark();
@@ -96,7 +97,7 @@
Arrays.asList(1),
}, 1));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
- bi.setBuffer(bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x")), "test", TupleSourceType.PROCESSOR), true); //$NON-NLS-1$
+ bi.setBuffer(bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR), true); //$NON-NLS-1$
bi.mark();
assertNotNull(bi.nextTuple());
assertNotNull(bi.nextTuple());
@@ -117,7 +118,7 @@
Arrays.asList(1),
}, 2));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
- TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x")), "test", TupleSourceType.PROCESSOR);
+ TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR);
bi.setBuffer(tb, false); //$NON-NLS-1$
bi.setPosition(2);
assertTrue(bi.hasNext());
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestQueryProcessor.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestQueryProcessor.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/processor/TestQueryProcessor.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -38,6 +38,7 @@
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
+import org.teiid.core.types.DataTypeManager;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.util.CommandContext;
@@ -78,14 +79,14 @@
@Test public void testNoResults() throws Exception {
List elements = new ArrayList();
- elements.add(new ElementSymbol("a")); //$NON-NLS-1$
+ elements.add(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)); //$NON-NLS-1$
FakeProcessorPlan plan = new FakeProcessorPlan(elements, null);
helpTestProcessor(plan, new List[0]);
}
@Test public void testBlockNoResults() throws Exception {
List elements = new ArrayList();
- elements.add(new ElementSymbol("a")); //$NON-NLS-1$
+ elements.add(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)); //$NON-NLS-1$
List batches = new ArrayList();
batches.add(BlockedException.INSTANCE);
@@ -99,7 +100,7 @@
@Test public void testProcessWithOccasionalBlocks() throws Exception {
List elements = new ArrayList();
- elements.add(new ElementSymbol("a")); //$NON-NLS-1$
+ elements.add(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)); //$NON-NLS-1$
HashSet blocked = new HashSet(Arrays.asList(new Integer[] { new Integer(0), new Integer(2), new Integer(7) }));
int numBatches = 10;
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java 2013-10-22 14:52:22 UTC (rev 4606)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java 2013-10-30 14:48:09 UTC (rev 4607)
@@ -364,7 +364,7 @@
// Set grouping elements to null
if (groupBy) {
List groupingElements = new ArrayList();
- groupingElements.add(new ElementSymbol("col1")); //$NON-NLS-1$
+ groupingElements.add(col1.clone()); //$NON-NLS-1$
node.setOrderBy(new OrderBy(groupingElements).getOrderByItems());
}
CommandContext context = new CommandContext("pid", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$