presto-raptor-legacy/src/main/java/io/prestosql/plugin/raptor/legacy/storage/organization/TemporalFunction.java/TemporalFunction/determineDay
class TemporalFunction:    private static int determineDay(long rangeStart, long rangeEnd)
    {
        int startDay = toIntExact(Duration.ofMillis(rangeStart).toDays());
        int endDay = toIntExact(Duration.ofMillis(rangeEnd).toDays());
        if (startDay == endDay) {
            return toIntExact(startDay);
        }

        if ((endDay - startDay) > 1) {
            // range spans multiple days, return the first full day
            return startDay + 1;
        }

        // range spans two days, return the day that has the larger time range
        long millisInStartDay = Duration.ofDays(endDay).toMillis() - rangeStart;
        long millisInEndDay = rangeEnd - Duration.ofDays(endDay).toMillis();
        return (millisInStartDay >= millisInEndDay) ? startDay : endDay;
    }