本文整理汇总了Java中org.apache.pig.LoadCaster类的典型用法代码示例。如果您正苦于以下问题:Java LoadCaster类的具体用法?Java LoadCaster怎么用?Java LoadCaster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadCaster类属于org.apache.pig包,在下文中一共展示了LoadCaster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例4: instantiateCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
private Class instantiateCaster(FuncSpec funcSpec) throws VisitorException {
if ( funcSpec == null ) {
return null;
}
if( func2casterMap.containsKey(funcSpec) ) {
return func2casterMap.get(funcSpec);
}
LoadCaster caster = null;
Object obj = PigContext.instantiateFuncFromSpec(funcSpec);
try {
if (obj instanceof LoadFunc) {
caster = ((LoadFunc)obj).getLoadCaster();
} else if (obj instanceof StreamToPig) {
caster = ((StreamToPig)obj).getLoadCaster();
} else {
throw new VisitorException("Invalid class type " + funcSpec.getClassName(),
2270, PigException.BUG );
}
} catch (IOException e) {
throw new VisitorException("Invalid class type " + funcSpec.getClassName(),
2270, e );
}
Class retval = (caster == null) ? null : caster.getClass();
func2casterMap.put(funcSpec, retval);
return retval;
}
示例5: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return new RDFStorageConverter();
}
示例6: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() {
return this;
}
示例7: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return super.getLoadCaster();
}
示例8: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return new Utf8StorageConverter();
}
示例9: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
public LoadCaster getLoadCaster() throws IOException {
// We do not expect to do casting of byte arrays, because we will be
// returning typed data.
return null;
}
示例10: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
throw new UnsupportedOperationException();
}
示例11: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return loader.getLoadCaster();
}
示例12: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
/**
* Set up the caster to use for reading values out of, and writing to, HBase.
*/
@Override
public LoadCaster getLoadCaster() throws IOException {
return caster_;
}
示例13: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return new Utf8StorageConverter();
}
示例14: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return new Utf8StorageConverter();
}
示例15: getLoadCaster
import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
return null;
}