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

Literal Decimal ExprNodeConstantDesc should contain value of HiveDecimal instead of String

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.2.0
    • Component/s: Query Processor
    • Labels:
      None
    • Hadoop Flags:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: