Package org.teiid.query.optimizer
Class BatchedUpdatePlanner
- java.lang.Object
-
- org.teiid.query.optimizer.BatchedUpdatePlanner
-
- All Implemented Interfaces:
CommandPlanner
public class BatchedUpdatePlanner extends Object implements CommandPlanner
Planner for BatchedUpdateCommands- Since:
- 4.2
-
-
Constructor Summary
Constructors Constructor Description BatchedUpdatePlanner()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GroupSymbol
getUpdatedGroup(Command command)
Get the group being updated by the update commandstatic boolean
isEligibleForBatching(Command command, QueryMetadataInterface metadata)
Returns whether a command can be placed in a connector batchProcessorPlan
optimize(Command command, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
Optimizes batched updates by batching all contiguous commands that relate to the same physical model.
-
-
-
Method Detail
-
optimize
public ProcessorPlan optimize(Command command, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context) throws QueryPlannerException, QueryMetadataException, TeiidComponentException
Optimizes batched updates by batching all contiguous commands that relate to the same physical model. For example, for the following batch of commands:
- 1. INSERT INTO physicalModel.myPhysical ...
- 2. UPDATE physicalModel.myPhysical ...
- 3. DELETE FROM virtualmodel.myVirtual ...
- 4. UPDATE virtualmodel.myVirtual ...
- 5. UPDATE physicalModel.myOtherPhysical ...
- 6. INSERT INTO physicalModel.myOtherPhysical ...
- 7. DELETE FROM physicalModel.myOtherPhysical ...
- 8. INSERT INTO physicalModel.myPhysical ...
- 9. INSERT INTO physicalModel.myPhysical ...
- 10. INSERT INTO physicalModel.myPhysical ...
- 11. INSERT INTO physicalModel.myPhysical ...
- 12. INSERT INTO physicalModel.myPhysical ...
this implementation will batch as follows: (1,2), (5, 6, 7), (8 thru 12). The remaining commands/plans will be executed individually.- Specified by:
optimize
in interfaceCommandPlanner
- Parameters:
command
- TODOmetadata
- source of metadatacapFinder
- Class usable to find the connector capabilities for a particular model- Returns:
- ProcessorPlan implementation specific to the CommandPlanner
- Throws:
QueryPlannerException
- indicating a problem in planningQueryMetadataException
- indicating an exception in accessing the metadataTeiidComponentException
- indicating an unexpected exception- Since:
- 4.2
- See Also:
CommandPlanner.optimize(Command, org.teiid.core.id.IDGenerator, org.teiid.query.metadata.QueryMetadataInterface, org.teiid.query.optimizer.capabilities.CapabilitiesFinder, org.teiid.query.analysis.AnalysisRecord, CommandContext)
-
getUpdatedGroup
public static GroupSymbol getUpdatedGroup(Command command)
Get the group being updated by the update command- Parameters:
command
- an INSERT, UPDATE, DELETE or SELECT INTO command- Returns:
- the group being updated
- Since:
- 4.2
-
isEligibleForBatching
public static boolean isEligibleForBatching(Command command, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException
Returns whether a command can be placed in a connector batch- Parameters:
command
- an update commandmetadata
-- Returns:
- true if this command can be added to a batch; false otherwise
- Throws:
QueryMetadataException
TeiidComponentException
- Since:
- 4.2
-
-