com.metamatrix.query.optimizer.batch
Class BatchedUpdatePlanner

java.lang.Object
  extended by com.metamatrix.query.optimizer.batch.BatchedUpdatePlanner
All Implemented Interfaces:
CommandPlanner

public class BatchedUpdatePlanner
extends java.lang.Object
implements CommandPlanner

Planner for BatchedUpdateCommands

Since:
4.2

Constructor Summary
BatchedUpdatePlanner()
           
 
Method Summary
 void generateCanonical(CommandTreeNode rootNode, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
          Requests that the planner generate the canonical plan(s) for the Command object(s) represented by the CommandTreeNode tree parameter.
 ProcessorPlan optimize(CommandTreeNode node, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchedUpdatePlanner

public BatchedUpdatePlanner()
Method Detail

generateCanonical

public void generateCanonical(CommandTreeNode rootNode,
                              QueryMetadataInterface metadata,
                              AnalysisRecord analysisRecord,
                              CommandContext context)
                       throws QueryPlannerException,
                              QueryMetadataException,
                              MetaMatrixComponentException
Description copied from interface: CommandPlanner

Requests that the planner generate the canonical plan(s) for the Command object(s) represented by the CommandTreeNode tree parameter. The canonical plan(s) should be added to the node(s) of the tree rooted at rootNode.

It may or may not make sense for a specific implementation of this Class to create a canonical plan. It may be that all planning can be done during the call to CommandPlanner.optimize(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, com.metamatrix.query.util.CommandContext)

Specified by:
generateCanonical in interface CommandPlanner
Parameters:
rootNode - tree of CommandTreeNode object(s) rooted at rootNode
Throws:
QueryPlannerException - indicating a problem in planning
MetaMatrixComponentException - indicating an unexpected exception
QueryMetadataException
Since:
4.2
See Also:
CommandPlanner.generateCanonical(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)

optimize

public ProcessorPlan optimize(CommandTreeNode node,
                              IDGenerator idGenerator,
                              QueryMetadataInterface metadata,
                              CapabilitiesFinder capFinder,
                              AnalysisRecord analysisRecord,
                              CommandContext context)
                       throws QueryPlannerException,
                              QueryMetadataException,
                              MetaMatrixComponentException
Optimizes batched updates by batching all contiguous commands that relate to the same physical model. For example, for the following batch of commands:
  1. 1. INSERT INTO physicalModel.myPhysical ...
  2. 2. UPDATE physicalModel.myPhysical ...
  3. 3. DELETE FROM virtualmodel.myVirtual ...
  4. 4. UPDATE virtualmodel.myVirtual ...
  5. 5. UPDATE physicalModel.myOtherPhysical ...
  6. 6. INSERT INTO physicalModel.myOtherPhysical ...
  7. 7. DELETE FROM physicalModel.myOtherPhysical ...
  8. 8. INSERT INTO physicalModel.myPhysical ...
  9. 9. INSERT INTO physicalModel.myPhysical ...
  10. 10. INSERT INTO physicalModel.myPhysical ...
  11. 11. INSERT INTO physicalModel.myPhysical ...
  12. 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 interface CommandPlanner
Parameters:
node - root of a tree (or subtree) of CommandTreeNode objects, each of which should have its canonical plan
metadata - source of metadata
capFinder - Class usable to find the connector capabilities for a particular model
Returns:
ProcessorPlan implementation specific to the CommandPlanner
Throws:
QueryPlannerException - indicating a problem in planning
QueryMetadataException - indicating an exception in accessing the metadata
MetaMatrixComponentException - indicating an unexpected exception
Since:
4.2
See Also:
CommandPlanner.optimize(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, CommandContext)


Copyright © 2009. All Rights Reserved.