/** * 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; }
/** * 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; }
/** * 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); }