public void closeDirect() { try { plan.close(); } catch (TeiidComponentException e1){ LogManager.logDetail(org.teiid.logging.LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$ } }
public void closeDirect() { try { plan.close(); } catch (TeiidComponentException e1){ LogManager.logDetail(org.teiid.logging.LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$ } }
public void closeDirect() { try { plan.close(); } catch (TeiidComponentException e1){ LogManager.logDetail(org.teiid.logging.LogConstants.CTX_DQP, e1, "Error closing processor"); //$NON-NLS-1$ } }
@Override public TupleBatch nextBatch() throws BlockedException, TeiidComponentException, TeiidProcessingException { while (planIndex < plans.size()) { try { if (!open) { plans.get(planIndex).open(); } plans.get(planIndex).nextBatch(); plans.get(planIndex).close(); } catch (TeiidProcessingException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31214, names.get(planIndex), table)); } catch (BlockedException e) { throw e; } //allow other exception types to bubble up open = false; planIndex++; } TupleBatch batch = new TupleBatch(1, new List<?>[0]); batch.setTerminationFlag(true); return batch; }
@Override public TupleBatch nextBatch() throws BlockedException, TeiidComponentException, TeiidProcessingException { while (planIndex < plans.size()) { try { if (!open) { plans.get(planIndex).open(); } plans.get(planIndex).nextBatch(); plans.get(planIndex).close(); } catch (TeiidProcessingException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31214, names.get(planIndex), table)); } catch (BlockedException e) { throw e; } //allow other exception types to bubble up open = false; planIndex++; } TupleBatch batch = new TupleBatch(1, new List<?>[0]); batch.setTerminationFlag(true); return batch; }
@Override public TupleBatch nextBatch() throws BlockedException, TeiidComponentException, TeiidProcessingException { while (planIndex < plans.size()) { try { if (!open) { plans.get(planIndex).open(); } plans.get(planIndex).nextBatch(); plans.get(planIndex).close(); } catch (TeiidProcessingException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31214, names.get(planIndex), table)); } catch (BlockedException e) { throw e; } //allow other exception types to bubble up open = false; planIndex++; } TupleBatch batch = new TupleBatch(1, new List<?>[0]); batch.setTerminationFlag(true); return batch; }
@Test public void testRollup() throws Exception { String sql = "select e1, sum(e2) from pm1.g1 group by rollup(e1)"; //$NON-NLS-1$ List[] expected = new List[] { Arrays.asList("a", Long.valueOf(3)), Arrays.asList("b", Long.valueOf(1)), Arrays.asList(null, Long.valueOf(4)) }; ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached()); HardcodedDataManager hdm = new HardcodedDataManager(); hdm.addData("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1", Arrays.asList("a", 1), Arrays.asList("a", 2), Arrays.asList("b", 1)); helpProcess(plan, hdm, expected); expected = new List[] { Arrays.asList("a", Long.valueOf(4)), Arrays.asList(null, Long.valueOf(4)) }; plan.close(); plan.reset(); hdm = new HardcodedDataManager(); hdm.addData("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1", Arrays.asList("a", 1), Arrays.asList("a", 3)); helpProcess(plan, hdm, expected); }
@Test public void testRollup2() throws Exception { String sql = "select e1, e2, sum(e4) from pm1.g1 group by rollup(e1, e2)"; //$NON-NLS-1$ List[] expected = new List[] { Arrays.asList("a", 1, 1.0), Arrays.asList("a", 3, 2.0), Arrays.asList("a", null, 3.0), Arrays.asList("b", 2, 3.0), Arrays.asList("b", 4, 4.0), Arrays.asList("b", null, 7.0), Arrays.asList(null, null, 10.0), }; ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached()); HardcodedDataManager hdm = new HardcodedDataManager(); hdm.addData("SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e4 FROM pm1.g1", Arrays.asList("a", 1, 1.0), Arrays.asList("a", 3, 2.0), Arrays.asList("b", 2, 3.0), Arrays.asList("b", 4, 4.0)); helpProcess(plan, hdm, expected); plan.close(); plan.reset(); //an empty rollup should produce no rows hdm = new HardcodedDataManager(); hdm.addData("SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e4 FROM pm1.g1"); helpProcess(plan, hdm, new List<?>[0]); }
/** * 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$ } } }
/** * 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$ } } }
/** * 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$ } } }
/** * @see org.teiid.query.processor.ProcessorPlan#close() * @since 4.2 */ public void close() throws TeiidComponentException { // if the plan opened but the atomic request got cancelled then close the last plan node. TransactionService ts = this.getContext().getTransactionServer(); if (planIndex < updatePlans.length && planOpened[planIndex]) { try { updatePlans[planIndex].close(); } catch (TeiidComponentException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage()); } if (this.planContexts[planIndex] != null) { try { ts.resume(this.planContexts[planIndex]); ts.rollback(this.planContexts[planIndex]); } catch (XATransactionException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage()); } this.planContexts[planIndex] = null; } } }
/** * @see org.teiid.query.processor.ProcessorPlan#close() * @since 4.2 */ public void close() throws TeiidComponentException { // if the plan opened but the atomic request got cancelled then close the last plan node. TransactionService ts = this.getContext().getTransactionServer(); if (planIndex < updatePlans.length && planOpened[planIndex]) { try { updatePlans[planIndex].close(); } catch (TeiidComponentException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage()); } if (this.planContexts[planIndex] != null) { try { ts.resume(this.planContexts[planIndex]); ts.rollback(this.planContexts[planIndex]); } catch (XATransactionException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage()); } this.planContexts[planIndex] = null; } } }
/** * @see org.teiid.query.processor.ProcessorPlan#close() * @since 4.2 */ public void close() throws TeiidComponentException { // if the plan opened but the atomic request got cancelled then close the last plan node. TransactionService ts = this.getContext().getTransactionServer(); if (planIndex < updatePlans.length && planOpened[planIndex]) { try { updatePlans[planIndex].close(); } catch (TeiidComponentException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage()); } if (this.planContexts[planIndex] != null) { try { ts.resume(this.planContexts[planIndex]); ts.rollback(this.planContexts[planIndex]); } catch (XATransactionException e) { LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage()); } this.planContexts[planIndex] = null; } } }
pp.close(); pp.reset();
updatePlans[planIndex].close(); if (this.planContexts[planIndex] != null) { TransactionService ts = this.getContext().getTransactionServer();
updatePlans[planIndex].close(); if (this.planContexts[planIndex] != null) { TransactionService ts = this.getContext().getTransactionServer();
result.getTuples().add(terminationTuple); this.context.getTupleSourceCache().close(); this.processPlan.close(); this.processPlan.reset(); this.context.incrementReuseCount();
result.getTuples().add(terminationTuple); this.context.getTupleSourceCache().close(); this.processPlan.close(); this.processPlan.reset(); this.context.incrementReuseCount();
result.getTuples().add(terminationTuple); this.context.getTupleSourceCache().close(); this.processPlan.close(); this.processPlan.reset(); this.context.incrementReuseCount();