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

Literal Decimal ExprNodeConstantDesc should contain value of HiveDecimal instead of String

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.2.0
    • Query Processor
    • None
    • Reviewed

    Description

      In TyepCheckProcFactory.NumExprProcessor, the ExprNodeConstantDesc is created from strVal:

      else if (expr.getText().endsWith("BD")) {
                // Literal decimal
                String strVal = expr.getText().substring(0, expr.getText().length() - 2);
                HiveDecimal hd = HiveDecimal.create(strVal);
                int prec = 1;
                int scale = 0;
                if (hd != null) {
                  prec = hd.precision();
                  scale = hd.scale();
                }
                DecimalTypeInfo typeInfo = TypeInfoFactory.getDecimalTypeInfo(prec, scale);
                return new ExprNodeConstantDesc(typeInfo, strVal);
              } 
      

      It should use HiveDecmal:
      return new ExprNodeConstantDesc(typeInfo, hd);

      Attachments

        1. HIVE-10313.1.patch
          6 kB
          Chaoyu Tang
        2. HIVE-10313.patch
          2 kB
          Chaoyu Tang

        Activity

          People

            ctang Chaoyu Tang
            ctang Chaoyu Tang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: