Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-5775 Introduce Cost Based Optimizer to Hive
  3. HIVE-8111

CBO trunk merge: duplicated casts for arithmetic expressions in Hive and CBO

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.14.0
    • 0.14.0
    • CBO
    • None

    Description

      Original test failure: looks like column type changes to different decimals in most cases. In one case it causes the integer part to be too big to fit, so the result becomes null it seems.

      What happens is that CBO adds casts to arithmetic expressions to make them type compatible; these casts become part of new AST, and then Hive adds casts on top of these casts. This (the first part) also causes lots of out file changes. It's not clear how to best fix it so far, in addition to incorrect decimal width and sometimes nulls when width is larger than allowed in Hive.
      Option one - don't add those for numeric ops - cannot be done if numeric op is a part of compare, for which CBO needs correct types.
      Option two - unwrap casts when determining type in Hive - hard or impossible to tell apart CBO-added casts and user casts.
      Option three - don't change types in Hive if CBO has run - seems hacky and hard to ensure it's applied everywhere.
      Option four - map all expressions precisely between two trees and remove casts again after optimization, will be pretty difficult.
      Option five - somehow mark those casts. Not sure about how yet.

      Attachments

        1. HIVE-8111.patch
          61 kB
          Sergey Shelukhin
        2. HIVE-8111.03.patch
          12 kB
          Sergey Shelukhin
        3. HIVE-8111.02.patch
          63 kB
          Sergey Shelukhin
        4. HIVE-8111.01.patch
          63 kB
          Sergey Shelukhin

        Activity

          People

            sershe Sergey Shelukhin
            sershe Sergey Shelukhin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: