Package io.trino.sql.planner.iterative
Class Memo
java.lang.Object
io.trino.sql.planner.iterative.Memo
Stores a plan in a form that's efficient to mutate locally (i.e. without
having to do full ancestor tree rewrites due to plan nodes being immutable).
Each node in a plan is placed in a group, and it's children are replaced with symbolic references to the corresponding groups.
For example, a plan like:
A -> B -> C -> D
\> E -> F
would be stored as:
root: G0
G0 : { A -> G1 }
G1 : { B -> [G2, G3] }
G2 : { C -> G4 }
G3 : { E -> G5 }
G4 : { D }
G5 : { F }
Groups are reference-counted, and groups that become unreachable from the root
due to mutations in a subtree get garbage-collected.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextract()getCost(int group) intgetNode(int group) intgetStats(int group) resolve(GroupReference groupReference) voidstoreCost(int group, PlanCostEstimate cost) voidstoreStats(int groupId, PlanNodeStatsEstimate stats)
-
Constructor Details
-
Memo
-
-
Method Details
-
getRootGroup
public int getRootGroup() -
getNode
-
resolve
-
extract
-
replace
-
getStats
-
storeStats
-
getCost
-
storeCost
-
getGroupCount
public int getGroupCount()
-