DecimalTypeInfo dinfo = (DecimalTypeInfo) pinfo; return TypeDescription.createDecimal() .withScale(dinfo.getScale()) .withPrecision(dinfo.getPrecision());
DecimalTypeInfo dinfo = (DecimalTypeInfo) pinfo; return TypeDescription.createDecimal() .withScale(dinfo.getScale()) .withPrecision(dinfo.getPrecision());
private static TypeDescription convertType(final DataType fieldType) { if (fieldType instanceof BooleanType) { return TypeDescription.createBoolean(); } else if (fieldType instanceof ByteType) { return TypeDescription.createByte(); } else if (fieldType instanceof ShortType) { return TypeDescription.createShort(); } else if (fieldType instanceof IntType) { return TypeDescription.createInt(); } else if (fieldType instanceof LongType) { return TypeDescription.createLong(); } else if (fieldType instanceof FloatType) { return TypeDescription.createFloat(); } else if (fieldType instanceof DoubleType) { return TypeDescription.createDouble(); } else if (fieldType instanceof StringType || fieldType instanceof ByteArrayType) { return TypeDescription.createString(); } else if (fieldType instanceof DateType) { return TypeDescription.createDate(); } else if (fieldType instanceof TimestampType) { return TypeDescription.createTimestamp(); } else if (fieldType instanceof DecimalType) { int precision = ((DecimalType) fieldType).precision(); int scale = ((DecimalType) fieldType).scale(); return TypeDescription.createDecimal().withPrecision(precision).withScale(scale); } else { throw new UnsupportedOperationException("Unsupported category: " + fieldType); } } }
int precision = parseInt(source); requireChar(source, ','); result.withScale(parseInt(source)); result.withPrecision(precision); requireChar(source, ')');
Types.DecimalType decimal = (Types.DecimalType) type; result = TypeDescription.createDecimal() .withScale(decimal.scale()) .withPrecision(decimal.precision()); break;
TypeDescription result = TypeDescription.createDecimal(); if (type.hasScale()) { result.withScale(type.getScale());