feat: add date functions QUARTER and DAY_OF_YEAR#814
Open
YinZiBenRun wants to merge 2 commits into
Open
Conversation
Contributor
Author
Leomrlin
reviewed
Jul 20, 2026
| } | ||
|
|
||
| @Test | ||
| public void testQuarter() { |
Contributor
There was a problem hiding this comment.
These tests verify the Java methods directly, but they do not exercise SQL registration, overload resolution, type inference, or runtime invocation.
Could we add an end-to-end SQL test for them there?
Contributor
Author
There was a problem hiding this comment.
已添加端到端 SQL 测试,通过完整查询管线验证函数的注册、重载解析、类型推断和运行时调用。测试在 geaflow-dsl-runtime 模块:
- DateQuarterDayOfYearTest.java - 通过 QueryTester 驱动测试
- query/date_quarter_dayofyear_001.sql - 调用 quarter() 和 day_of_year()
- data/ + expect/ - 输入数据与期望输出
测试覆盖了季度边界(Q1-Q4)、闰年(2020-12-31=366,2020-02-29=60)、非闰年(2019-12-31=365)以及年初/年末边界。
已在本地验证通过(Tests run: 1, Failures: 0, Errors: 0)。
added 2 commits
July 26, 2026 12:27
Add two new date UDFs: - quarter(date): returns the quarter of the year (1-4) - day_of_year(date): returns the day of the year (1-366) Both follow the existing WeekOfYear pattern using Joda-Time. Registered in BuildInSqlFunctionTable. Tests cover quarter boundaries, leap years, year boundaries, and null inputs. Closes apache#791
The existing UDFDateTest verifies the Java eval() methods directly but does not exercise SQL registration, overload resolution, type inference, or runtime invocation. Add an E2E SQL test via QueryTester that runs the functions through the full query pipeline. Covers quarter boundaries (Q1-Q4), leap-year day_of_year values (2020-12-31=366, 2020-02-29=60), non-leap year (2019-12-31=365), and year start/end boundaries. Verified locally: Tests run: 1, Failures: 0, Errors: 0.
YinZiBenRun
force-pushed
the
feature/add-date-functions-quarter-dayofyear
branch
from
July 26, 2026 04:33
c0d6e72 to
49d3651
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add two new date UDFs:
Both follow the existing WeekOfYear pattern using Joda-Time. Registered in BuildInSqlFunctionTable.
Tests cover quarter boundaries, leap years, year boundaries, and null inputs.
Closes #791
What changes were proposed in this pull request?
Add two new date UDFs:
quarter(date): returns the quarter of the year (1-4), e.g. quarter('2020-06-05') = 2day_of_year(date): returns the day of the year (1-366), e.g. day_of_year('2020-12-31') = 366Both follow the existing WeekOfYear pattern using Joda-Time DateTime and DateTimeFormatter.
Registered in BuildInSqlFunctionTable.java.
How was this PR tested?