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

Checks for Acid operation/bucket table write are in the wrong place

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.2.0
    • None
    • None

    Description

      The following code in
      in SemanticAnalyzer.getMetaData(QB qb, ReadEntity parentInput)

            // Disallow INSERT INTO on bucketized tables
            boolean isAcid = AcidUtils.isAcidTable(tab);
            boolean isTableWrittenTo = qb.getParseInfo().isInsertIntoTable(tab.getDbName(), tab.getTableName());
            if (isTableWrittenTo &&
                tab.getNumBuckets() > 0 && !isAcid) {
              throw new SemanticException(ErrorMsg.INSERT_INTO_BUCKETIZED_TABLE.
                  getMsg("Table: " + tabName));
            }
            // Disallow update and delete on non-acid tables
            if ((updating() || deleting()) && !isAcid && isTableWrittenTo) {
              //isTableWrittenTo: delete from acidTbl where a in (select id from nonAcidTable)
              //so only assert this if we are actually writing to this table
              // Whether we are using an acid compliant transaction manager has already been caught in
              // UpdateDeleteSemanticAnalyzer, so if we are updating or deleting and getting nonAcid
              // here, it means the table itself doesn't support it.
              throw new SemanticException(ErrorMsg.ACID_OP_ON_NONACID_TABLE, tabName);
            }
      

      is done in the loop " for (String alias : tabAliases) {" which is over tables being read.
      Should be done in " for (String name : qbp.getClauseNamesForDest()) {" loop

      Attachments

        1. HIVE-14883.5.patch
          3 kB
          Eugene Koifman
        2. HIVE-14883.4.patch
          3 kB
          Eugene Koifman
        3. HIVE-14883.3.patch
          3 kB
          Eugene Koifman
        4. HIVE-14883.2.patch
          3 kB
          Eugene Koifman
        5. HIVE-14883.patch
          3 kB
          Eugene Koifman

        Issue Links

          Activity

            People

              ekoifman Eugene Koifman
              ekoifman Eugene Koifman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: