Documentation ¶
Index ¶
- Variables
- func BottomUp(root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, ...) (ops.Operator, error)
- func BottomUpAll(root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, ...) (ops.Operator, error)
- func EnableDebugPrinting() (reset func())
- func FixedPointBottomUp(root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, ...) (op ops.Operator, err error)
- func TopDown(root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, ...) (op ops.Operator, err error)
- func Visit(root ops.Operator, visitor func(ops.Operator) error) error
- type ApplyResult
- type Rewrite
- type ShouldVisit
- type VisitF
- type VisitRule
Constants ¶
This section is empty.
Variables ¶
var DebugOperatorTree = false
Functions ¶
func BottomUp ¶
func BottomUp( root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, visit VisitF, shouldVisit ShouldVisit, ) (ops.Operator, error)
BottomUp rewrites an operator tree from the bottom up. BottomUp applies a transformation function to the given operator tree from the bottom up. Each callback [f] returns a ApplyResult that is aggregated into a final output indicating whether the operator tree was changed.
func BottomUpAll ¶ added in v0.17.0
func BottomUpAll( root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, visit VisitF, ) (ops.Operator, error)
BottomUpAll rewrites an operator tree from the bottom up. BottomUp applies a transformation function to the given operator tree from the bottom up. Each callback [f] returns a ApplyResult that is aggregated into a final output indicating whether the operator tree was changed.
func EnableDebugPrinting ¶ added in v0.18.0
func EnableDebugPrinting() (reset func())
func FixedPointBottomUp ¶ added in v0.17.0
func FixedPointBottomUp( root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, visit VisitF, shouldVisit ShouldVisit, ) (op ops.Operator, err error)
FixedPointBottomUp rewrites an operator tree much like BottomUp does, but does the rewriting repeatedly, until a tree walk is done with no changes to the tree.
func TopDown ¶
func TopDown( root ops.Operator, resolveID func(ops.Operator) semantics.TableSet, visit VisitF, shouldVisit ShouldVisit, ) (op ops.Operator, err error)
TopDown rewrites an operator tree from the bottom up. BottomUp applies a transformation function to the given operator tree from the bottom up. Each callback [f] returns a ApplyResult that is aggregated into a final output indicating whether the operator tree was changed.
Parameters: - root: The root operator of the tree to be traversed. - resolveID: A function to resolve the TableSet of an operator. - visit: The VisitF function to be called for each visited operator. - shouldVisit: The ShouldVisit function to control which nodes and ancestors to visit and which to skip.
Returns: - ops.Operator: The root of the (potentially) transformed operator tree. - error: An error if any occurred during the traversal.
Types ¶
type ApplyResult ¶ added in v0.17.0
type ApplyResult struct {
Transformations []Rewrite
}
ApplyResult tracks modifications to node and expression trees. Only return SameTree when it is acceptable to return the original input and discard the returned result as a performance improvement.
var (
SameTree *ApplyResult = nil
)
func Swap ¶ added in v0.17.0
Swap takes a tree like a->b->c and swaps `a` and `b`, so we end up with b->a->c
func (*ApplyResult) Changed ¶ added in v0.17.0
func (ar *ApplyResult) Changed() bool
func (*ApplyResult) Merge ¶ added in v0.17.0
func (ar *ApplyResult) Merge(other *ApplyResult) *ApplyResult
type ShouldVisit ¶ added in v0.17.0
ShouldVisit is used when we want to control which nodes and ancestors to visit and which to skip