public Object clone(){ ProjectIntoNode clonedNode = new ProjectIntoNode(); super.copyTo(clonedNode); clonedNode.intoGroup = intoGroup; clonedNode.intoElements = intoElements; clonedNode.modelName = this.modelName; clonedNode.mode = this.mode; clonedNode.constraint = this.constraint; clonedNode.sourceHint = this.sourceHint; clonedNode.upsert = this.upsert; return clonedNode; }
private void checkExitConditions() throws TeiidComponentException, BlockedException, TeiidProcessingException { if (tupleSource != null) { if (mode == Mode.BATCH || mode == Mode.ITERATOR) { List<?> tuple = null; while ((tuple = tupleSource.nextTuple()) != null) { Integer count = (Integer)tuple.get(0); if (count > 0 || count == Statement.SUCCESS_NO_INFO) { insertCount++; } } } else { Integer count = (Integer)tupleSource.nextTuple().get(0); insertCount += count.intValue(); } closeRequest(); // Mark as processed tupleSourcesProcessed++; // This should set tupleSourcesProcessed to be the same as requestsRegistered } // RESPONSE_PROCESSING: process tuple sources if (tupleSourcesProcessed < requestsRegistered) { throw BlockedException.block(getContext().getRequestId(), "Blocking on insert update count"); //$NON-NLS-1$ } }
currentBatch = getChildren()[0].nextBatch(); // can throw BlockedException sourceDone = currentBatch.getTerminationFlag(); this.batchRow = currentBatch.getBeginRow(); eval = new Evaluator(createLookupMap(this.intoElements), this.getDataManager(), getContext()); throw new QueryProcessingException(QueryPlugin.Event.TEIID31130, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31130, new Insert(intoGroup, this.intoElements, convertValuesToConstants(tuples.get(i), intoElements)))); checkExitConditions(); case ITERATOR: if (buffer == null) { buffer = getBufferManager().createTupleBuffer(intoElements, getConnectionID(), TupleSourceType.PROCESSOR); checkExitConditions(); checkExitConditions(); } catch (BlockedException e) { registerIteratorRequest(); } else if (buffer.getRowCount() >= buffer.getBatchSize() * 4) { registerIteratorRequest(); } else { requests = 0; convertValuesToConstants(currentBatch.getTuple(rowNum), intoElements)); insert.setSourceHint(sourceHint); insert.setUpsert(upsert); rows.add( insert );
processNode = ipen; } else { ProjectIntoNode pinode = new ProjectIntoNode(getID()); pinode.setIntoGroup(intoGroup); pinode.setIntoElements(allIntoElements); pinode.setModelName(modelName); pinode.setConstraint((Criteria) node.getProperty(Info.CONSTRAINT)); pinode.setSourceHint((SourceHint) node.getProperty(Info.SOURCE_HINT)); if (node.hasBooleanProperty(Info.UPSERT)) { pinode.setUpsert(true); pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.ITERATOR); } else if (caps.supportsCapability(Capability.BATCHED_UPDATES)) { pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.BATCH); } else { pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.SINGLE); pinode.setTransactionSupport((TransactionSupport) caps.getSourceProperty(Capability.TRANSACTION_SUPPORT));
private void helpTestNextBatch(int tupleBatchSize, Mode mode) throws Exception { ProjectIntoNode node = new ProjectIntoNode(2); node.addChild(child); node.setIntoGroup(new GroupSymbol("myGroup")); //$NON-NLS-1$ ElementSymbol elementSymbol_1 = new ElementSymbol("myGroup.myElement1"); //$NON-NLS-1$ ElementSymbol elementSymbol_2 = new ElementSymbol("myGroup.myElement2"); //$NON-NLS-1$ elementSymbol_2.setType(String.class); List<ElementSymbol> elements = Arrays.asList(elementSymbol_1, elementSymbol_2); node.setIntoElements(elements); child.setElements(elements); node.setMode(mode); node.setModelName("myModel"); //$NON-NLS-1$ node.initialize(context, bm, dataManager); node.open(); batch = node.nextBatch(); break; } catch (BlockedException e) {
public void closeDirect() { if (this.buffer != null) { this.buffer.remove(); this.buffer = null; } closeRequest(); }
currentBatch = getChildren()[0].nextBatch(); // can throw BlockedException sourceDone = currentBatch.getTerminationFlag(); this.batchRow = currentBatch.getBeginRow(); eval = new Evaluator(createLookupMap(this.intoElements), this.getDataManager(), getContext()); throw new QueryProcessingException(QueryPlugin.Event.TEIID31130, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31130, new Insert(intoGroup, this.intoElements, convertValuesToConstants(tuples.get(i), intoElements)))); checkExitConditions(); case ITERATOR: if (buffer == null) { buffer = getBufferManager().createTupleBuffer(intoElements, getConnectionID(), TupleSourceType.PROCESSOR); checkExitConditions(); checkExitConditions(); } catch (BlockedException e) { registerIteratorRequest(); } else if (buffer.getRowCount() >= buffer.getBatchSize() * 4) { registerIteratorRequest(); } else { requests = 0; convertValuesToConstants(currentBatch.getTuple(rowNum), intoElements)); insert.setSourceHint(sourceHint); insert.setUpsert(upsert); rows.add( insert );
processNode = ipen; } else { ProjectIntoNode pinode = new ProjectIntoNode(getID()); pinode.setIntoGroup(intoGroup); pinode.setIntoElements(allIntoElements); pinode.setModelName(modelName); pinode.setConstraint((Criteria) node.getProperty(Info.CONSTRAINT)); pinode.setSourceHint((SourceHint) node.getProperty(Info.SOURCE_HINT)); if (node.hasBooleanProperty(Info.UPSERT)) { pinode.setUpsert(true); pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.ITERATOR); } else if (caps.supportsCapability(Capability.BATCHED_UPDATES)) { pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.BATCH); } else { pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.SINGLE); pinode.setTransactionSupport((TransactionSupport) caps.getSourceProperty(Capability.TRANSACTION_SUPPORT));
public void closeDirect() { if (this.buffer != null) { this.buffer.remove(); this.buffer = null; } closeRequest(); }
currentBatch = getChildren()[0].nextBatch(); // can throw BlockedException sourceDone = currentBatch.getTerminationFlag(); this.batchRow = currentBatch.getBeginRow(); eval = new Evaluator(createLookupMap(this.intoElements), this.getDataManager(), getContext()); throw new QueryProcessingException(QueryPlugin.Event.TEIID31130, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31130, new Insert(intoGroup, this.intoElements, convertValuesToConstants(tuples.get(i), intoElements)))); checkExitConditions(); case ITERATOR: if (buffer == null) { buffer = getBufferManager().createTupleBuffer(intoElements, getConnectionID(), TupleSourceType.PROCESSOR); checkExitConditions(); checkExitConditions(); } catch (BlockedException e) { registerIteratorRequest(); } else if (buffer.getRowCount() >= buffer.getBatchSize() * 4) { registerIteratorRequest(); } else { requests = 0; convertValuesToConstants(currentBatch.getTuple(rowNum), intoElements)); insert.setSourceHint(sourceHint); insert.setUpsert(upsert); rows.add( insert );
processNode = ipen; } else { ProjectIntoNode pinode = new ProjectIntoNode(getID()); pinode.setIntoGroup(intoGroup); pinode.setIntoElements(allIntoElements); pinode.setModelName(modelName); pinode.setConstraint((Criteria) node.getProperty(Info.CONSTRAINT)); pinode.setSourceHint((SourceHint) node.getProperty(Info.SOURCE_HINT)); if (node.hasBooleanProperty(Info.UPSERT)) { pinode.setUpsert(true); pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.ITERATOR); } else if (caps.supportsCapability(Capability.BATCHED_UPDATES)) { pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.BATCH); } else { pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.SINGLE); pinode.setTransactionSupport((TransactionSupport) caps.getSourceProperty(Capability.TRANSACTION_SUPPORT));
private void checkExitConditions() throws TeiidComponentException, BlockedException, TeiidProcessingException { if (tupleSource != null) { if (mode == Mode.BATCH || mode == Mode.ITERATOR) { List<?> tuple = null; while ((tuple = tupleSource.nextTuple()) != null) { Integer count = (Integer)tuple.get(0); if (count > 0 || count == Statement.SUCCESS_NO_INFO) { insertCount++; } } } else { Integer count = (Integer)tupleSource.nextTuple().get(0); insertCount += count.intValue(); } closeRequest(); // Mark as processed tupleSourcesProcessed++; // This should set tupleSourcesProcessed to be the same as requestsRegistered } // RESPONSE_PROCESSING: process tuple sources if (tupleSourcesProcessed < requestsRegistered) { throw BlockedException.block(getContext().getRequestId(), "Blocking on insert update count"); //$NON-NLS-1$ } }
public Object clone(){ ProjectIntoNode clonedNode = new ProjectIntoNode(); super.copyTo(clonedNode); clonedNode.intoGroup = intoGroup; clonedNode.intoElements = intoElements; clonedNode.modelName = this.modelName; clonedNode.mode = this.mode; clonedNode.constraint = this.constraint; clonedNode.sourceHint = this.sourceHint; clonedNode.upsert = this.upsert; return clonedNode; }
public void closeDirect() { if (this.buffer != null) { this.buffer.remove(); this.buffer = null; } closeRequest(); }
private void checkExitConditions() throws TeiidComponentException, BlockedException, TeiidProcessingException { if (tupleSource != null) { if (mode == Mode.BATCH || mode == Mode.ITERATOR) { List<?> tuple = null; while ((tuple = tupleSource.nextTuple()) != null) { Integer count = (Integer)tuple.get(0); if (count > 0 || count == Statement.SUCCESS_NO_INFO) { insertCount++; } } } else { Integer count = (Integer)tupleSource.nextTuple().get(0); insertCount += count.intValue(); } closeRequest(); // Mark as processed tupleSourcesProcessed++; // This should set tupleSourcesProcessed to be the same as requestsRegistered } // RESPONSE_PROCESSING: process tuple sources if (tupleSourcesProcessed < requestsRegistered) { throw BlockedException.block(getContext().getRequestId(), "Blocking on insert update count"); //$NON-NLS-1$ } }
public Object clone(){ ProjectIntoNode clonedNode = new ProjectIntoNode(); super.copyTo(clonedNode); clonedNode.intoGroup = intoGroup; clonedNode.intoElements = intoElements; clonedNode.modelName = this.modelName; clonedNode.mode = this.mode; clonedNode.constraint = this.constraint; clonedNode.sourceHint = this.sourceHint; clonedNode.upsert = this.upsert; return clonedNode; }