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

Fix metastore for SQL Server

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.13.0
    • Metastore, Windows
    • None
    • Reviewed

    Description

      We found one problem in testing SQL Server metastore. In Hive code, we use substring function with single parameter in datanucleus query (Expressiontree.java):

      if (partitionColumnIndex == (partitionColumnCount - 1)) {
              valString = "partitionName.substring(partitionName.indexOf(\"" + keyEqual + "\")+" + keyEqualLength + ")";
            }
            else {
              valString = "partitionName.substring(partitionName.indexOf(\"" + keyEqual + "\")+" + keyEqualLength + ").substring(0, partitionName.substring(partitionName.indexOf(\"" + keyEqual + "\")+" + keyEqualLength + ").indexOf(\"/\"))";
            }
      

      SQL server does not support single parameter substring and datanucleus does not fill the gap.

      In the attached patch:
      1. creates a new jar hive-datanucleusplugin.jar in $HIVE_HOME/lib
      2. hive-datanucleusplugin.jar is a datanucleus plugin (include plugin.xml, MANIFEST.MF)
      3. The plugin write a specific version of "substring" implementation for sqlserver (which avoid using single param SUBSTRING, which is not supported in SQLSever)
      4. The plugin code only kicks in when the rmdb is sqlserver

      Attachments

        1. HIVE-5098-1.patch
          12 kB
          Daniel Dai
        2. HIVE-5098-2.patch
          12 kB
          Daniel Dai

        Activity

          People

            daijy Daniel Dai
            daijy Daniel Dai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: