本文整理汇总了Java中org.apache.pig.LoadCaster.bytesToLong方法的典型用法代码示例。如果您正苦于以下问题:Java LoadCaster.bytesToLong方法的具体用法?Java LoadCaster.bytesToLong怎么用?Java LoadCaster.bytesToLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.LoadCaster
的用法示例。
在下文中一共展示了LoadCaster.bytesToLong方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToType
import org.apache.pig.LoadCaster; //导入方法依赖的package包/类
/**
*
* @param caster LoadCaster to be used to convert the bytes into a field.
* @param bytes
* @param fieldSchema schema of Bag or Tuple; pass in null if a simple type.
* @param dataType type from DataType
* @return converted object.
* @throws IOException
*/
public static Object convertToType(LoadCaster caster, byte[] bytes,
ResourceFieldSchema fieldSchema, byte dataType) throws IOException {
switch (dataType) {
case (DataType.BAG): return caster.bytesToBag(bytes, fieldSchema);
case (DataType.BYTEARRAY): return new DataByteArray(bytes);
case (DataType.CHARARRAY): return caster.bytesToCharArray(bytes);
case (DataType.DOUBLE): return caster.bytesToDouble(bytes);
case (DataType.FLOAT): return caster.bytesToFloat(bytes);
case (DataType.INTEGER): return caster.bytesToInteger(bytes);
case (DataType.BIGINTEGER): return caster.bytesToBigInteger(bytes);
case (DataType.BIGDECIMAL): return caster.bytesToBigDecimal(bytes);
case (DataType.LONG): return caster.bytesToLong(bytes);
case (DataType.BOOLEAN): return caster.bytesToBoolean(bytes);
case (DataType.DATETIME): return caster.bytesToDateTime(bytes);
case (DataType.MAP): return caster.bytesToMap(bytes);
case (DataType.TUPLE): return caster.bytesToTuple(bytes, fieldSchema);
default: throw new IOException("Unknown type " + dataType);
}
}
示例2: convertToType
import org.apache.pig.LoadCaster; //导入方法依赖的package包/类
/**
*
* @param caster LoadCaster to be used to convert the bytes into a field.
* @param bytes
* @param fieldSchema schema of Bag or Tuple; pass in null if a simple type.
* @param dataType type from DataType
* @return converted object.
* @throws IOException
*/
public static Object convertToType(LoadCaster caster, byte[] bytes,
ResourceFieldSchema fieldSchema, byte dataType) throws IOException {
switch (dataType) {
case (DataType.BAG): return caster.bytesToBag(bytes, fieldSchema);
case (DataType.BYTEARRAY): return new DataByteArray(bytes);
case (DataType.CHARARRAY): return caster.bytesToCharArray(bytes);
case (DataType.DOUBLE): return caster.bytesToDouble(bytes);
case (DataType.FLOAT): return caster.bytesToFloat(bytes);
case (DataType.INTEGER): return caster.bytesToInteger(bytes);
case (DataType.BIGINTEGER): return caster.bytesToBigInteger(bytes);
case (DataType.BIGDECIMAL): return caster.bytesToBigDecimal(bytes);
case (DataType.LONG): return caster.bytesToLong(bytes);
case (DataType.BOOLEAN): return caster.bytesToBoolean(bytes);
case (DataType.DATETIME): return caster.bytesToDateTime(bytes);
case (DataType.MAP): return caster.bytesToMap(bytes, fieldSchema);
case (DataType.TUPLE): return caster.bytesToTuple(bytes, fieldSchema);
default: throw new IOException("Unknown type " + dataType);
}
}
示例3: convertToType
import org.apache.pig.LoadCaster; //导入方法依赖的package包/类
/**
*
* @param caster LoadCaster to be used to convert the bytes into a field.
* @param bytes
* @param fieldSchema schema of Bag or Tuple; pass in null if a simple type.
* @param dataType type from DataType
* @return converted object.
* @throws IOException
*/
public static Object convertToType(LoadCaster caster, byte[] bytes,
ResourceFieldSchema fieldSchema, byte dataType) throws IOException {
switch (dataType) {
case (DataType.BAG): return caster.bytesToBag(bytes, fieldSchema);
case (DataType.BYTEARRAY): return new DataByteArray(bytes);
case (DataType.CHARARRAY): return caster.bytesToCharArray(bytes);
case (DataType.DOUBLE): return caster.bytesToDouble(bytes);
case (DataType.FLOAT): return caster.bytesToFloat(bytes);
case (DataType.INTEGER): return caster.bytesToInteger(bytes);
case (DataType.LONG): return caster.bytesToLong(bytes);
case (DataType.BOOLEAN): return caster.bytesToBoolean(bytes);
case (DataType.MAP): return caster.bytesToMap(bytes);
case (DataType.TUPLE): return caster.bytesToTuple(bytes, fieldSchema);
default: throw new IOException("Unknown type " + dataType);
}
}