Hive
  1. Hive
  2. HIVE-2358

JDBC DatabaseMetaData and ResultSetMetaData need to match for particular types

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.8.0
    • Fix Version/s: 0.8.0
    • Component/s: JDBC
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      My patch for HIVE-1631 did not ensure the following (from comment on 1631):
      -------------
      Mythili Gopalakrishnan added a comment - 08/Aug/11 08:42

      Just tested this fix and does NOT work correctly. Here are my findings on a FLOAT column

      Without Patch on a FLOAT Column
      --------------------------------
      DatabaseMetaData.getColumns () COLUMN_SIZE returns 12
      DatabaseMetaData.getColumns () DECIMAL_DIGITS - returns 0

      ResultSetMetaData.getPrecision() returns 0
      ResultSetMetaData.getScale() returns 0

      With Patch on a FLOAT Column
      ----------------------------
      DatabaseMetaData.getColumns () COLUMN_SIZE returns 24
      DatabaseMetaData.getColumns () DECIMAL_DIGITS - returns 0

      ResultSetMetaData.getPrecision() returns 7
      ResultSetMetaData.getScale() returns 7

      Also both DatabaseMetadata and ResultSetMetaData must return the same information for Precision and Scale for FLOAT,DOUBLE types.

      1. HIVE-2358.patch
        16 kB
        Patrick Hunt

        Issue Links

          Activity

          Hide
          Patrick Hunt added a comment -

          HIVE-2358 addresses a problem identified in patch for HIVE-1631 (post commit).

          Show
          Patrick Hunt added a comment - HIVE-2358 addresses a problem identified in patch for HIVE-1631 (post commit).
          Hide
          Patrick Hunt added a comment -

          This patch fixes the problem identified by Mythili and also adds testing to verify.

          Show
          Patrick Hunt added a comment - This patch fixes the problem identified by Mythili and also adds testing to verify.
          Hide
          Mythili Gopalakrishnan added a comment -

          Tested this patch and here are my results.

          With Patch HIVE-2358 on a FLOAT Column
          ---------------------------------------
          DatabaseMetaData.getColumns () COLUMN_SIZE returns 7
          DatabaseMetaData.getColumns () DECIMAL_DIGITS - returns 7

          ResultSetMetaData.getPrecision() returns 7
          ResultSetMetaData.getScale() returns 7

          With Patch HIVE-2358 on a DOUBLE Column
          ---------------------------------------
          DatabaseMetaData.getColumns () COLUMN_SIZE returns 15
          DatabaseMetaData.getColumns () DECIMAL_DIGITS - returns 15

          ResultSetMetaData.getPrecision() returns 15
          ResultSetMetaData.getScale() returns 15

          --Mythili

          Show
          Mythili Gopalakrishnan added a comment - Tested this patch and here are my results. With Patch HIVE-2358 on a FLOAT Column --------------------------------------- DatabaseMetaData.getColumns () COLUMN_SIZE returns 7 DatabaseMetaData.getColumns () DECIMAL_DIGITS - returns 7 ResultSetMetaData.getPrecision() returns 7 ResultSetMetaData.getScale() returns 7 With Patch HIVE-2358 on a DOUBLE Column --------------------------------------- DatabaseMetaData.getColumns () COLUMN_SIZE returns 15 DatabaseMetaData.getColumns () DECIMAL_DIGITS - returns 15 ResultSetMetaData.getPrecision() returns 15 ResultSetMetaData.getScale() returns 15 --Mythili
          Hide
          Patrick Hunt added a comment -

          Thanks Mythili, based on your previous comment you consider this valid output? (i.e. consistent). Do the values themselves seem reasonable to you? Are you ok for this patch to get committed?

          Show
          Patrick Hunt added a comment - Thanks Mythili, based on your previous comment you consider this valid output? (i.e. consistent). Do the values themselves seem reasonable to you? Are you ok for this patch to get committed?
          Hide
          Mythili Gopalakrishnan added a comment -

          Yes Patrick, I am OK for this patch to get committed.

          Show
          Mythili Gopalakrishnan added a comment - Yes Patrick, I am OK for this patch to get committed.
          Hide
          jiraposter@reviews.apache.org added a comment -

          -----------------------------------------------------------
          This is an automatically generated e-mail. To reply, visit:
          https://reviews.apache.org/r/1459/
          -----------------------------------------------------------

          Review request for hive and Carl Steinbach.

          Summary
          -------

          make the returned values consistent.

          This addresses bug HIVE-2358.
          https://issues.apache.org/jira/browse/HIVE-2358

          Diffs


          jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveResultSetMetaData.java 2aa7727
          jdbc/src/java/org/apache/hadoop/hive/jdbc/JdbcColumn.java 43cc2a3
          jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java d72cf43

          Diff: https://reviews.apache.org/r/1459/diff

          Testing
          -------

          added new unit tests

          Thanks,

          Patrick

          Show
          jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/1459/ ----------------------------------------------------------- Review request for hive and Carl Steinbach. Summary ------- make the returned values consistent. This addresses bug HIVE-2358 . https://issues.apache.org/jira/browse/HIVE-2358 Diffs jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveResultSetMetaData.java 2aa7727 jdbc/src/java/org/apache/hadoop/hive/jdbc/JdbcColumn.java 43cc2a3 jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java d72cf43 Diff: https://reviews.apache.org/r/1459/diff Testing ------- added new unit tests Thanks, Patrick
          Hide
          Carl Steinbach added a comment -

          +1. Will commit if tests pass.

          Show
          Carl Steinbach added a comment - +1. Will commit if tests pass.
          Hide
          Carl Steinbach added a comment -

          Committed to trunk. Thanks Patrick!

          Show
          Carl Steinbach added a comment - Committed to trunk. Thanks Patrick!
          Hide
          Hudson added a comment -

          Integrated in Hive-trunk-h0.21 #896 (See https://builds.apache.org/job/Hive-trunk-h0.21/896/)
          HIVE-2358. JDBC DatabaseMetaData and ResultSetMetaData need to match for particular types (Patrick Hunt via cws)

          cws : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1157728
          Files :

          • /hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java
          • /hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/JdbcColumn.java
          • /hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveResultSetMetaData.java
          Show
          Hudson added a comment - Integrated in Hive-trunk-h0.21 #896 (See https://builds.apache.org/job/Hive-trunk-h0.21/896/ ) HIVE-2358 . JDBC DatabaseMetaData and ResultSetMetaData need to match for particular types (Patrick Hunt via cws) cws : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1157728 Files : /hive/trunk/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java /hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/JdbcColumn.java /hive/trunk/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveResultSetMetaData.java

            People

            • Assignee:
              Patrick Hunt
              Reporter:
              Patrick Hunt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development