public class TransformPromoteTableEmpty extends TransformCopy
table 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 FILTER
clauses 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.
The optimizer makes the following promotions:
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.
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
Constructor and Description |
---|
TransformPromoteTableEmpty() |
Modifier and Type | Method and Description |
---|---|
Op |
transform(OpAssign opAssign,
Op subOp) |
Op |
transform(OpExtend opExtend,
Op subOp) |
Op |
transform(OpGraph opGraph,
Op subOp) |
Op |
transform(OpJoin opJoin,
Op left,
Op right) |
Op |
transform(OpLeftJoin opLeftJoin,
Op left,
Op right) |
Op |
transform(OpMinus opMinus,
Op left,
Op right) |
Op |
transform(OpUnion opUnion,
Op left,
Op right) |
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
public Op transform(OpGraph opGraph, Op subOp)
transform
in interface Transform
transform
in class TransformCopy
public Op transform(OpAssign opAssign, Op subOp)
transform
in interface Transform
transform
in class TransformCopy
public Op transform(OpExtend opExtend, Op subOp)
transform
in interface Transform
transform
in class TransformCopy
public Op transform(OpJoin opJoin, Op left, Op right)
transform
in interface Transform
transform
in class TransformCopy
public Op transform(OpLeftJoin opLeftJoin, Op left, Op right)
transform
in interface Transform
transform
in class TransformCopy
public Op transform(OpMinus opMinus, Op left, Op right)
transform
in interface Transform
transform
in class TransformCopy
Licenced under the Apache License, Version 2.0