-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-42746][SQL][FOLLOWUP] Correct the comments for SupportsOrderingWithinGroup and Mode #49907
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
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.
cc @mikhailnik-db , @cloud-fan because this is a follow-up of
...atalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/percentiles.scala
Show resolved
Hide resolved
/** Indicator that ordering was set. */ | ||
def orderingFilled: Boolean | ||
def orderingFilled: Boolean = false | ||
|
||
/** | ||
* Tells Analyzer that WITHIN GROUP (ORDER BY ...) is mandatory for function. | ||
* | ||
* @see [[QueryCompilationErrors.functionMissingWithinGroupError]] | ||
*/ | ||
def isOrderingMandatory: Boolean | ||
def isOrderingMandatory: Boolean = true | ||
|
||
/** | ||
* Tells Analyzer that DISTINCT is supported. | ||
* The DISTINCT can conflict with order so some functions can ban it. | ||
* | ||
* @see [[QueryCompilationErrors.functionMissingWithinGroupError]] | ||
* @see [[QueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError]] | ||
*/ | ||
def isDistinctSupported: Boolean | ||
def isDistinctSupported: Boolean = false |
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.
I don't like the idea of default flags in this trait. I think every developer should make a deliberate decision about what behavior he wants for a new function. With default values, it's easy to forget some corner cases.
Personally, as a new contributor, I saw abstract/non-implemented methods and flags as hints, which is not to forget. But about default values, you can get to know them only by reading all the code or during testing.
@cloud-fan, what do you think?
b9a6e08
to
0b630cc
Compare
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala
Outdated
Show resolved
Hide resolved
a94f00e
to
4fc2419
Compare
…gWithinGroup and Mode ### What changes were proposed in this pull request? This PR propose to correct the comments for `SupportsOrderingWithinGroup` and `Mode`. ### Why are the changes needed? First, some comments added with incorrect style. Second, replace `QueryCompilationErrors.functionMissingWithinGroupError` with the correct `QueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError`. ### Does this PR introduce _any_ user-facing change? 'No'. New feature. ### How was this patch tested? GA. ### Was this patch authored or co-authored using generative AI tooling? 'No'. Closes #49907 from beliefer/SPARK-42746_followup2. Lead-authored-by: beliefer <beliefer@163.com> Co-authored-by: Jiaan Geng <beliefer@163.com> Signed-off-by: beliefer <beliefer@163.com> (cherry picked from commit 0002cdd) Signed-off-by: beliefer <beliefer@163.com>
Merged into branch-4.0/master |
…gWithinGroup and Mode ### What changes were proposed in this pull request? This PR propose to correct the comments for `SupportsOrderingWithinGroup` and `Mode`. ### Why are the changes needed? First, some comments added with incorrect style. Second, replace `QueryCompilationErrors.functionMissingWithinGroupError` with the correct `QueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError`. ### Does this PR introduce _any_ user-facing change? 'No'. New feature. ### How was this patch tested? GA. ### Was this patch authored or co-authored using generative AI tooling? 'No'. Closes apache#49907 from beliefer/SPARK-42746_followup2. Lead-authored-by: beliefer <beliefer@163.com> Co-authored-by: Jiaan Geng <beliefer@163.com> Signed-off-by: beliefer <beliefer@163.com>
What changes were proposed in this pull request?
This PR propose to correct the comments for
SupportsOrderingWithinGroup
andMode
.Why are the changes needed?
First, some comments added with incorrect style.
Second, replace
QueryCompilationErrors.functionMissingWithinGroupError
with the correctQueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError
.Does this PR introduce any user-facing change?
'No'.
New feature.
How was this patch tested?
GA.
Was this patch authored or co-authored using generative AI tooling?
'No'.