-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-39259][SQL] Evaluate timestamps consistently in subqueries #36654
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
Changes from 7 commits
5f20717
ff68d5b
8075b25
7897342
a854a37
e9e2c69
60b4bcf
87e1d92
d70ea4d
a242bcf
e48dc4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -454,7 +454,7 @@ abstract class QueryPlan[PlanType <: QueryPlan[PlanType]] | |
| * to rewrite the whole plan, include its subqueries, in one go. | ||
| */ | ||
| def transformWithSubqueries(f: PartialFunction[PlanType, PlanType]): PlanType = | ||
| transformDownWithSubqueries(f) | ||
| transformDownWithSubqueries(AlwaysProcess.fn, UnknownRuleId)(f) | ||
|
|
||
| /** | ||
| * Returns a copy of this node where the given partial function has been recursively applied | ||
|
|
@@ -479,21 +479,24 @@ abstract class QueryPlan[PlanType <: QueryPlan[PlanType]] | |
| * first to this node, then this node's subqueries and finally this node's children. | ||
| * When the partial function does not apply to a given node, it is left unchanged. | ||
| */ | ||
| def transformDownWithSubqueries(f: PartialFunction[PlanType, PlanType]): PlanType = { | ||
| def transformDownWithSubqueries( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of modifying this method's signature, I slightly prefer adding an overload named Adding a new method also avoids introducing source or binary compatibility issues for third-party code that calls Catalyst APIs. Technically speaking, Catalyst APIs are considered internal to Spark and are subject to change between minor releases (see source), but I think it's nice to try to avoid API breakage when feasible. I also ran into problems when trying to call As a result, I'm going to submit a followup to this PR to split this into two methods as I've suggested above.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's my PR: #36765 |
||
| cond: TreePatternBits => Boolean = AlwaysProcess.fn, ruleId: RuleId = UnknownRuleId) | ||
| (f: PartialFunction[PlanType, PlanType]) | ||
| : PlanType = { | ||
| val g: PartialFunction[PlanType, PlanType] = new PartialFunction[PlanType, PlanType] { | ||
| override def isDefinedAt(x: PlanType): Boolean = true | ||
|
|
||
| override def apply(plan: PlanType): PlanType = { | ||
| val transformed = f.applyOrElse[PlanType, PlanType](plan, identity) | ||
| transformed transformExpressionsDown { | ||
| case planExpression: PlanExpression[PlanType] => | ||
| val newPlan = planExpression.plan.transformDownWithSubqueries(f) | ||
| val newPlan = planExpression.plan.transformDownWithSubqueries(cond, ruleId)(f) | ||
| planExpression.withNewPlan(newPlan) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| transformDown(g) | ||
| transformDownWithPruning(cond, ruleId)(g) | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.