Examples of Decimal128


Examples of org.apache.hadoop.hive.common.type.Decimal128

        int batchSize,
        boolean[] isNull) {

      for(int i=0;i<batchSize;++i) {
        if (!isNull[i]) {
          Decimal128 value = vector[i];
          myagg.sumValueWithCheck(value, this.sumScale);
        }
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

        myagg.sum.zeroClear();
        myagg.count = 0;
      }

      for (int i=0;i<batchSize;++i) {
        Decimal128 value = vector[i];
        myagg.sumValueNoCheck(value, this.sumScale);
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

      this.inputExpression = inputExpression;
    }

    public VectorUDAFSumDecimal() {
      super();
      scratchDecimal = new Decimal128();
    }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

        int[] selected) {

      for (int j=0; j< batchSize; ++j) {
        int i = selected[j];
        if (!isNull[i]) {
          Decimal128 value = vector[i];
          if (myagg.isNull) {
            myagg.isNull = false;
            myagg.sum.zeroClear();
          }
          myagg.sum.addDestructive(value, scale);
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

        myagg.sum.zeroClear();
        myagg.isNull = false;
      }

      for (int i=0; i< batchSize; ++i) {
        Decimal128 value = vector[selected[i]];
        myagg.sum.addDestructive(value, scale);
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

        int batchSize,
        boolean[] isNull) {

      for(int i=0;i<batchSize;++i) {
        if (!isNull[i]) {
          Decimal128 value = vector[i];
          if (myagg.isNull) {
            myagg.sum.zeroClear();
            myagg.isNull = false;
          }
          myagg.sum.addDestructive(value, scale);
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

        myagg.sum.zeroClear();
        myagg.isNull = false;
      }

      for (int i=0;i<batchSize;++i) {
        Decimal128 value = vector[i];
        myagg.sum.addDestructive(value, scale);
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

    ExprNodeDesc child = childExpr.get(0);
    String inputType = childExpr.get(0).getTypeString();
    if (child instanceof ExprNodeConstantDesc) {
      // Return a constant vector expression
      Object constantValue = ((ExprNodeConstantDesc) child).getValue();
      Decimal128 decimalValue = castConstantToDecimal(constantValue, child.getTypeInfo());
      return getConstantVectorExpression(decimalValue, returnType, Mode.PROJECTION);
    }
    if (isIntFamily(inputType)) {
      return createVectorExpression(CastLongToDecimal.class, childExpr, Mode.PROJECTION, returnType);
    } else if (isFloatFamily(inputType)) {
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

  }

  private Decimal128 castConstantToDecimal(Object scalar, TypeInfo type) throws HiveException {
    PrimitiveTypeInfo ptinfo = (PrimitiveTypeInfo) type;
    String typename = type.getTypeName();
    Decimal128 d = new Decimal128();
    int scale = HiveDecimalUtils.getScaleForType(ptinfo);
    switch (ptinfo.getPrimitiveCategory()) {
      case FLOAT:
        float floatVal = ((Float) scalar).floatValue();
        d.update(floatVal, (short) scale);
        break;
      case DOUBLE:
        double doubleVal = ((Double) scalar).doubleValue();
        d.update(doubleVal, (short) scale);
        break;
      case BYTE:
        byte byteVal = ((Byte) scalar).byteValue();
        d.update(byteVal, (short) scale);
        break;
      case SHORT:
        short shortVal = ((Short) scalar).shortValue();
        d.update(shortVal, (short) scale);
        break;
      case INT:
        int intVal = ((Integer) scalar).intValue();
        d.update(intVal, (short) scale);
        break;
      case LONG:
        long longVal = ((Long) scalar).longValue();
        d.update(longVal, (short) scale);
        break;
      case DECIMAL:
        HiveDecimal decimalVal = (HiveDecimal) scalar;
        d.update(decimalVal.unscaledValue(), (short) scale);
        break;
      default:
        throw new HiveException("Unsupported type "+typename+" for cast to Decimal128");
    }
    return d;
View Full Code Here

Examples of org.apache.hadoop.hive.common.type.Decimal128

      } else {
        return 0;
      }
    } else if (decimalTypePattern.matcher(constDesc.getTypeString()).matches()) {
      HiveDecimal hd = (HiveDecimal) constDesc.getValue();
      Decimal128 dvalue = new Decimal128();
      dvalue.update(hd.unscaledValue(), (short) hd.scale());
      return dvalue;
    } else {
      return constDesc.getValue();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.