org.apache.hadoop.hive.serde2.io
Class HiveDecimalWritable

java.lang.Object
  extended by 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>


Constructor Summary
HiveDecimalWritable()
           
HiveDecimalWritable(byte[] bytes, int scale)
           
HiveDecimalWritable(HiveDecimal value)
           
HiveDecimalWritable(HiveDecimalWritable writable)
           
 
Method Summary
 int compareTo(HiveDecimalWritable that)
           
 boolean equals(Object other)
           
 HiveDecimal getHiveDecimal()
           
 HiveDecimal getHiveDecimal(int maxPrecision, int maxScale)
          Get a HiveDecimal instance from the writable and constraint it with maximum precision/scale.
 byte[] getInternalStorage()
           
 int getScale()
           
 int hashCode()
           
 void readFields(DataInput in)
           
 void set(byte[] bytes, int scale)
           
 void set(HiveDecimal value)
           
 void set(HiveDecimalWritable writable)
           
 void setFromBytes(byte[] bytes, int offset, int length)
           
 String toString()
           
 void write(DataOutput out)
           
 void writeToByteStream(ByteStream.Output byteStream)
           
static void writeToByteStream(Decimal128 dec, ByteStream.Output byteStream)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HiveDecimalWritable

public HiveDecimalWritable()

HiveDecimalWritable

public HiveDecimalWritable(byte[] bytes,
                           int scale)

HiveDecimalWritable

public HiveDecimalWritable(HiveDecimalWritable writable)

HiveDecimalWritable

public HiveDecimalWritable(HiveDecimal value)
Method Detail

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 precision
maxScale - 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.