/** * Construct a processor with all necessary information to process. * @param plan The plan to process * @param context The context that this plan is being processed in. * <b>Should be cloned from the parent to properly scope the tuplebuffer cache</b> * @param bufferMgr The buffer manager that provides access to tuple sources * @param dataMgr The data manager that provides access to get data * @throws TeiidComponentException */ public QueryProcessor(ProcessorPlan plan, CommandContext context, BufferManager bufferMgr, final ProcessorDataManager dataMgr) { this.context = context; this.context.setTupleSourceCache(new TupleSourceCache()); this.dataMgr = dataMgr; this.processPlan = plan; this.bufferMgr = bufferMgr; }
@Test public void testNodeId() throws Exception { TupleSourceCache tsc = new TupleSourceCache(); HardcodedDataManager pdm = new HardcodedDataManager() { @Override public TupleSource registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException { assertEquals(1, parameterObject.nodeID); return Mockito.mock(TupleSource.class); } }; CommandContext context = TestProcessor.createCommandContext(); BufferManagerImpl bufferMgr = BufferManagerFactory.createBufferManager(); Command command = new Insert(); RegisterRequestParameter parameterObject = new RegisterRequestParameter("z", 1, 1); parameterObject.info = new RegisterRequestParameter.SharedAccessInfo(); tsc.getSharedTupleSource(context, command, "x", parameterObject, bufferMgr, pdm); }
public TupleSource registerRequest( CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException, TeiidProcessingException { if (parameterObject.info != null) { TupleSourceCache tsc = context.getTupleSourceCache(); if (tsc != null) { return tsc.getSharedTupleSource(context, command, modelName, parameterObject, bufferManager, this); } } TempTableStore tempTableStore = context.getTempTableStore(); if(tempTableStore != null) { try { TupleSource result = registerRequest(context, modelName, command); if (result != null) { return result; } } catch (BlockedException e) { throw new AssertionError("blocked is not expected"); //$NON-NLS-1$ } } return this.processorDataManager.registerRequest(context, command, modelName, parameterObject); }
/** * Close processing and clean everything up. Should only be called by the same thread that called process. */ public void closeProcessing() { if (processorClosed) { return; } if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_DQP, "QueryProcessor: closing processor"); //$NON-NLS-1$ } this.context.getTupleSourceCache().close(); this.bufferMgr.releaseBuffers(reserved); reserved = 0; processorClosed = true; if (initialized) { try { processPlan.close(); } catch (TeiidComponentException e1){ LogManager.logDetail(LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$ } } }
public TupleSource registerRequest( CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException, TeiidProcessingException { if (parameterObject.info != null) { TupleSourceCache tsc = context.getTupleSourceCache(); if (tsc != null) { return tsc.getSharedTupleSource(context, command, modelName, parameterObject, bufferManager, this); } } TempTableStore tempTableStore = context.getTempTableStore(); if(tempTableStore != null) { try { TupleSource result = registerRequest(context, modelName, command); if (result != null) { return result; } } catch (BlockedException e) { throw new AssertionError("blocked is not expected"); //$NON-NLS-1$ } } return this.processorDataManager.registerRequest(context, command, modelName, parameterObject); }
/** * Close processing and clean everything up. Should only be called by the same thread that called process. */ public void closeProcessing() { if (processorClosed) { return; } if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_DQP, "QueryProcessor: closing processor"); //$NON-NLS-1$ } this.context.getTupleSourceCache().close(); this.bufferMgr.releaseBuffers(reserved); reserved = 0; processorClosed = true; if (initialized) { try { processPlan.close(); } catch (TeiidComponentException e1){ LogManager.logDetail(LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$ } } }
/** * Construct a processor with all necessary information to process. * @param plan The plan to process * @param context The context that this plan is being processed in. * <b>Should be cloned from the parent to properly scope the tuplebuffer cache</b> * @param bufferMgr The buffer manager that provides access to tuple sources * @param dataMgr The data manager that provides access to get data * @throws TeiidComponentException */ public QueryProcessor(ProcessorPlan plan, CommandContext context, BufferManager bufferMgr, final ProcessorDataManager dataMgr) { this.context = context; this.context.setTupleSourceCache(new TupleSourceCache()); this.dataMgr = dataMgr; this.processPlan = plan; this.bufferMgr = bufferMgr; }
public TupleSource registerRequest( CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException, TeiidProcessingException { if (parameterObject.info != null) { TupleSourceCache tsc = context.getTupleSourceCache(); if (tsc != null) { return tsc.getSharedTupleSource(context, command, modelName, parameterObject, bufferManager, this); } } TempTableStore tempTableStore = context.getTempTableStore(); if(tempTableStore != null) { try { TupleSource result = registerRequest(context, modelName, command); if (result != null) { return result; } } catch (BlockedException e) { throw new AssertionError("blocked is not expected"); //$NON-NLS-1$ } } return this.processorDataManager.registerRequest(context, command, modelName, parameterObject); }
/** * Close processing and clean everything up. Should only be called by the same thread that called process. */ public void closeProcessing() { if (processorClosed) { return; } if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_DQP, "QueryProcessor: closing processor"); //$NON-NLS-1$ } this.context.getTupleSourceCache().close(); this.bufferMgr.releaseBuffers(reserved); reserved = 0; processorClosed = true; if (initialized) { try { processPlan.close(); } catch (TeiidComponentException e1){ LogManager.logDetail(LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$ } } }
/** * Construct a processor with all necessary information to process. * @param plan The plan to process * @param context The context that this plan is being processed in. * <b>Should be cloned from the parent to properly scope the tuplebuffer cache</b> * @param bufferMgr The buffer manager that provides access to tuple sources * @param dataMgr The data manager that provides access to get data * @throws TeiidComponentException */ public QueryProcessor(ProcessorPlan plan, CommandContext context, BufferManager bufferMgr, final ProcessorDataManager dataMgr) { this.context = context; this.context.setTupleSourceCache(new TupleSourceCache()); this.dataMgr = dataMgr; this.processPlan = plan; this.bufferMgr = bufferMgr; }
List<Object> terminationTuple = Arrays.asList(new Object[this.getOutputElements().size()]); result.getTuples().add(terminationTuple); this.context.getTupleSourceCache().close(); this.processPlan.close(); this.processPlan.reset();
List<Object> terminationTuple = Arrays.asList(new Object[this.getOutputElements().size()]); result.getTuples().add(terminationTuple); this.context.getTupleSourceCache().close(); this.processPlan.close(); this.processPlan.reset();
List<Object> terminationTuple = Arrays.asList(new Object[this.getOutputElements().size()]); result.getTuples().add(terminationTuple); this.context.getTupleSourceCache().close(); this.processPlan.close(); this.processPlan.reset();