Hive
  1. Hive
  2. HIVE-4267

hiveserver2 jdbc driver - remove trailing ".0" in resultset.getString() for timestamp field

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: HiveServer2, JDBC
    • Labels:
      None

      Description

      In case of timestamp field, it is printed with a .0 at the end, which is inconsistent with hive cli. The format without ".0" is compatible with java.sql.Timestamp.valueOf(String).

      1. HIVE-4267.1.patch
        3 kB
        Thejas M Nair

        Activity

        Hide
        Thejas M Nair added a comment -

        HIVE-4267.1.patch is based on HIVE-4269, and that needs to be applied first.

        Show
        Thejas M Nair added a comment - HIVE-4267 .1.patch is based on HIVE-4269 , and that needs to be applied first.
        Hide
        Thejas M Nair added a comment -
        Show
        Thejas M Nair added a comment - reviewboard link - https://reviews.apache.org/r/10212/
        Hide
        Ashutosh Chauhan added a comment -

        This looks a bit odd to me. java.sql.Timestamp which is meant to be jdbc compliant preserves '.0' in toString() If it indeed is compliant than it seems like jdbc driver is currently doing the right thing and cli (TimestampWritable.toString()) is the one which needs to be fixed. It will be good to check if standard says something about resultset.getNext().toString() method when resultset.getNext() is timestamp. If not, than may be a quick test against mysql/postgres jdbc driver will be good to verify.

        Show
        Ashutosh Chauhan added a comment - This looks a bit odd to me. java.sql.Timestamp which is meant to be jdbc compliant preserves '.0' in toString() If it indeed is compliant than it seems like jdbc driver is currently doing the right thing and cli (TimestampWritable.toString()) is the one which needs to be fixed. It will be good to check if standard says something about resultset.getNext().toString() method when resultset.getNext() is timestamp. If not, than may be a quick test against mysql/postgres jdbc driver will be good to verify.
        Hide
        Thejas M Nair added a comment -

        The jdbc spec doesn't clearly say what representation should be returned by getString() on a timestamp column. But I think what is more natural/less-surprising is to have the value of java.sql.Timestamp.toString() being returned.

        Hive cli code has extra logic to remove the trailing ".0". There might have been some motivations behind that.
        I think it is OK to have this difference in behavior with cli.
        Marking as 'Won't Fix' .

        Show
        Thejas M Nair added a comment - The jdbc spec doesn't clearly say what representation should be returned by getString() on a timestamp column. But I think what is more natural/less-surprising is to have the value of java.sql.Timestamp.toString() being returned. Hive cli code has extra logic to remove the trailing ".0". There might have been some motivations behind that. I think it is OK to have this difference in behavior with cli. Marking as 'Won't Fix' .

          People

          • Assignee:
            Thejas M Nair
            Reporter:
            Thejas M Nair
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development