private void createProcessor() throws TeiidComponentException { if (this.userCommand instanceof CreateProcedureCommand && this.processPlan instanceof ProcedurePlan) { ((ProcedurePlan)this.processPlan).setValidateAccess(true); } this.context.setTransactionContext(getTransactionContext(true)); this.processor = new QueryProcessor(processPlan, context, bufferManager, processorDataManager); }
private void createProcessor() throws TeiidComponentException { if (this.userCommand instanceof CreateProcedureCommand && this.processPlan instanceof ProcedurePlan) { ((ProcedurePlan)this.processPlan).setValidateAccess(true); } this.context.setTransactionContext(getTransactionContext(true)); this.processor = new QueryProcessor(processPlan, context, bufferManager, processorDataManager); }
private void createProcessor() throws TeiidComponentException { if (this.userCommand instanceof CreateProcedureCommand && this.processPlan instanceof ProcedurePlan) { ((ProcedurePlan)this.processPlan).setValidateAccess(true); } this.context.setTransactionContext(getTransactionContext(true)); this.processor = new QueryProcessor(processPlan, context, bufferManager, processorDataManager); }
public RelationalPlanExecutor (ResultSetInfo resultInfo, CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) { this.resultInfo = resultInfo; this.bufferMgr = bufferMgr; this.dataManager = dataMgr; ProcessorPlan plan = resultInfo.getPlan(); CommandContext subContext = context.clone(); subContext.pushVariableContext(new VariableContext()); this.internalProcessor = new QueryProcessor(plan, subContext, bufferMgr, dataMgr); }
@Override public QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext, Object... params) throws TeiidProcessingException, TeiidComponentException { CommandContext copy = commandContext.clone(); copy.resetDeterminismLevel(true); copy.setDataObjects(null); QueryMetadataInterface metadata = commandContext.getMetadata(); if (metadata == null) { metadata = defaultMetadata; } PreparedPlan pp = getPreparedPlan(query, recursionGroup, copy, metadata); copy.pushVariableContext(new VariableContext()); PreparedStatementRequest.resolveParameterValues(pp.getReferences(), Arrays.asList(params), copy, metadata); return new QueryProcessor(pp.getPlan().clone(), copy, bufferMgr, dataMgr); }
@Override public QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext, Object... params) throws TeiidProcessingException, TeiidComponentException { CommandContext copy = commandContext.clone(); copy.resetDeterminismLevel(true); copy.setDataObjects(null); QueryMetadataInterface metadata = commandContext.getMetadata(); if (metadata == null) { metadata = defaultMetadata; } PreparedPlan pp = getPreparedPlan(query, recursionGroup, copy, metadata); copy.pushVariableContext(new VariableContext()); PreparedStatementRequest.resolveParameterValues(pp.getReferences(), Arrays.asList(params), copy, metadata); return new QueryProcessor(pp.getPlan().clone(), copy, bufferMgr, dataMgr); }
@Override public QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext, Object... params) throws TeiidProcessingException, TeiidComponentException { CommandContext copy = commandContext.clone(); copy.resetDeterminismLevel(true); copy.setDataObjects(null); QueryMetadataInterface metadata = commandContext.getMetadata(); if (metadata == null) { metadata = defaultMetadata; } PreparedPlan pp = getPreparedPlan(query, recursionGroup, copy, metadata); copy.pushVariableContext(new VariableContext()); PreparedStatementRequest.resolveParameterValues(pp.getReferences(), Arrays.asList(params), copy, metadata); return new QueryProcessor(pp.getPlan().clone(), copy, bufferMgr, dataMgr); }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && queryPlan != null && !Boolean.FALSE.equals(queryPlan.requiresTransaction(false))) { //start a transaction - if not each of the row plans will //be executed in it's own transaction, which is bad for performance //TODO: should probably allow non-atomic row plans //the parser accepts a trigger block without atomic //but the spec mandates it - and we treat it as atomic //either way //TODO: for non-transactional environments this will //trigger an error this.getContext().getTransactionServer().begin(tc); this.planContext = tc; } if (queryPlan != null) { queryProcessor = new QueryProcessor(queryPlan, getContext().clone(), this.bufferMgr, this.dataMgr); tupleSource = new BatchCollector.BatchProducerTupleSource(queryProcessor); } }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && queryPlan != null && !Boolean.FALSE.equals(queryPlan.requiresTransaction(false))) { //start a transaction - if not each of the row plans will //be executed in it's own transaction, which is bad for performance //TODO: should probably allow non-atomic row plans //the parser accepts a trigger block without atomic //but the spec mandates it - and we treat it as atomic //either way //TODO: for non-transactional environments this will //trigger an error this.getContext().getTransactionServer().begin(tc); this.planContext = tc; } if (queryPlan != null) { queryProcessor = new QueryProcessor(queryPlan, getContext().clone(), this.bufferMgr, this.dataMgr); batchCollector = queryProcessor.createBatchCollector(); } }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && queryPlan != null && !Boolean.FALSE.equals(queryPlan.requiresTransaction(false))) { //start a transaction - if not each of the row plans will //be executed in it's own transaction, which is bad for performance //TODO: should probably allow non-atomic row plans //the parser accepts a trigger block without atomic //but the spec mandates it - and we treat it as atomic //either way //TODO: for non-transactional environments this will //trigger an error this.getContext().getTransactionServer().begin(tc); this.planContext = tc; } if (queryPlan != null) { queryProcessor = new QueryProcessor(queryPlan, getContext().clone(), this.bufferMgr, this.dataMgr); batchCollector = queryProcessor.createBatchCollector(); } }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { if (with != null && tempTableStore.getProcessors() == null) { HashMap<String, TableProcessor> processors = new HashMap<String, TableProcessor>(); tempTableStore.setProcessors(processors); for (WithQueryCommand withCommand : this.with) { if (withCommand.isRecursive()) { SetQuery setQuery = (SetQuery)withCommand.getCommand(); ProcessorPlan initial = setQuery.getLeftQuery().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(initial, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new RecursiveTableProcessor(withProcessor, withCommand.getColumns(), setQuery.getRightQuery().getProcessorPlan(), setQuery.isAll())); continue; } ProcessorPlan plan = withCommand.getCommand().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(plan, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new TableProcessor(withProcessor, withCommand.getColumns())); } } this.root.open(); }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { if (with != null && tempTableStore.getProcessors() == null) { HashMap<String, TableProcessor> processors = new HashMap<String, TableProcessor>(); tempTableStore.setProcessors(processors); for (WithQueryCommand withCommand : this.with) { if (withCommand.isRecursive()) { SetQuery setQuery = (SetQuery)withCommand.getCommand(); ProcessorPlan initial = setQuery.getLeftQuery().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(initial, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new RecursiveTableProcessor(withProcessor, withCommand.getColumns(), setQuery.getRightQuery().getProcessorPlan(), setQuery.isAll())); continue; } ProcessorPlan plan = withCommand.getCommand().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(plan, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new TableProcessor(withProcessor, withCommand.getColumns())); } } this.root.open(); }
@Test public void testCloseBeforeInitialization() throws TeiidComponentException { BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager(); FakeDataManager dataManager = new FakeDataManager(); CommandContext context = new CommandContext("pid", "group", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$ QueryProcessor processor = new QueryProcessor(null, context, bufferMgr, dataManager); processor.closeProcessing(); }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { if (with != null && tempTableStore.getProcessors() == null) { HashMap<String, TableProcessor> processors = new HashMap<String, TableProcessor>(); tempTableStore.setProcessors(processors); for (WithQueryCommand withCommand : this.with) { if (withCommand.isRecursive()) { SetQuery setQuery = (SetQuery)withCommand.getCommand(); ProcessorPlan initial = setQuery.getLeftQuery().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(initial, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new RecursiveTableProcessor(withProcessor, withCommand.getColumns(), setQuery.getRightQuery().getProcessorPlan(), setQuery.isAll())); continue; } ProcessorPlan plan = withCommand.getCommand().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(plan, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new TableProcessor(withProcessor, withCommand.getColumns())); } } this.root.open(); }
private void helpProcessException(ProcessorPlan plan, ProcessorDataManager dataManager, String expectedErrorMessage) { TupleBuffer tsId = null; BufferManager bufferMgr = null; try { bufferMgr = BufferManagerFactory.getStandaloneBufferManager(); CommandContext context = new CommandContext("0", "test", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$ QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager); processor.setNonBlocking(true); BatchCollector collector = processor.createBatchCollector(); tsId = collector.collectTuples(); fail("Expected error during processing, but got none."); //$NON-NLS-1$ } catch(TeiidException e) { // ignore - this is expected if(expectedErrorMessage != null) { assertEquals(expectedErrorMessage, e.getMessage()); } } finally { if (tsId != null) { tsId.remove(); } } }
public void helpTestProcessor(FakeProcessorPlan plan, List[] expectedResults) throws TeiidException { BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager(); FakeDataManager dataManager = new FakeDataManager(); CommandContext context = new CommandContext("pid", "group", null, null, 1); //$NON-NLS-1$ //$NON-NLS-2$ QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager); BatchCollector collector = processor.createBatchCollector(); TupleBuffer tsID = null; while(true) { try { tsID = collector.collectTuples(); break; } catch(BlockedException e) { } } // Compare # of rows in actual and expected assertEquals("Did not get expected # of rows", expectedResults.length, tsID.getRowCount()); //$NON-NLS-1$ // Compare actual with expected results TupleSource actual = tsID.createIndexedTupleSource(); if(expectedResults.length > 0) { for(int i=0; i<expectedResults.length; i++) { List actRecord = actual.nextTuple(); List expRecord = expectedResults[i]; assertEquals("Did not match row at row index " + i, expRecord, actRecord); //$NON-NLS-1$ } } tsID.remove(); }
if (workingQp == null) { recursive.reset(); workingQp = new QueryProcessor(recursive, this.queryProcessor.getContext().clone(), this.queryProcessor.getBufferManager(), this.queryProcessor.getProcessorDataManager()); this.iterator = new BatchProducerTupleSource(workingQp);
if (workingQp == null) { recursive.reset(); workingQp = new QueryProcessor(recursive, this.queryProcessor.getContext().clone(), this.queryProcessor.getBufferManager(), this.queryProcessor.getProcessorDataManager()); this.iterator = new BatchProducerTupleSource(workingQp);
if (workingQp == null) { recursive.reset(); workingQp = new QueryProcessor(recursive, this.queryProcessor.getContext().clone(), this.queryProcessor.getBufferManager(), this.queryProcessor.getProcessorDataManager()); this.iterator = new BatchProducerTupleSource(workingQp);
long rowCount = 0; try { QueryProcessor processor = new QueryProcessor(plan, context, bufferMgr, dataManager);