Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-21508

ClassCastException when initializing HiveMetaStoreClient on JDK10 or newer

    XMLWordPrintableJSON

Details

    Description

      There's this block of code in HiveMetaStoreClient:resolveUris (called from the constructor) on master:

        private URI metastoreUris[];
        ...
            if (MetastoreConf.getVar(conf, ConfVars.THRIFT_URI_SELECTION).equalsIgnoreCase("RANDOM")) {
              List uriList = Arrays.asList(metastoreUris);
              Collections.shuffle(uriList);
              metastoreUris = (URI[]) uriList.toArray();
            }
      

      The cast to URI[] throws a ClassCastException beginning with JDK 10, possibly with JDK 9 as well. Note that THRIFT_URI_SELECTION defaults to RANDOM so this should affect anyone who creates a HiveMetaStoreClient. On master this can be overridden with SEQUENTIAL to avoid the broken case; I'm working against 2.3.4 where there's no such workaround.

      Here's a StackOverflow post that explains the issue in more detail. Interestingly, the author described the issue in the context of the HMS; not sure why there was no follow up with a Hive bug report.

      Attachments

        1. HIVE-21508.1.patch
          1.0 kB
          Ana Jalba
        2. HIVE-21508.2.branch-2.3.patch
          0.9 kB
          Ana Jalba
        3. HIVE-21508.3.branch-2.patch
          0.9 kB
          Ana Jalba
        4. HIVE-21508.4.branch-3.1.patch
          0.9 kB
          Ana Jalba
        5. HIVE-21508.5.branch-3.1.patch
          0.9 kB
          Ana Jalba
        6. HIVE-21508.6.branch-3.patch
          0.9 kB
          Ana Jalba
        7. HIVE-21508.patch
          1.0 kB
          Ana Jalba

        Issue Links

          Activity

            People

              ananamj Ana Jalba
              adar Adar Dembo
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: