Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2394

Avatica applies calendar offset to timestamps when they should remain unchanged

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: avatica
    • Labels:
      None

      Description

      This code converts a millis-since-epoch value to a timestamp in three different accessors:

      class AbstractCursor {
        ...
        static Timestamp longToTimestamp(long v, Calendar calendar) {
          if (calendar != null) {
            v -= calendar.getTimeZone().getOffset(v);
          }
          return new Timestamp(v);
        }
      }
      

      But new Timestamp(millis) always accepts millis-since-epoch in GMT.

      The use in DateFromNumberAccessor is probably OK: it fabricates millis-since-epoch from a date, so applying the offset is appropriate to hit midnight in that locale.

      But both TimeFromNumberAccessor and TimestampFromNumberAccessor should leave the millis absolute.

      This manifests as timestamp actual values being shifted by the current locale (in addition to later display adjustments).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kenn Kenneth Knowles
                Reporter:
                kenn Kenneth Knowles
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: