Search in sources :

Example 16 with RequestID

use of org.teiid.dqp.message.RequestID in project teiid by teiid.

the class TestDQPCoreRequestHandling method addRequest.

private RequestID addRequest(DQPCore rm, String sessionId, int executionId) {
    // $NON-NLS-1$
    RequestMessage r0 = new RequestMessage("test command");
    RequestID id = new RequestID(sessionId, executionId);
    addRequest(rm, r0, id, null, null);
    return id;
}
Also used : RequestID(org.teiid.dqp.message.RequestID) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) RequestMessage(org.teiid.client.RequestMessage)

Example 17 with RequestID

use of org.teiid.dqp.message.RequestID in project teiid by teiid.

the class TestDataTierManager method helpSetupRequest.

private AtomicRequestMessage helpSetupRequest(String sql, int nodeId, QueryMetadataInterface metadata) throws Exception {
    DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
    Command command = helpGetCommand(sql, metadata);
    RequestMessage original = new RequestMessage();
    original.setExecutionId(id++);
    original.setPartialResults(true);
    RequestID requestID = workContext.getRequestID(original.getExecutionId());
    context = new CommandContext();
    context.setSession(workContext.getSession());
    // $NON-NLS-1$
    context.setVdbName("test");
    context.setVdbVersion(1);
    context.setQueryProcessorFactory(new QueryProcessorFactoryImpl(dtm.getBufferManager(), dtm, new DefaultCapabilitiesFinder(), null, metadata));
    workItem = TestDQPCoreRequestHandling.addRequest(rm, original, requestID, null, workContext);
    context.setWorkItem(workItem);
    AtomicRequestMessage request = new AtomicRequestMessage(original, workContext, nodeId);
    request.setCommand(command);
    // $NON-NLS-1$
    request.setConnectorName("FakeConnectorID");
    request.setCommandContext(context);
    return request;
}
Also used : RequestID(org.teiid.dqp.message.RequestID) CommandContext(org.teiid.query.util.CommandContext) Command(org.teiid.query.sql.lang.Command) BatchedUpdateCommand(org.teiid.query.sql.lang.BatchedUpdateCommand) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) RequestMessage(org.teiid.client.RequestMessage) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage)

Example 18 with RequestID

use of org.teiid.dqp.message.RequestID in project teiid by teiid.

the class TestMetaDataProcessor method helpGetMetadata.

public Map[] helpGetMetadata(String sql, QueryMetadataInterface metadata, VDBMetaData vdb) throws Exception {
    // Prepare sql
    Command command = QueryParser.getQueryParser().parseCommand(sql);
    QueryResolver.resolveCommand(command, metadata);
    // Create components
    SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0);
    DQPCore requestMgr = new DQPCore();
    requestMgr.setTransactionService(new FakeTransactionService());
    DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
    // Initialize components
    RequestID requestID = workContext.getRequestID(1);
    RequestMessage requestMsg = new RequestMessage(sql);
    TestDQPCoreRequestHandling.addRequest(requestMgr, requestMsg, requestID, command, null);
    MetaDataProcessor mdProc = new MetaDataProcessor(requestMgr, prepPlanCache, "MyVDB", 1);
    return mdProc.processMessage(requestID, workContext, null, true).getColumnMetadata();
}
Also used : RequestID(org.teiid.dqp.message.RequestID) Command(org.teiid.query.sql.lang.Command) DefaultCacheFactory(org.teiid.cache.DefaultCacheFactory) RequestMessage(org.teiid.client.RequestMessage) FakeTransactionService(org.teiid.dqp.internal.datamgr.FakeTransactionService) CacheConfiguration(org.teiid.cache.CacheConfiguration)

Example 19 with RequestID

use of org.teiid.dqp.message.RequestID in project teiid by teiid.

the class TestRequestID method testEquivalence3.

public void testEquivalence3() {
    // $NON-NLS-1$
    RequestID r1 = new RequestID("101", 200);
    // $NON-NLS-1$
    RequestID r2 = new RequestID("100", 200);
    UnitTestUtil.helpTestEquivalence(1, r1, r2);
}
Also used : RequestID(org.teiid.dqp.message.RequestID)

Example 20 with RequestID

use of org.teiid.dqp.message.RequestID in project teiid by teiid.

the class TestRequestID method testEquivalence1.

public void testEquivalence1() {
    // $NON-NLS-1$
    RequestID r1 = new RequestID("100", 200);
    UnitTestUtil.helpTestEquivalence(0, r1, r1);
}
Also used : RequestID(org.teiid.dqp.message.RequestID)

Aggregations

RequestID (org.teiid.dqp.message.RequestID)25 RequestMessage (org.teiid.client.RequestMessage)8 AtomicRequestMessage (org.teiid.dqp.message.AtomicRequestMessage)8 FakeTransactionService (org.teiid.dqp.internal.datamgr.FakeTransactionService)6 RequestMetadata (org.teiid.adminapi.impl.RequestMetadata)4 HashSet (java.util.HashSet)3 TeiidComponentException (org.teiid.core.TeiidComponentException)2 QueryProcessor (org.teiid.query.processor.QueryProcessor)2 Command (org.teiid.query.sql.lang.Command)2 CommandContext (org.teiid.query.util.CommandContext)2 WeakReference (java.lang.ref.WeakReference)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 PreParser (org.teiid.PreParser)1 CacheConfiguration (org.teiid.cache.CacheConfiguration)1 DefaultCacheFactory (org.teiid.cache.DefaultCacheFactory)1 ResultsMessage (org.teiid.client.ResultsMessage)1 PlanNode (org.teiid.client.plan.PlanNode)1 ResultsFuture (org.teiid.client.util.ResultsFuture)1 DQPWorkContext (org.teiid.dqp.internal.process.DQPWorkContext)1