org.apache.pig.backend.hadoop.accumulo
Class AccumuloBinaryConverter

java.lang.Object
  extended by org.apache.pig.backend.hadoop.accumulo.AccumuloBinaryConverter
All Implemented Interfaces:
LoadCaster, LoadStoreCaster, StoreCaster

public class AccumuloBinaryConverter
extends Object
implements LoadStoreCaster

A LoadStoreCaster implementation which stores most type implementations as bytes generated from the toString representation with a UTF8 Charset. Pulled some implementations from the Accumulo Lexicoder implementations in 1.6.0.


Constructor Summary
AccumuloBinaryConverter()
           
 
Method Summary
 DataBag bytesToBag(byte[] b, ResourceSchema.ResourceFieldSchema fieldSchema)
          NOT IMPLEMENTED
 BigDecimal bytesToBigDecimal(byte[] b)
          Cast data from bytearray to BigDecimal value.
 BigInteger bytesToBigInteger(byte[] b)
          Cast data from bytearray to BigInteger value.
 Boolean bytesToBoolean(byte[] b)
          Cast data from bytearray to boolean value.
 String bytesToCharArray(byte[] b)
          Cast data from bytearray to chararray value.
 org.joda.time.DateTime bytesToDateTime(byte[] b)
          NOT IMPLEMENTED
 Double bytesToDouble(byte[] b)
          Cast data from bytearray to double value.
 Float bytesToFloat(byte[] b)
          Cast data from bytearray to float value.
 Integer bytesToInteger(byte[] b)
          Cast data from bytearray to integer value.
 Long bytesToLong(byte[] b)
          Cast data from bytearray to long value.
 Map<String,Object> bytesToMap(byte[] b, ResourceSchema.ResourceFieldSchema fieldSchema)
          NOT IMPLEMENTED
 Tuple bytesToTuple(byte[] b, ResourceSchema.ResourceFieldSchema fieldSchema)
          NOT IMPLEMENTED
 byte[] toBytes(BigDecimal bd)
          Not implemented!
 byte[] toBytes(BigInteger bi)
           
 byte[] toBytes(Boolean b)
           
 byte[] toBytes(DataBag bag)
          NOT IMPLEMENTED
 byte[] toBytes(DataByteArray a)
           
 byte[] toBytes(org.joda.time.DateTime dt)
           
 byte[] toBytes(Double d)
           
 byte[] toBytes(Float f)
           
 byte[] toBytes(Integer val)
           
 byte[] toBytes(Long val)
           
 byte[] toBytes(Map<String,Object> m)
          NOT IMPLEMENTED
 byte[] toBytes(String s)
           
 byte[] toBytes(Tuple t)
          NOT IMPLEMENTED
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccumuloBinaryConverter

public AccumuloBinaryConverter()
Method Detail

bytesToBag

public DataBag bytesToBag(byte[] b,
                          ResourceSchema.ResourceFieldSchema fieldSchema)
                   throws IOException
NOT IMPLEMENTED

Specified by:
bytesToBag in interface LoadCaster
Parameters:
b - bytearray to be cast.
fieldSchema - field schema for the output bag
Returns:
Bag value.
Throws:
IOException - if the value cannot be cast.

bytesToBigDecimal

public BigDecimal bytesToBigDecimal(byte[] b)
                             throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to BigDecimal value.

Specified by:
bytesToBigDecimal in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
BigInteger value.
Throws:
IOException - if the value cannot be cast.

bytesToBigInteger

public BigInteger bytesToBigInteger(byte[] b)
                             throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to BigInteger value.

Specified by:
bytesToBigInteger in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
BigInteger value.
Throws:
IOException - if the value cannot be cast.

bytesToBoolean

public Boolean bytesToBoolean(byte[] b)
                       throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to boolean value.

Specified by:
bytesToBoolean in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
Boolean value.
Throws:
IOException - if the value cannot be cast.

bytesToCharArray

public String bytesToCharArray(byte[] b)
                        throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to chararray value.

Specified by:
bytesToCharArray in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
String value.
Throws:
IOException - if the value cannot be cast.

bytesToDateTime

public org.joda.time.DateTime bytesToDateTime(byte[] b)
                                       throws IOException
NOT IMPLEMENTED

Specified by:
bytesToDateTime in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
datetime value.
Throws:
IOException - if the value cannot be cast.

bytesToDouble

public Double bytesToDouble(byte[] b)
                     throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to double value.

Specified by:
bytesToDouble in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
Double value.
Throws:
IOException - if the value cannot be cast.

bytesToFloat

public Float bytesToFloat(byte[] b)
                   throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to float value.

Specified by:
bytesToFloat in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
Float value.
Throws:
IOException - if the value cannot be cast.

bytesToInteger

public Integer bytesToInteger(byte[] b)
                       throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to integer value.

Specified by:
bytesToInteger in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
Double value.
Throws:
IOException - if the value cannot be cast.

bytesToLong

public Long bytesToLong(byte[] b)
                 throws IOException
Description copied from interface: LoadCaster
Cast data from bytearray to long value.

Specified by:
bytesToLong in interface LoadCaster
Parameters:
b - bytearray to be cast.
Returns:
Long value.
Throws:
IOException - if the value cannot be cast.

bytesToMap

public Map<String,Object> bytesToMap(byte[] b,
                                     ResourceSchema.ResourceFieldSchema fieldSchema)
                              throws IOException
NOT IMPLEMENTED

Specified by:
bytesToMap in interface LoadCaster
Parameters:
b - bytearray to be cast.
fieldSchema - field schema for the output map
Returns:
Map value.
Throws:
IOException - if the value cannot be cast.

bytesToTuple

public Tuple bytesToTuple(byte[] b,
                          ResourceSchema.ResourceFieldSchema fieldSchema)
                   throws IOException
NOT IMPLEMENTED

Specified by:
bytesToTuple in interface LoadCaster
Parameters:
b - bytearray to be cast.
fieldSchema - field schema for the output tuple
Returns:
Tuple value.
Throws:
IOException - if the value cannot be cast.

toBytes

public byte[] toBytes(BigDecimal bd)
               throws IOException
Not implemented!

Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(BigInteger bi)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Boolean b)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(DataBag bag)
               throws IOException
NOT IMPLEMENTED

Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(DataByteArray a)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(org.joda.time.DateTime dt)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Double d)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Float f)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Integer val)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Long val)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Map<String,Object> m)
               throws IOException
NOT IMPLEMENTED

Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(String s)
               throws IOException
Specified by:
toBytes in interface StoreCaster
Throws:
IOException

toBytes

public byte[] toBytes(Tuple t)
               throws IOException
NOT IMPLEMENTED

Specified by:
toBytes in interface StoreCaster
Throws:
IOException


Copyright © 2007-2012 The Apache Software Foundation