use of org.teiid.common.buffer.impl.BufferManagerImpl in project teiid by teiid.
the class TestGroupingNode method test3.
// Same as test2, but uses processor batch size smaller than number of groups
@Test
public void test3() throws Exception {
BufferManagerImpl mgr = BufferManagerFactory.createBufferManager();
mgr.setProcessorBatchSize(5);
GroupingNode node = getExampleGroupingNode();
// $NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("pid", "test", null, null, 1);
List[] expected = new List[] { Arrays.asList(new Object[] { null, new Integer(1) }), Arrays.asList(new Object[] { new Integer(0), new Integer(1) }), Arrays.asList(new Object[] { new Integer(1), new Integer(1) }), Arrays.asList(new Object[] { new Integer(2), new Integer(2) }), Arrays.asList(new Object[] { new Integer(3), new Integer(1) }), Arrays.asList(new Object[] { new Integer(4), new Integer(2) }), Arrays.asList(new Object[] { new Integer(5), new Integer(1) }), Arrays.asList(new Object[] { new Integer(6), new Integer(2) }) };
helpProcess(mgr, node, context, expected, null);
}
use of org.teiid.common.buffer.impl.BufferManagerImpl in project teiid by teiid.
the class TestJoinNode method testDupRemoveUnderJoin.
@Test
public void testDupRemoveUnderJoin() throws Exception {
// $NON-NLS-1$
String sql = "select a.e1, b.e2 from pm1.g1 as a, (select distinct e1, e2 from pm2.g2) as b";
ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
HardcodedDataManager hdm = new HardcodedDataManager() {
public TupleSource registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException {
final TupleSource source = super.registerRequest(context, command, modelName, parameterObject);
return new TupleSource() {
private int block;
@Override
public List<?> nextTuple() throws TeiidComponentException, TeiidProcessingException {
if (block++ % 2 == 0) {
throw BlockedException.INSTANCE;
}
return source.nextTuple();
}
@Override
public void closeSource() {
source.closeSource();
}
};
}
};
List<?>[] rows = new List<?>[1];
for (int i = 0; i < rows.length; i++) {
rows[i] = Arrays.asList(String.valueOf(i));
}
hdm.addData("SELECT pm1.g1.e1 FROM pm1.g1", rows);
rows = new List<?>[1025];
for (int i = 0; i < rows.length; i++) {
rows[i] = Arrays.asList(String.valueOf(i), i);
}
hdm.addData("SELECT pm2.g2.e1, pm2.g2.e2 FROM pm2.g2", rows);
BufferManagerImpl mgr = BufferManagerFactory.getTestBufferManager(1, 2);
mgr.setTargetBytesPerRow(100);
// $NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("pid", "test", null, null, 1);
List<?>[] results = new List<?>[1025];
for (int i = 0; i < results.length; i++) {
results[i] = Arrays.asList("0", i);
}
TestProcessor.helpProcess(plan, context, hdm, results);
}
use of org.teiid.common.buffer.impl.BufferManagerImpl in project teiid by teiid.
the class TestJoinNode method testPrefetchDistinct.
@Test
public void testPrefetchDistinct() throws Exception {
// $NON-NLS-1$
String sql = "select a.e1, b.e2 from pm1.g1 as a, (select e1, e2 from pm2.g2 union select e1, e2 from pm2.g2) as b";
ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
HardcodedDataManager hdm = new HardcodedDataManager() {
public TupleSource registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException {
final TupleSource source = super.registerRequest(context, command, modelName, parameterObject);
return new TupleSource() {
private int block;
@Override
public List<?> nextTuple() throws TeiidComponentException, TeiidProcessingException {
if (block++ % 2 == 0) {
throw BlockedException.INSTANCE;
}
return source.nextTuple();
}
@Override
public void closeSource() {
source.closeSource();
}
};
}
};
List<?>[] rows = new List<?>[2];
for (int i = 0; i < rows.length; i++) {
rows[i] = Arrays.asList(String.valueOf(i));
}
hdm.addData("SELECT pm1.g1.e1 FROM pm1.g1", rows);
rows = new List<?>[2];
for (int i = 0; i < rows.length; i++) {
rows[i] = Arrays.asList(String.valueOf(i), i);
}
hdm.addData("SELECT pm2.g2.e1, pm2.g2.e2 FROM pm2.g2", rows);
BufferManagerImpl mgr = BufferManagerFactory.getTestBufferManager(1, 2);
mgr.setTargetBytesPerRow(100);
// $NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("pid", "test", null, null, 1);
context.setBufferManager(mgr);
TestProcessor.helpProcess(plan, context, hdm, new List<?>[] { Arrays.asList("0", 0), Arrays.asList("0", 1), Arrays.asList("1", 0), Arrays.asList("1", 1) });
}
use of org.teiid.common.buffer.impl.BufferManagerImpl in project teiid by teiid.
the class TestAggregateProcessing method testArrayAggOrderByPersistence.
@Test
public void testArrayAggOrderByPersistence() throws Exception {
// Create query
// $NON-NLS-1$
String sql = "SELECT array_agg(e2 order by e1) from pm1.g1 group by e3";
// Create expected results
List[] expected = new List[] { Arrays.asList(new ArrayImpl(new Integer[] { 1, 0, 0, 2 })), Arrays.asList(new ArrayImpl(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);
cc.setBufferManager(impl);
// Run query
helpProcess(plan, cc, dataManager, expected);
}
use of org.teiid.common.buffer.impl.BufferManagerImpl in project teiid by teiid.
the class TestEnginePerformance method oneTimeSetup.
@BeforeClass
public static void oneTimeSetup() throws TeiidComponentException {
bm = new BufferManagerImpl();
bm.setMaxProcessingKB(1 << 12);
bm.setMaxReserveKB((1 << 18) - (1 << 16));
bm.setMaxActivePlans(20);
cache = new BufferFrontedFileStoreCache();
cache.setMemoryBufferSpace(1 << 26);
FileStorageManager fsm = new FileStorageManager();
fsm.setStorageDirectory(UnitTestUtil.getTestScratchPath() + "/data");
cache.setStorageManager(fsm);
cache.initialize();
bm.setCache(cache);
bm.initialize();
es = Executors.newCachedThreadPool();
}
Aggregations