Hive
  1. Hive
  2. HIVE-4573

Support alternate table types for HiveServer2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.12.0
    • Component/s: HiveServer2, JDBC
    • Labels:
      None
    • Release Note:
      Hide
      Adds new config parameter that needs to be documented:

      <property>
        <name>hive.server2.table.type.mapping</name>
        <value>HIVE</value>
        <description>
         This setting reflects how HiveServer will report the table types for JDBC and other
         client implementations that retrieves the available tables and supported table types
           HIVE : Exposes the hive's native table tyes like MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW
           CLASSIC : More generic types like TABLE and VIEW
        </description>
      </property>
      Show
      Adds new config parameter that needs to be documented: <property>   <name>hive.server2.table.type.mapping</name>   <value>HIVE</value>   <description>    This setting reflects how HiveServer will report the table types for JDBC and other    client implementations that retrieves the available tables and supported table types      HIVE : Exposes the hive's native table tyes like MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW      CLASSIC : More generic types like TABLE and VIEW   </description> </property>

      Description

      The getTables jdbc function no longer returns information when using normal JDBC table types like TABLE or VIEW. You must now use a more specific type such as MANAGED_TABLE or VIRTUAL_VIEW. An example application that will fail to return results against 0.10 is below, works without issue in 0.9. In my 0.10 test I used HS2.

      
      import java.sql.SQLException;
      import java.sql.Connection;
      import java.sql.ResultSet;
      import java.sql.Statement;
      import java.sql.DriverManager;
      import org.apache.hive.jdbc.HiveDriver;
      import java.sql.DatabaseMetaData;
      
      public class TestGet {
        private static String driverName = "org.apache.hive.jdbc.HiveDriver";
      
        /**
       * @param args
       * @throws SQLException
         */
        public static void main(String[] args) throws SQLException {
            try {
            Class.forName(driverName);
          } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.exit(1);
          }
          Connection con = DriverManager.getConnection("jdbc:hive2://hostname:10000/default");
          DatabaseMetaData dbmd = con.getMetaData();
          String[] types = {"TABLE"};
          ResultSet rs = dbmd.getTables(null, null, "%", types);
            while (rs.next()) {
              System.out.println(rs.getString("TABLE_NAME"));
            }
          }
        }
      }
      
      1. HIVE-4573.1.patch
        17 kB
        Prasad Mujumdar
      2. HIVE-4573.2.patch
        18 kB
        Prasad Mujumdar

        Issue Links

          Activity

          Ashutosh Chauhan made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gunther Hagleitner made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Release Note Adds new config parameter that needs to be documented:

          <property>
            <name>hive.server2.table.type.mapping</name>
            <value>HIVE</value>
            <description>
             This setting reflects how HiveServer will report the table types for JDBC and other
             client implementations that retrieves the available tables and supported table types
               HIVE : Exposes the hive's native table tyes like MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW
               CLASSIC : More generic types like TABLE and VIEW
            </description>
          </property>
          Fix Version/s 0.12.0 [ 12324312 ]
          Resolution Fixed [ 1 ]
          Thejas M Nair made changes -
          Link This issue is related to HIVE-4998 [ HIVE-4998 ]
          Prasad Mujumdar made changes -
          Attachment HIVE-4573.2.patch [ 12595799 ]
          Prasad Mujumdar made changes -
          Component/s HiveServer2 [ 12320408 ]
          Prasad Mujumdar made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Prasad Mujumdar made changes -
          Attachment HIVE-4573.1.patch [ 12595775 ]
          Prasad Mujumdar made changes -
          Summary JDBC Compliance getTables Support alternate table types for HiveServer2
          Prasad Mujumdar made changes -
          Assignee Prasad Mujumdar [ prasadm ]
          Navis made changes -
          Field Original Value New Value
          Description The getTables jdbc function no longer returns information when using normal JDBC table types like TABLE or VIEW. You must now use a more specific type such as MANAGED_TABLE or VIRTUAL_VIEW. An example application that will fail to return results against 0.10 is below, works without issue in 0.9. In my 0.10 test I used HS2.

          import java.sql.SQLException;
          import java.sql.Connection;
          import java.sql.ResultSet;
          import java.sql.Statement;
          import java.sql.DriverManager;
          import org.apache.hive.jdbc.HiveDriver;
          import java.sql.DatabaseMetaData;

          public class TestGet {
            private static String driverName = "org.apache.hive.jdbc.HiveDriver";

            /**
           * @param args
           * @throws SQLException
             */
            public static void main(String[] args) throws SQLException {
                try {
                Class.forName(driverName);
              } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                System.exit(1);
              }
              Connection con = DriverManager.getConnection("jdbc:hive2://hostname:10000/default");
              DatabaseMetaData dbmd = con.getMetaData();
              String[] types = {"TABLE"};
              ResultSet rs = dbmd.getTables(null, null, "%", types);
                while (rs.next()) {
                  System.out.println(rs.getString("TABLE_NAME"));
                }
              }
            }
          The getTables jdbc function no longer returns information when using normal JDBC table types like TABLE or VIEW. You must now use a more specific type such as MANAGED_TABLE or VIRTUAL_VIEW. An example application that will fail to return results against 0.10 is below, works without issue in 0.9. In my 0.10 test I used HS2.

          {code}

          import java.sql.SQLException;
          import java.sql.Connection;
          import java.sql.ResultSet;
          import java.sql.Statement;
          import java.sql.DriverManager;
          import org.apache.hive.jdbc.HiveDriver;
          import java.sql.DatabaseMetaData;

          public class TestGet {
            private static String driverName = "org.apache.hive.jdbc.HiveDriver";

            /**
           * @param args
           * @throws SQLException
             */
            public static void main(String[] args) throws SQLException {
                try {
                Class.forName(driverName);
              } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                System.exit(1);
              }
              Connection con = DriverManager.getConnection("jdbc:hive2://hostname:10000/default");
              DatabaseMetaData dbmd = con.getMetaData();
              String[] types = {"TABLE"};
              ResultSet rs = dbmd.getTables(null, null, "%", types);
                while (rs.next()) {
                  System.out.println(rs.getString("TABLE_NAME"));
                }
              }
            }
          }
          {code}
          Johndee Burks created issue -

            People

            • Assignee:
              Prasad Mujumdar
              Reporter:
              Johndee Burks
            • Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development