6.1.1.1. pilotscope.Anchor.BaseAnchor.BasePushHandler
- class BasePushHandler(config)[source]
Bases:
pilotscope.Anchor.BaseAnchor.BaseAnchorHandler.BaseAnchorHandler
Each type of “PushHandler” is responsible for the functionality implementation of a type of data that will be set to database. The functionality include set data into database by adding parameters(e.g., cardinality estimation) or execute some SQL queries in advance (e.g., query hint), roll back database into origin after finishing execution.
- __init__(config) → None[source]
Initialize the PushHandler.
- Parameters
config – the configuration of PilotScope
- acquire_injected_data(sql)[source]
The users should implement the function to return their data from ML algorithms. The pilotscope will set these data into database automatically when execute the current SQL query.
- Parameters
sql – current SQL query
- Returns
the data that will be set into database when execute the SQL query. The type of each data is dependent on the specific the type of “PushHandler”. The user can refer to the specific subclass of “BasePushHandler” for more details.
- class CardPushHandler(config, subquery_2_card: Optional[dict] = None, enable_parameterized_subquery=False)[source]
Bases:
pilotscope.Anchor.BaseAnchor.BasePushHandler.BasePushHandler
- __init__(config, subquery_2_card: Optional[dict] = None, enable_parameterized_subquery=False) → None[source]
Initialize the PushHandler.
- Parameters
config – the configuration of PilotScope
- acquire_injected_data(sql)[source]
The users should implement the function to return their data from cardinality estimation algorithms. The pilotscope will set these data into database automatically when execute the current SQL query.
- Parameters
sql – current SQL query
- Returns
A dict where the key is the subquery and the value is the cardinality estimation of the subquery.
- class HintPushHandler(config, key_2_value_for_hint: Optional[dict] = None)[source]
Bases:
pilotscope.Anchor.BaseAnchor.BasePushHandler.BasePushHandler
- __init__(config, key_2_value_for_hint: Optional[dict] = None) → None[source]
Initialize the PushHandler.
- Parameters
config – the configuration of PilotScope
- acquire_injected_data(sql)[source]
The users should implement the function to return their data from hint selection algorithms. The pilotscope will set these data into database automatically when execute the current SQL query.
- Parameters
sql – current SQL query
- Returns
A dict where the key is the hint name and the value is the value of the hint.
- class CommentPushHandler(config, comment_str='')[source]
Bases:
pilotscope.Anchor.BaseAnchor.BasePushHandler.BasePushHandler
- __init__(config, comment_str='') → None[source]
Initialize the PushHandler.
- Parameters
config – the configuration of PilotScope
- acquire_injected_data(sql)[source]
The users should implement the function to return their data from ML algorithms. The pilotscope will set these data into database automatically when execute the current SQL query.
- Parameters
sql – current SQL query
- Returns
A comment string that will be added before the SQL query. This can be used to add pg_hint_plan comments, and apply join order alrogithms.