org.apache.hadoop.hive.serde2.io
Class HiveDecimalWritable
java.lang.Object
org.apache.hadoop.hive.serde2.io.HiveDecimalWritable
- All Implemented Interfaces:
- Comparable<HiveDecimalWritable>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<HiveDecimalWritable>
public class HiveDecimalWritable
- extends Object
- implements org.apache.hadoop.io.WritableComparable<HiveDecimalWritable>
HiveDecimalWritable
public HiveDecimalWritable()
HiveDecimalWritable
public HiveDecimalWritable(byte[] bytes,
int scale)
HiveDecimalWritable
public HiveDecimalWritable(HiveDecimalWritable writable)
HiveDecimalWritable
public HiveDecimalWritable(HiveDecimal value)
set
public void set(HiveDecimal value)
set
public void set(HiveDecimalWritable writable)
set
public void set(byte[] bytes,
int scale)
setFromBytes
public void setFromBytes(byte[] bytes,
int offset,
int length)
getHiveDecimal
public HiveDecimal getHiveDecimal()
getHiveDecimal
public HiveDecimal getHiveDecimal(int maxPrecision,
int maxScale)
- Get a HiveDecimal instance from the writable and constraint it with maximum precision/scale.
- Parameters:
maxPrecision
- maximum precisionmaxScale
- maximum scale
- Returns:
- HiveDecimal instance
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
compareTo
public int compareTo(HiveDecimalWritable that)
- Specified by:
compareTo
in interface Comparable<HiveDecimalWritable>
writeToByteStream
public static void writeToByteStream(Decimal128 dec,
ByteStream.Output byteStream)
writeToByteStream
public void writeToByteStream(ByteStream.Output byteStream)
toString
public String toString()
- Overrides:
toString
in class Object
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
getInternalStorage
public byte[] getInternalStorage()
getScale
public int getScale()
Copyright © 2014 The Apache Software Foundation. All rights reserved.