Examples of DecimalTypeInfo


Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

    case HiveParser.TOK_VARCHAR:
      VarcharTypeInfo varcharTypeInfo = ParseUtils.getVarcharTypeInfo(node);
      typeName = varcharTypeInfo.getQualifiedName();
      break;
    case HiveParser.TOK_DECIMAL:
        DecimalTypeInfo decTypeInfo = ParseUtils.getDecimalTypeTypeInfo(node);
        typeName = decTypeInfo.getQualifiedName();
        break;
    default:
      typeName = TokenToTypeName.get(token);
    }
    return typeName;
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

            break;
          case VARCHAR:
            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
            break;
          case DECIMAL:
            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
              gen.getHCatScale());
            break;
          default:
            tInfo = new PrimitiveTypeInfo();
            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

            break;
          case VARCHAR:
            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
            break;
          case DECIMAL:
            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
            gen.getHCatScale());
            break;
          default:
            tInfo = new PrimitiveTypeInfo();
            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

            break;
          case VARCHAR:
            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
            break;
          case DECIMAL:
            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
            gen.getHCatScale());
            break;
          default:
            tInfo = new PrimitiveTypeInfo();
            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

            break;
          case VARCHAR:
            tInfo = new VarcharTypeInfo(gen.getHCatPrecision());
            break;
          case DECIMAL:
            tInfo = new DecimalTypeInfo(gen.getHCatPrecision(),
            gen.getHCatScale());
            break;
          default:
            tInfo = new PrimitiveTypeInfo();
            tInfo.setTypeName(gen.getHCatType().name().toLowerCase());
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

            + " of class " + pigObj.getClass().getName(), PigHCatUtil.PIG_EXCEPTION_CODE);
        }
        return Boolean.parseBoolean( pigObj.toString() );
      case DECIMAL:
        BigDecimal bd = (BigDecimal)pigObj;
        DecimalTypeInfo dti = (DecimalTypeInfo)hcatFS.getTypeInfo();
        if(bd.precision() > dti.precision() || bd.scale() > dti.scale()) {
          handleOutOfRangeValue(pigObj, hcatFS);
          return null;
        }
        return HiveDecimal.create(bd);
      case CHAR:
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

  private final int precision;
  private final int scale;

  public LazyHiveDecimal(LazyHiveDecimalObjectInspector oi) {
    super(oi);
    DecimalTypeInfo typeInfo = (DecimalTypeInfo)oi.getTypeInfo();
    if (typeInfo == null) {
      throw new RuntimeException("Decimal type used without type params");
    }

    precision = typeInfo.precision();
    scale = typeInfo.scale();
    data = new HiveDecimalWritable();
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

  public HiveDecimalWritable getWritableConstantValue() {
    // We need to enforce precision/scale here.
    // A little inefficiency here as we need to create a HiveDecimal instance from the writable and
    // recreate a HiveDecimalWritable instance on the HiveDecimal instance. However, we don't know
    // the precision/scale of the original writable until we get a HiveDecimal instance from it.
    DecimalTypeInfo decTypeInfo = (DecimalTypeInfo)typeInfo;
    HiveDecimal dec = value == null ? null :
      value.getHiveDecimal(decTypeInfo.precision(), decTypeInfo.scale());
    if (dec == null) {
      return null;
    }
    return new HiveDecimalWritable(dec);
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

  private int scale;

  LazyBinaryHiveDecimal(WritableHiveDecimalObjectInspector oi) {
    super(oi);

    DecimalTypeInfo typeInfo = (DecimalTypeInfo) oi.getTypeInfo();
    this.precision = typeInfo.precision();
    this.scale = typeInfo.scale();
    data = new HiveDecimalWritable();
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo

      return returnType;
    }
    PrimitiveTypeInfo ptinfo = (PrimitiveTypeInfo) inputTypeInfo;
    int precision = getPrecisionForType(ptinfo);
    int scale = HiveDecimalUtils.getScaleForType(ptinfo);
    return new DecimalTypeInfo(precision, scale);
  }
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.