/** * @see java.lang.Object#clone() * @since 4.2 */ public Object clone() { BatchedUpdateNode clonedNode = new BatchedUpdateNode(getID(), updateCommands, contexts, shouldEvaluate, modelName); super.copyTo(clonedNode); return clonedNode; }
/** * @throws TeiidProcessingException * @see org.teiid.query.processor.relational.RelationalNode#nextBatchDirect() * @since 4.2 */ public TupleBatch nextBatchDirect() throws BlockedException, TeiidComponentException, TeiidProcessingException { int numExpectedCounts = updateCommands.size(); for (;commandCount < numExpectedCounts; commandCount++) { // If the command at this index was not executed if (tupleSource == null || unexecutedCommands[commandCount]) { addBatchRow(ZERO_COUNT_TUPLE); } else { // Otherwise, get the next count in the batch List<?> tuple = tupleSource.nextTuple(); if (tuple != null) { // Assumption: the number of returned tuples exactly equals the number of commands submitted addBatchRow(Arrays.asList(new Object[] {tuple.get(0)})); } else { // Should never happen since the number of expected results is known throw new TeiidComponentException(QueryPlugin.Event.TEIID30192, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30192, commandCount, numExpectedCounts)); } } } // This is the only tuple batch we need. terminateBatches(); return pullBatch(); }
CommandContext context = this.getContext(); if (this.contexts != null && !this.contexts.isEmpty()) { context = context.clone(); if(shouldEvaluate != null && shouldEvaluate.get(i)) { updateCommand = (Command) updateCommand.clone(); Evaluator eval = getEvaluator(Collections.emptyMap()); eval.initialize(context, getDataManager()); AccessNode.rewriteAndEvaluate(updateCommand, eval, context, context.getMetadata()); RowBasedSecurityHelper.checkConstraints(command, getEvaluator(Collections.emptyMap())); tupleSource = getDataManager().registerRequest(getContext(), command, modelName, new RegisterRequestParameter(null, getID(), -1));
ProjectNode projectNode = new ProjectNode(idGenerator.nextInt()); BatchedUpdateNode batchNode = new BatchedUpdateNode(idGenerator.nextInt(), batch, contexts, shouldEvaluate, modelName); projectNode.setElements(symbols); batchNode.setElements(symbols);
private BatchedUpdateNode helpGetNode(String[] sql, QueryMetadataInterface md, ProcessorDataManager pdm) throws Exception { List<Command> commands = TestBatchedUpdatePlanner.helpGetCommands(sql, md); List<Boolean> shouldEvaluate = new ArrayList<Boolean>(commands.size()); for (Command command : commands) { shouldEvaluate.add(EvaluatableVisitor.needsProcessingEvaluation(command)); } BatchedUpdateNode node = new BatchedUpdateNode(1, commands, Collections.EMPTY_LIST, shouldEvaluate, "myModelName"); //$NON-NLS-1$ CommandContext context = new CommandContext(); context.setMetadata(md); node.initialize(context, Mockito.mock(BufferManager.class), pdm); return node; }
CommandContext context = this.getContext(); if (this.contexts != null && !this.contexts.isEmpty()) { context = context.clone(); if(shouldEvaluate != null && shouldEvaluate.get(i)) { updateCommand = (Command) updateCommand.clone(); Evaluator eval = getEvaluator(Collections.emptyMap()); eval.initialize(context, getDataManager()); AccessNode.rewriteAndEvaluate(updateCommand, eval, context, context.getMetadata()); RowBasedSecurityHelper.checkConstraints(command, getEvaluator(Collections.emptyMap())); tupleSource = getDataManager().registerRequest(getContext(), command, modelName, new RegisterRequestParameter(null, getID(), -1));
ProjectNode projectNode = new ProjectNode(idGenerator.nextInt()); BatchedUpdateNode batchNode = new BatchedUpdateNode(idGenerator.nextInt(), batch, contexts, shouldEvaluate, modelName); projectNode.setElements(symbols); batchNode.setElements(symbols);
CommandContext context = this.getContext(); if (this.contexts != null && !this.contexts.isEmpty()) { context = context.clone(); if(shouldEvaluate != null && shouldEvaluate.get(i)) { updateCommand = (Command) updateCommand.clone(); Evaluator eval = getEvaluator(Collections.emptyMap()); eval.initialize(context, getDataManager()); AccessNode.rewriteAndEvaluate(updateCommand, eval, context, context.getMetadata()); RowBasedSecurityHelper.checkConstraints(command, getEvaluator(Collections.emptyMap())); tupleSource = getDataManager().registerRequest(getContext(), command, modelName, new RegisterRequestParameter(null, getID(), -1));
/** * @throws TeiidProcessingException * @see org.teiid.query.processor.relational.RelationalNode#nextBatchDirect() * @since 4.2 */ public TupleBatch nextBatchDirect() throws BlockedException, TeiidComponentException, TeiidProcessingException { int numExpectedCounts = updateCommands.size(); for (;commandCount < numExpectedCounts; commandCount++) { // If the command at this index was not executed if (tupleSource == null || unexecutedCommands[commandCount]) { addBatchRow(ZERO_COUNT_TUPLE); } else { // Otherwise, get the next count in the batch List<?> tuple = tupleSource.nextTuple(); if (tuple != null) { // Assumption: the number of returned tuples exactly equals the number of commands submitted addBatchRow(Arrays.asList(new Object[] {tuple.get(0)})); } else { // Should never happen since the number of expected results is known throw new TeiidComponentException(QueryPlugin.Event.TEIID30192, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30192, commandCount, numExpectedCounts)); } } } // This is the only tuple batch we need. terminateBatches(); return pullBatch(); }
/** * @see java.lang.Object#clone() * @since 4.2 */ public Object clone() { BatchedUpdateNode clonedNode = new BatchedUpdateNode(getID(), updateCommands, contexts, shouldEvaluate, modelName); super.copyTo(clonedNode); return clonedNode; }
ProjectNode projectNode = new ProjectNode(idGenerator.nextInt()); BatchedUpdateNode batchNode = new BatchedUpdateNode(idGenerator.nextInt(), batch, contexts, shouldEvaluate, modelName); projectNode.setElements(symbols); batchNode.setElements(symbols);
/** * @throws TeiidProcessingException * @see org.teiid.query.processor.relational.RelationalNode#nextBatchDirect() * @since 4.2 */ public TupleBatch nextBatchDirect() throws BlockedException, TeiidComponentException, TeiidProcessingException { int numExpectedCounts = updateCommands.size(); for (;commandCount < numExpectedCounts; commandCount++) { // If the command at this index was not executed if (tupleSource == null || unexecutedCommands[commandCount]) { addBatchRow(ZERO_COUNT_TUPLE); } else { // Otherwise, get the next count in the batch List<?> tuple = tupleSource.nextTuple(); if (tuple != null) { // Assumption: the number of returned tuples exactly equals the number of commands submitted addBatchRow(Arrays.asList(new Object[] {tuple.get(0)})); } else { // Should never happen since the number of expected results is known throw new TeiidComponentException(QueryPlugin.Event.TEIID30192, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30192, commandCount, numExpectedCounts)); } } } // This is the only tuple batch we need. terminateBatches(); return pullBatch(); }
/** * @see java.lang.Object#clone() * @since 4.2 */ public Object clone() { BatchedUpdateNode clonedNode = new BatchedUpdateNode(getID(), updateCommands, contexts, shouldEvaluate, modelName); super.copyTo(clonedNode); return clonedNode; }