Skip to content

[AURON #1518] Implement native function of quarter.#1519

Merged
richox merged 3 commits intoapache:masterfrom
slfan1989:auron-1518
Nov 3, 2025
Merged

[AURON #1518] Implement native function of quarter.#1519
richox merged 3 commits intoapache:masterfrom
slfan1989:auron-1518

Conversation

@slfan1989
Copy link
Contributor

@slfan1989 slfan1989 commented Oct 25, 2025

Which issue does this PR close?

Closes #1518.

Rationale for this change

This PR is a follow-up to #565, which introduced native support for year(), month(), and day() functions.

To complete the set of date extraction functions, this PR adds support for the native quarter() function, allowing users to easily retrieve the quarter (Q1–Q4) from a given date.

This enhancement improves the consistency and usability of date/time handling across queries.

What changes are included in this PR?

  • Added implementation of the native quarter() function.
  • Integrated the function into the existing date function module.
  • Added corresponding unit tests to validate correctness.
  • Updated documentation and usage examples where applicable.

Are there any user-facing changes?

Yes.

Users can now call the quarter() function directly in queries, for example:

SELECT quarter('2025-03-10');  -- Returns 1
SELECT quarter('2025-08-01');  -- Returns 3

No backward-incompatible changes are introduced.

How was this patch tested?

  • Added unit tests covering multiple date inputs, including edge cases (e.g., start and end of each quarter).
  • Verified consistency with existing year(), month(), and day() function behavior.
  • All test cases passed successfully in the local development environment.

Signed-off-by: slfan1989 <slfan1989@apache.org>
@slfan1989 slfan1989 marked this pull request as ready for review October 26, 2025 02:52
slfan1989 and others added 2 commits October 29, 2025 18:19
@slfan1989
Copy link
Contributor Author

@richox @cxzl25 @zuston Could you please help merge this PR? Thank you so much! If this PR is merged, we will be able to better follow up on #1522.

Copy link
Member

@zuston zuston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Could we introduce the dedicated test case to cover this function ? @slfan1989

@slfan1989
Copy link
Contributor Author

lgtm. Could we introduce the dedicated test case to cover this function ? @slfan1989

@zuston Thank you very much for reviewing the code! We have added two related unit tests for spark_quarter in spark_dates.rs and one unit test in AuronQuerySuite.scala.

@guixiaowen
Copy link
Contributor

lgtm

@richox richox merged commit 1539192 into apache:master Nov 3, 2025
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement native function of quarter

5 participants