Skip to content

Make dateTimeConvert scalar function robust to typed time-value input#18814

Merged
Jackie-Jiang merged 1 commit into
apache:masterfrom
Jackie-Jiang:datetimeconvert-robust-input
Jun 19, 2026
Merged

Make dateTimeConvert scalar function robust to typed time-value input#18814
Jackie-Jiang merged 1 commit into
apache:masterfrom
Jackie-Jiang:datetimeconvert-robust-input

Conversation

@Jackie-Jiang

Copy link
Copy Markdown
Contributor

Summary

The dateTimeConvert scalar function previously declared its time-value parameter as String, forcing every input to be stringified before parsing. This widens the parameter to Object and dispatches on the input format the same way [DateTimeConversionTransformFunction] does:

  • EPOCH / TIMESTAMP input is read as a LONG.
  • SIMPLE_DATE_FORMAT input is read as a STRING.

The input value is coerced to the target type using the same PinotDataType conversion as [FunctionInvoker#convertTypes], so numeric columns, numeric strings, and the date-related logical types produced by the RecordExtractor contract (java.sql.Timestamp, java.time.LocalDate, java.time.LocalTime) are all accepted for EPOCH / TIMESTAMP input rather than being forced through a stringify-then-parse round trip.

This also drops a dead _bucketingTimeZone field that was only ever assigned, never read.

Added testDateTimeConvertRecordExtractorDateTypes covering the TIMESTAMP / DATE / TIME logical types from the RecordExtractor contract.

The dateTimeConvert scalar function previously declared its time-value
parameter as String, forcing every input to be stringified before parsing.
This widens the parameter to Object and dispatches on the input format the
same way DateTimeConversionTransformFunction does: EPOCH / TIMESTAMP input is
read as a LONG, SIMPLE_DATE_FORMAT input is read as a STRING.

The input value is coerced to the target type using the same PinotDataType
conversion as FunctionInvoker.convertTypes, so numeric columns, numeric
strings, and the date-related logical types produced by the RecordExtractor
contract (java.sql.Timestamp, java.time.LocalDate, java.time.LocalTime) are
all accepted.
@Jackie-Jiang Jackie-Jiang added ingestion Related to data ingestion pipeline functions Related to scalar or aggregation functions labels Jun 19, 2026
@codecov-commenter

codecov-commenter commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.82%. Comparing base (648d285) to head (06a33aa).

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18814      +/-   ##
============================================
+ Coverage     64.80%   64.82%   +0.01%     
  Complexity     1319     1319              
============================================
  Files          3388     3388              
  Lines        210228   210231       +3     
  Branches      32948    32949       +1     
============================================
+ Hits         136229   136273      +44     
+ Misses        63028    62997      -31     
+ Partials      10971    10961      -10     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.82% <100.00%> (+0.01%) ⬆️
temurin 64.82% <100.00%> (+0.01%) ⬆️
unittests 64.81% <100.00%> (+0.02%) ⬆️
unittests1 57.00% <100.00%> (+0.02%) ⬆️
unittests2 37.26% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jackie-Jiang Jackie-Jiang merged commit 7de143f into apache:master Jun 19, 2026
11 checks passed
@Jackie-Jiang Jackie-Jiang deleted the datetimeconvert-robust-input branch June 19, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Related to scalar or aggregation functions ingestion Related to data ingestion pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants