feat(sql): arg_min and arg_max CHAR functions#6730
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughAdds eight new group-by aggregation functions implementing arg_max and arg_min for char values across three key types (double, long, timestamp), with corresponding function factories and comprehensive test suites. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
1 similar comment
✅ Actions performedReview triggered.
|
| public void computeFirst(MapValue mapValue, Record record, long rowId) { | ||
| long key = keyArg.getTimestamp(record); | ||
| if (key == Numbers.LONG_NULL) { | ||
| mapValue.putChar(valueIndex, (char) 0); |
There was a problem hiding this comment.
nit:
(char) 0 is hardcoded in 6 files instead of using Numbers.CHAR_NULL.
Not a bug (they are the same value), but using the constant would be more self-documenting.
The existing codebase uses Numbers.LONG_NULL and Double.NaN for those types, so the CHAR variant is slightly inconsistent.
There was a problem hiding this comment.
Fixed — replaced all (char) 0 occurrences with Numbers.CHAR_NULL across all 6 implementation files (in computeFirst() and setNull()).
...uestdb/test/griffin/engine/functions/groupby/ArgMaxCharDoubleGroupByFunctionFactoryTest.java
Show resolved
Hide resolved
Use Numbers.CHAR_NULL instead of hardcoded (char) 0 across all 6 implementation files for consistency with Numbers.LONG_NULL and Double.NaN usage in other arg_min/arg_max variants. Add missing test coverage: empty table, tie-breaking behavior (first occurrence wins with strict >/<), and mixed null value + null key combinations in the same dataset. Co-Authored-By: Claude Opus 4.6 <[email protected]>
[PR Coverage check]😍 pass : 288 / 288 (100.00%) file detail
|
Summary
Adds
arg_maxandarg_minfunction variants that accept a CHAR type for the value argument (left-hand side).New functions
arg_max(AN)arg_max(char, timestamp)arg_max(AL)arg_max(char, long)arg_max(AD)arg_max(char, double)arg_min(AN)arg_min(char, timestamp)arg_min(AL)arg_min(char, long)arg_min(AD)arg_min(char, double)Usage examples
Notes