-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update default SQL optimization level to use CTEs #1525
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hell yeah, looks awesome! 🚀 Left one main question about with the duplicated alias.
@@ -129,7 +129,7 @@ def create_with_random_request_id( # noqa: D102 | |||
where_constraints: Optional[Sequence[str]] = None, | |||
order_by_names: Optional[Sequence[str]] = None, | |||
order_by: Optional[Sequence[OrderByQueryParameter]] = None, | |||
sql_optimization_level: SqlQueryOptimizationLevel = SqlQueryOptimizationLevel.O4, | |||
sql_optimization_level: SqlQueryOptimizationLevel = SqlQueryOptimizationLevel.default_level(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to check if MFS is overriding this param. I know at some point we overrode the dataflow_plan_optimizations
param at least (to disable predicate pushdown) but not sure now.
, 1 AS bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_12 | ||
FROM rss_28020_cte rss_28020_cte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticing this alias is unnecessary duplication. Same with line 44 below. Is that intended? Maybe it's required for certain engines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always specify an alias for the sources in a SELECT
. This is something that can be updated, but we haven't gotten around to it. We also always specify an alias for each of the columns, which is something that can be cleaned up as well.
@@ -0,0 +1,6 @@ | |||
kind: Features | |||
body: se CTEs instead of sub queries in generated SQL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Resolves #1040
This PR updates the default SQL optimization level to use CTEs. This creates a number of snapshot changes as queries in tests now use CTEs in cases where there are common sources or common metrics in multi-metric / derived metric cases.