Class AdaptiveResolutionStrategy
Object
gudusoft.gsqlparser.resolver2.iterative.AdaptiveResolutionStrategy
- All Implemented Interfaces:
ResolutionStrategy
Adaptive resolution strategy that adjusts based on query complexity.
This strategy analyzes the resolution progress and adapts its behavior: - If progress is good: Continue with current approach - If progress stalls: Enable more aggressive techniques (inference, expansion) - If query is complex: Use more iterations - If query is simple: Use fewer iterations
Adaptation criteria: - Resolution rate (% of columns resolved) - Progress per pass (columns resolved in each iteration) - Query complexity (number of CTEs, subqueries, etc.)
Example behavior:
Simple query (SELECT a, b FROM t1): Pass 1: 100% resolved -> STOP (no need for more passes) Complex query (multiple nested CTEs): Pass 1: 30% resolved -> continue Pass 2: 60% resolved -> enable inference Pass 3: 85% resolved -> enable aggressive expansion Pass 4: 95% resolved -> final cleanup
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAdaptive states. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the current adaptive state.Get a description of this strategy.getName()Get the name of this strategy.voidpreparePass(int passNumber, ResolutionStatistics previousStats) Prepare for a new pass.booleanshouldExpandStars(int passNumber, ResolutionStatistics previousStats) Determine if this strategy should expand star columns in the current pass.booleanshouldPerformInference(int passNumber, ResolutionStatistics previousStats) Determine if this strategy should perform inference in the current pass.booleanshouldPushDownColumns(int passNumber, ResolutionStatistics previousStats) Determine if this strategy should push down column requirements in the current pass.toString()
-
Constructor Details
-
AdaptiveResolutionStrategy
public AdaptiveResolutionStrategy()
-
-
Method Details
-
getName
Description copied from interface:ResolutionStrategyGet the name of this strategy.- Specified by:
getNamein interfaceResolutionStrategy- Returns:
- strategy name
-
shouldPerformInference
Description copied from interface:ResolutionStrategyDetermine if this strategy should perform inference in the current pass.- Specified by:
shouldPerformInferencein interfaceResolutionStrategy- Parameters:
passNumber- the current pass numberpreviousStats- statistics from previous pass (null for first pass)- Returns:
- true if inference should be performed
-
shouldExpandStars
Description copied from interface:ResolutionStrategyDetermine if this strategy should expand star columns in the current pass.- Specified by:
shouldExpandStarsin interfaceResolutionStrategy- Parameters:
passNumber- the current pass numberpreviousStats- statistics from previous pass (null for first pass)- Returns:
- true if star expansion should be performed
-
shouldPushDownColumns
Description copied from interface:ResolutionStrategyDetermine if this strategy should push down column requirements in the current pass.- Specified by:
shouldPushDownColumnsin interfaceResolutionStrategy- Parameters:
passNumber- the current pass numberpreviousStats- statistics from previous pass (null for first pass)- Returns:
- true if push-down should be performed
-
preparePass
Description copied from interface:ResolutionStrategyPrepare for a new pass. Strategy can adjust its behavior based on previous results.- Specified by:
preparePassin interfaceResolutionStrategy- Parameters:
passNumber- the upcoming pass numberpreviousStats- statistics from previous pass (null for first pass)
-
getDescription
Description copied from interface:ResolutionStrategyGet a description of this strategy.- Specified by:
getDescriptionin interfaceResolutionStrategy- Returns:
- strategy description
-
getCurrentState
Get the current adaptive state.- Returns:
- current state
-
toString
-