Skip to content

Commit 7110ff6

Browse files
Pierre-Luc Gagnéclaude
andcommitted
feat: add conditional, string, math, date/time, and JSON scalar functions
Adds 48 new projection functions across five categories: - Conditional: NULLIF, GREATEST, LEAST, IF - String: CHAR_LENGTH, LEFT, RIGHT, REPLACE, LPAD, RPAD, REPEAT, REVERSE, LOCATE, INSTR, SPACE, STRCMP - Math: SQRT, LOG, LOG2, LOG10, EXP, SIN, COS, TAN, DEGREES, RADIANS, SIGN, TRUNCATE, PI - Date/Time: HOUR, MINUTE, SECOND, MICROSECOND, QUARTER, WEEK, WEEKDAY, DAYOFWEEK, DAYOFYEAR, DAYNAME, MONTHNAME, LAST_DAY, STR_TO_DATE, FROM_UNIXTIME, UNIX_TIMESTAMP, CONVERT_TZ, CURTIME, UTC_TIMESTAMP, ADDTIME, SUBTIME, TIMEDIFF - JSON: JSON_EXTRACT, JSON_OBJECT, JSON_ARRAY, JSON_CONTAINS, JSON_LENGTH, JSON_UNQUOTE Each function follows the existing _of<> tag + projection_traits + short alias pattern. Fixed-string template parameters are used for compile-time string literals (format strings, JSON paths, timezone names, search substrings). 48 new unit tests added (4 new suites). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 42c1414 commit 7110ff6

3 files changed

Lines changed: 1235 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2525
- `first_value_over<Col, PartitionCol, OrderCol>``FIRST_VALUE(col) OVER (...)`
2626
- `last_value_over<Col, PartitionCol, OrderCol>``LAST_VALUE(col) OVER (...)`
2727
- `nth_value_over<Col, N, PartitionCol, OrderCol>``NTH_VALUE(col, N) OVER (...)`
28+
- **Conditional scalar functions**: `nullif_of<A,B>`, `greatest_of<Ps...>`, `least_of<Ps...>`, `if_of<"cond",Then,Else>` with short aliases `nullif`, `greatest`, `least`, `sql_if`
29+
- **String scalar functions**: `char_length_of<P>`, `left_of<P,N>`, `right_of<P,N>`, `replace_of<P,"from","to">`, `lpad_of<P,N,"pad">`, `rpad_of<P,N,"pad">`, `repeat_of<P,N>`, `reverse_of<P>`, `locate_of<"sub",P>`, `instr_of<P,"sub">`, `space_of<P>`, `strcmp_of<A,B>` with matching short aliases
30+
- **Math scalar functions**: `sqrt_of<P>`, `log_of<P>`, `log2_of<P>`, `log10_of<P>`, `exp_of<P>`, `sin_of<P>`, `cos_of<P>`, `tan_of<P>`, `degrees_of<P>`, `radians_of<P>`, `sign_of<P>`, `truncate_to<P,D>`, `pi_val` with matching short aliases
31+
- **Extended date/time scalar functions**: `hour_of<P>`, `minute_of<P>`, `second_of<P>`, `microsecond_of<P>`, `quarter_of<P>`, `week_of<P>`, `weekday_of<P>`, `dayofweek_of<P>`, `dayofyear_of<P>`, `dayname_of<P>`, `monthname_of<P>`, `last_day_of<P>`, `str_to_date_of<P,"fmt">`, `from_unixtime_of<P>`, `unix_timestamp_of<P>`, `convert_tz_of<P,"from","to">`, `curtime_val`, `utc_timestamp_val`, `addtime_of<A,B>`, `subtime_of<A,B>`, `timediff_of<A,B>` with matching short aliases
32+
- **JSON scalar functions**: `json_extract_of<P,"$.path">`, `json_object_of<Ps...>`, `json_array_of<Ps...>`, `json_contains_of<P,"val">`, `json_length_of<P>`, `json_unquote_of<P>` with matching short aliases
2833
- `stddev<Col>``STDDEV(col)``double`
2934
- `std_of<Col>``STD(col)``double` (MySQL synonym for `STDDEV`)
3035
- `stddev_pop<Col>``STDDEV_POP(col)``double`

0 commit comments

Comments
 (0)