Skip to content

Conversation

beliefer
Copy link
Contributor

@beliefer beliefer commented Feb 12, 2025

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'.

@github-actions github-actions bot added the SQL label Feb 12, 2025
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a 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

Comment on lines 28 to 44
/** 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
Copy link
Contributor

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?

@beliefer beliefer force-pushed the SPARK-42746_followup2 branch from b9a6e08 to 0b630cc Compare February 16, 2025 04:36
@beliefer beliefer changed the title [SPARK-42746][SQL][FOLLOWUP] Improve the code for SupportsOrderingWithinGroup and Mode [SPARK-42746][SQL][FOLLOWUP] Correct the comments for SupportsOrderingWithinGroup and Mode Feb 16, 2025
@beliefer beliefer force-pushed the SPARK-42746_followup2 branch from a94f00e to 4fc2419 Compare February 16, 2025 09:14
@beliefer beliefer closed this in 0002cdd Feb 17, 2025
beliefer added a commit that referenced this pull request Feb 17, 2025
…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>
@beliefer
Copy link
Contributor Author

Merged into branch-4.0/master
@cloud-fan @dongjoon-hyun @mikhailnik-db Thanks!

Pajaraja pushed a commit to Pajaraja/spark that referenced this pull request Mar 6, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants