DaZuiZui opened a new pull request, #19265:
URL: https://github.com/apache/iotdb/pull/19265

   ## Description
   
   Fixes #19264.
   
   `date_bin` and `date_bin_gapfill` with a month or year interval shifted a 
bin boundary later by the whole milliseconds already present inside that 
second. `date_bin(1mo, time, 500)` returned `1000` instead of `500`.
   
   `DateBinFunctionColumnTransformer.convertToTimestamp` added `toEpochMilli()` 
and the full `getNano()`. `toEpochMilli()` already contains the whole 
milliseconds of that second, and `getNano()` is the nanosecond-of-second, so 
those milliseconds were counted twice. The method now encodes the `Instant` 
from `getEpochSecond()` and `getNano()`.
   
   The method is private. Its three callers (`dateBin`, `dateBinStartEnd`, and 
the month step of `date_bin_gapfill`) share it, so the query result and the 
gap-fill step stay on the same boundary. Hour and day bins use integer 
arithmetic and are unchanged. A month bin that lands on an exact second is 
unchanged because the nanosecond-of-second is 0.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for code coverage.
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) 
in this PR
   
   - `DateBinFunctionColumnTransformer`
   - `DateBinFunctionTest`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to