• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResolvingDecoder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.avro.io.ResolvingDecoder的典型用法代码示例。如果您正苦于以下问题:Java ResolvingDecoder类的具体用法?Java ResolvingDecoder怎么用?Java ResolvingDecoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResolvingDecoder类属于org.apache.avro.io包,在下文中一共展示了ResolvingDecoder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readRecord

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
/**
 * Called to read a record instance. Overridden to read a pig tuple.
 */
@Override
protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException {

    // find out the order in which we will receive fields from the ResolvingDecoder
    Field[] readOrderedFields = in.readFieldOrder();

    /* create an empty tuple */
    Tuple tuple = TupleFactory.getInstance().newTuple(readOrderedFields.length);

    /* read fields and put in output order in tuple
     * The ResolvingDecoder figures out the writer schema to reader schema mapping for us
     */
    for (Field f : readOrderedFields) {
        tuple.set(f.pos(), read(old, f.schema(), in));
    }

    return tuple;
}
 
开发者ID:linkedin,项目名称:Cubert,代码行数:22,代码来源:PigAvroDatumReader.java


示例2: readMap

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Object readMap(Object old, Schema expected, ResolvingDecoder in)
    throws IOException {
  StatefulMap<Utf8, ?> map = (StatefulMap<Utf8, ?>) newMap(old, 0);
  Map<Utf8, State> tempStates = null;
  if (readDirtyBits) {
    tempStates = new HashMap<Utf8, State>();
    int size = in.readInt();
    for (int j = 0; j < size; j++) {
      Utf8 key = in.readString(null);
      State state = State.values()[in.readInt()];
      tempStates.put(key, state);
    }
  }
  super.readMap(map, expected, in);
  map.clearStates();
  if (readDirtyBits) {
    for (Entry<Utf8, State> entry : tempStates.entrySet()) {
      map.putState(entry.getKey(), entry.getValue());
    }
  }
  return map;
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:25,代码来源:PersistentDatumReader.java


示例3: readMap

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
/**
 * Called to read a map instance. Overridden to read a pig map.
 */
protected Object readMap(Object old, Schema expected, ResolvingDecoder in) throws IOException {
    Schema eValue = expected.getValueType();
    long l = in.readMapStart();
    Object map = newMap(old, (int) l);
    if (l > 0) {
        do {
            for (int i = 0; i < l; i++) {
                addToMap(map, readString(null, AvroStorageUtils.StringSchema, in),
                                  read(null, eValue, in));
            }
        } while ((l = in.mapNext()) > 0);
    }
    return map;
}
 
开发者ID:linkedin,项目名称:Cubert,代码行数:18,代码来源:PigAvroDatumReader.java


示例4: read

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public D read(final D reuse, final Decoder in) throws IOException {
    final ResolvingDecoder resolver = new ByteBufResolvingDecoder(Schema.applyAliases(this.getSchema(), this.getExpected()), this.getExpected(),
            in);

    final D result = (D) this.read(reuse, this.getExpected(), resolver);
    resolver.drain();
    return result;
}
 
开发者ID:milenkovicm,项目名称:avro-netty,代码行数:11,代码来源:NettyGenericDatumReader.java


示例5: getResolvingDecoder

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
protected ResolvingDecoder getResolvingDecoder(Decoder decoder)
throws IOException {
  ResolvingDecoder resolvingDecoder = decoderCache.get(decoder);
  if(resolvingDecoder == null) {
    resolvingDecoder = new FakeResolvingDecoder(rootSchema, decoder);
    decoderCache.put(decoder, resolvingDecoder);
  }
  return resolvingDecoder;
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:10,代码来源:PersistentDatumReader.java


示例6: readRecord

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
/**
 * Called to read a record instance. Overridden to read a pig tuple.
 */
@Override
protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException {

    /* create an empty tuple */
    Tuple tuple = (Tuple) newRecord(old, expected);

    for (Field f : in.readFieldOrder()) {
        tuple.append(read(null, f.schema(), in));
    }

    return tuple;
}
 
开发者ID:kaituo,项目名称:sedge,代码行数:16,代码来源:PigAvroDatumReader.java


示例7: createResolver

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
protected ResolvingDecoder createResolver(Schema writerSchema, Schema readerSchema) throws IOException {
  return DecoderFactory.get().resolvingDecoder(
      Schema.applyAliases(writerSchema, readerSchema), readerSchema, null);
}
 
开发者ID:cloudera,项目名称:cdk,代码行数:5,代码来源:ReadAvroContainerBuilder.java


示例8: setResolver

import org.apache.avro.io.ResolvingDecoder; //导入依赖的package包/类
/** Call this whenever appropriate */
public void setResolver(ResolvingDecoder resolver) {
  this.resolver = resolver;
}
 
开发者ID:cloudera,项目名称:cdk,代码行数:5,代码来源:FastGenericDatumReader.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LinkDiscoveryManager类代码示例发布时间:2022-05-22
下一篇:
Java EnumItemReach类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap