Skip to content

Add QUARTER and DAY_OF_YEAR date functions with tests and docs - #804

Open
Alperenu0 wants to merge 2 commits into
apache:masterfrom
Alperenu0:add-quarter-and-day-of-year
Open

Add QUARTER and DAY_OF_YEAR date functions with tests and docs#804
Alperenu0 wants to merge 2 commits into
apache:masterfrom
Alperenu0:add-quarter-and-day-of-year

Conversation

@Alperenu0

Copy link
Copy Markdown

What is the purpose of the change

This PR implements the missing date functions QUARTER and DAY_OF_YEAR for time-based analytics, as requested in the issue.

Fixes #791

Brief change log

  • Added Quarter.java and DayOfYear.java in udf/table/date/ using the existing Joda-Time date-parsing approach (WeekOfYear.java as a template).
  • Registered the new functions in BuildInSqlFunctionTable.java.
  • Added comprehensive unit tests covering:
    • Leap year scenarios (e.g., Feb 29 and Dec 31 in a leap year).
    • Start/end-of-year boundaries (Jan 1 and Dec 31).
    • Null input handling.
  • Updated the markdown documentation (date.md) with syntax, descriptions, and examples for both functions.

Verifying this change

This change added tests and can be verified as follows:

  • DateTimeUtilTest / DateFunctionTest or related test suites run successfully.
  • Manual verification via provided unit tests for boundary checks and leap years passed locally.

Does this PR introduce a breaking change?

  • Yes
  • No

Copilot AI review requested due to automatic review settings July 28, 2026 13:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Implements missing date UDFs QUARTER and DAY_OF_YEAR and wires them into the DSL so they’re available for time-based analytics, with accompanying documentation updates.

Changes:

  • Registers Quarter and DayOfYear UDFs in the built-in SQL function table.
  • Updates date function documentation to include quarter and day_of_year.
  • Updates test suite imports in preparation for new unit tests.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
geaflow/geaflow-dsl/geaflow-dsl-plan/src/test/java/org/apache/geaflow/dsl/udf/date/UDFDateTest.java Adds imports for new date UDFs to support new/updated tests.
geaflow/geaflow-dsl/geaflow-dsl-plan/src/main/java/org/apache/geaflow/dsl/udf/table/date/WeekOfYear.java Contains a whitespace-only header change that adds diff noise.
geaflow/geaflow-dsl/geaflow-dsl-plan/src/main/java/org/apache/geaflow/dsl/udf/table/date/DayOfYear.java Contains a whitespace-only header change that adds diff noise.
geaflow/geaflow-dsl/geaflow-dsl-plan/src/main/java/org/apache/geaflow/dsl/schema/function/BuildInSqlFunctionTable.java Registers the new Quarter and DayOfYear UDFs in the built-in SQL function table.
docs/docs-en/source/5.application-development/2.dsl/3.build-in/date.md Documents syntax, description, and examples for quarter and day_of_year.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the date functions QUARTER / DAY_OF_YEAR

2 participants