org.apache.pig
Interface LoadCaster

All Known Subinterfaces:
LoadStoreCaster, StoreCaster
All Known Implementing Classes:
HBaseBinaryConverter, TextLoader, Utf8StorageConverter

@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface LoadCaster

An interface that provides cast implementations for load functions. For casts between bytearray objects and internal types, Pig relies on the load function that loaded the data to provide the cast. This is because Pig does not understand the binary representation of the data and thus cannot cast it. This interface provides functions to cast from bytearray to each of Pig's internal types.

Since:
Pig 0.7

Method Summary
 DataBag bytesToBag(byte[] b, ResourceSchema.ResourceFieldSchema fieldSchema)
          Cast data from bytearray to bag value.
 Boolean bytesToBoolean(byte[] b)
          Cast data from bytearray to boolean value.
 String bytesToCharArray(byte[] b)
          Cast data from bytearray to chararray value.
 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)
          Deprecated. 
 Map<String,Object> bytesToMap(byte[] b, ResourceSchema.ResourceFieldSchema fieldSchema)
          Cast data from bytearray to map value.
 Tuple bytesToTuple(byte[] b, ResourceSchema.ResourceFieldSchema fieldSchema)
          Cast data from bytearray to tuple value.
 

Method Detail

bytesToBoolean

Boolean bytesToBoolean(byte[] b)
                       throws IOException
Cast data from bytearray to boolean value.

Parameters:
b - bytearray to be cast.
Returns:
Boolean value.
Throws:
IOException - if the value cannot be cast.

bytesToLong

Long bytesToLong(byte[] b)
                 throws IOException
Cast data from bytearray to long value.

Parameters:
b - bytearray to be cast.
Returns:
Long value.
Throws:
IOException - if the value cannot be cast.

bytesToFloat

Float bytesToFloat(byte[] b)
                   throws IOException
Cast data from bytearray to float value.

Parameters:
b - bytearray to be cast.
Returns:
Float value.
Throws:
IOException - if the value cannot be cast.

bytesToDouble

Double bytesToDouble(byte[] b)
                     throws IOException
Cast data from bytearray to double value.

Parameters:
b - bytearray to be cast.
Returns:
Double value.
Throws:
IOException - if the value cannot be cast.

bytesToInteger

Integer bytesToInteger(byte[] b)
                       throws IOException
Cast data from bytearray to integer value.

Parameters:
b - bytearray to be cast.
Returns:
Double value.
Throws:
IOException - if the value cannot be cast.

bytesToCharArray

String bytesToCharArray(byte[] b)
                        throws IOException
Cast data from bytearray to chararray value.

Parameters:
b - bytearray to be cast.
Returns:
String value.
Throws:
IOException - if the value cannot be cast.

bytesToMap

@Deprecated
Map<String,Object> bytesToMap(byte[] b)
                              throws IOException
Deprecated. 

Cast data from bytearray to map value.

Parameters:
b - bytearray to be cast.
Returns:
Map value.
Throws:
IOException - if the value cannot be cast.

bytesToMap

Map<String,Object> bytesToMap(byte[] b,
                              ResourceSchema.ResourceFieldSchema fieldSchema)
                              throws IOException
Cast data from bytearray to map value.

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

Tuple bytesToTuple(byte[] b,
                   ResourceSchema.ResourceFieldSchema fieldSchema)
                   throws IOException
Cast data from bytearray to tuple value.

Parameters:
b - bytearray to be cast.
fieldSchema - field schema for the output tuple
Returns:
Tuple value.
Throws:
IOException - if the value cannot be cast.

bytesToBag

DataBag bytesToBag(byte[] b,
                   ResourceSchema.ResourceFieldSchema fieldSchema)
                   throws IOException
Cast data from bytearray to bag value.

Parameters:
b - bytearray to be cast.
fieldSchema - field schema for the output bag
Returns:
Bag value.
Throws:
IOException - if the value cannot be cast.


Copyright © 2007-2012 The Apache Software Foundation