Class PhysicalOpRegistry

java.lang.Object
se.liu.ida.hefquin.engine.queryplan.physical.PhysicalOpRegistry

public class PhysicalOpRegistry extends Object
Class used to create physical operators (PhysicalOperator) from logical operators (LogicalOperator) by consulting a registry of factories (PhysicalOpFactory). Factories are queried in the order they were registered. The first factory that supports the operator given the provided input variables is used to create the physical operator. All factories should be registered during initialization. If no registered factory supports the given inputs, the registry throws UnsupportedOperationException.
  • Constructor Details

    • PhysicalOpRegistry

      public PhysicalOpRegistry()
  • Method Details

    • register

      public PhysicalOpRegistry register(PhysicalOpFactory factory)
      Registers a factory at the end of the lookup chain.
      Parameters:
      factory - the factory to add
      Returns:
      this registry (for chaining)
    • create

      public NullaryPhysicalOp create(NullaryLogicalOp lop)
      Creates a physical operator for the given logical operator by consulting registered factories in order. If no registered factory supports the given inputs, an UnsupportedOperationException is thrown.
      Parameters:
      lop - logical operator
      Returns:
      the operator produced by the first supporting factory
      Throws:
      NoSuchElementException - if no factory supports the inputs
    • create

      public UnaryPhysicalOp create(UnaryLogicalOp lop, ExpectedVariables inputVars)
      Creates a physical operator for the given logical operator by consulting registered factories in order. If no registered factory supports the given inputs, an UnsupportedOperationException is thrown.
      Parameters:
      lop - logical operator
      inputVars - expected input variables
      Returns:
      the operator produced by the first supporting factory
      Throws:
      NoSuchElementException - if no factory supports the inputs
    • create

      public BinaryPhysicalOp create(BinaryLogicalOp lop, ExpectedVariables inputVars1, ExpectedVariables inputVars2)
      Creates a physical operator for the given logical operator by consulting registered factories in order. If no registered factory supports the given inputs, an UnsupportedOperationException is thrown.
      Parameters:
      lop - logical operator
      inputVars1 - - the variables that can be expected to be bound in solution mappings that the physical operator will have to process as its left input
      inputVars2 - - the variables that can be expected to be bound in solution mappings that the physical operator will have to process as its right input
      Returns:
      the operator produced by the first supporting factory
      Throws:
      NoSuchElementException - if no factory supports the inputs
    • create

      public NaryPhysicalOp create(NaryLogicalOp lop, ExpectedVariables... inputVars)
      Creates a physical operator for the given logical operator by consulting registered factories in order. If no registered factory supports the given inputs, an UnsupportedOperationException is thrown.
      Parameters:
      lop - logical operator
      inputVars - - the variables that can be expected to be bound in solution mappings that the physical operator will have to process for each of its inputs
      Returns:
      the operator produced by the first supporting factory
      Throws:
      NoSuchElementException - if no factory supports the inputs
    • createAll

      public Set<NullaryPhysicalOp> createAll(NullaryLogicalOp lop)
      Creates all possible physical operators for the given logical operator by consulting all registered factories. If no registered factory supports the given inputs, the returned set is empty.
      Parameters:
      lop - logical operator
      inputVars - expected input variables
      Returns:
      the operators produced by all supporting factories
    • createAll

      public Set<UnaryPhysicalOp> createAll(UnaryLogicalOp lop, ExpectedVariables inputVars)
      Creates all possible physical operators for the given logical operator by consulting all registered factories. If no registered factory supports the given inputs, the returned set is empty.
      Parameters:
      lop - logical operator
      inputVars - expected input variables
      Returns:
      the operators produced by all supporting factories
    • createAll

      public Set<BinaryPhysicalOp> createAll(BinaryLogicalOp lop, ExpectedVariables inputVars1, ExpectedVariables inputVars2)
      Creates all possible physical operators for the given logical operator by consulting all registered factories. If no registered factory supports the given inputs, the returned set is empty.
      Parameters:
      lop - logical operator
      inputVars - expected input variables
      Returns:
      the operators produced by all supporting factories
    • createAll

      public Set<NaryPhysicalOp> createAll(NaryLogicalOp lop, ExpectedVariables... inputVars)
      Creates all possible physical operators for the given logical operator by consulting all registered factories. If no registered factory supports the given inputs, the returned set is empty.
      Parameters:
      lop - logical operator
      inputVars - expected input variables
      Returns:
      the operators produced by all supporting factories