Class TransformPromoteTableEmpty
- java.lang.Object
-
- org.apache.jena.sparql.algebra.TransformCopy
-
- org.apache.jena.sparql.algebra.optimize.TransformPromoteTableEmpty
-
- All Implemented Interfaces:
Transform
public class TransformPromoteTableEmpty extends TransformCopy
Optimizer that ensures that table empty is promoted as high up a query as is possibletable empty is an operator that may be introduced into the algebra by other optimizations and represents the case where the optimizer can a priori determine that some portion of a query will produce no results. The classic example of this are
FILTERclauses that may be determined to always return false and thus negate the need to evaluate their inner operations.Other optimizers introduce table empty at the point in the query where they are optimizing, often its presence in a query may render a larger portion of even the entire query superfluous so this optimizer is designed to promote it up through the query as necessary.
As detailed below this is not guaranteed to eliminate all portions of a query rather it aims to eliminate portions where not doing so can cause expensive and unnecessary evaluation to happen e.g. evaluating the left hand side of a join (which may itself be a deeply nested operator) only to join it with table empty and thus discard all the work that had been done.
Table Empty Promotions
The optimizer makes the following promotions:
- Graph over table empty => table empty
- Assign/Extend over table empty => table empty
- Join where either side is table empty => table empty
- Left Join:
- If LHS is table empty => table empty
- If RHS is table empty => LHS
- Union:
- If both sides are table empty => table empty
- If one side is table empty => other side
- Minus:
- If LHS is table empty => table empty
- If RHS is table empty => LHS
All other operators are left untouched either because it cannot be promoted through them or because doing so has no clear benefit since applying them over table empty should be minimal work anyway.
-
-
Field Summary
-
Fields inherited from class org.apache.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
-
-
Constructor Summary
Constructors Constructor Description TransformPromoteTableEmpty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optransform(OpAssign opAssign, Op subOp)Optransform(OpExtend opExtend, Op subOp)Optransform(OpGraph opGraph, Op subOp)Optransform(OpJoin opJoin, Op left, Op right)Optransform(OpLeftJoin opLeftJoin, Op left, Op right)Optransform(OpMinus opMinus, Op left, Op right)Optransform(OpUnion opUnion, Op left, Op right)-
Methods inherited from class org.apache.jena.sparql.algebra.TransformCopy
transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform
-
-
-
-
Method Detail
-
transform
public Op transform(OpGraph opGraph, Op subOp)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
transform
public Op transform(OpAssign opAssign, Op subOp)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
transform
public Op transform(OpExtend opExtend, Op subOp)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
transform
public Op transform(OpJoin opJoin, Op left, Op right)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
transform
public Op transform(OpLeftJoin opLeftJoin, Op left, Op right)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
transform
public Op transform(OpMinus opMinus, Op left, Op right)
- Specified by:
transformin interfaceTransform- Overrides:
transformin classTransformCopy
-
-