当前位置: 首页>>代码示例>>Java>>正文


Java LoadCaster类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:29,代码来源:CastUtils.java

示例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);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:29,代码来源:CastUtils.java

示例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);
    }
}
 
开发者ID:PonIC,项目名称:PonIC,代码行数:26,代码来源:CastUtils.java

示例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;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:30,代码来源:LineageFindRelVisitor.java

示例5: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
	return new RDFStorageConverter();
}
 
开发者ID:aschaetzle,项目名称:PigSPARQL,代码行数:5,代码来源:NTriplesStorage.java

示例6: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() {
    return this;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:TextLoader.java

示例7: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
  return super.getLoadCaster();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:Storage.java

示例8: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {        
    return new Utf8StorageConverter();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:PigStreaming.java

示例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;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:6,代码来源:JsonLoader.java

示例10: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
    throw new UnsupportedOperationException();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:DefaultIndexableLoader.java

示例11: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
    return loader.getLoadCaster();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:SampleLoader.java

示例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_;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:8,代码来源:HBaseStorage.java

示例13: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
    return new Utf8StorageConverter();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:DumpStreamerBad.java

示例14: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override 
public LoadCaster getLoadCaster() throws IOException {
    return new Utf8StorageConverter();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:DumpStreamer.java

示例15: getLoadCaster

import org.apache.pig.LoadCaster; //导入依赖的package包/类
@Override
public LoadCaster getLoadCaster() throws IOException {
    return null;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:5,代码来源:TestLogicalPlanBuilder.java


注:本文中的org.apache.pig.LoadCaster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。