Java 类org.apache.avro.io.ResolvingDecoder 实例源码

项目:Cubert    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:spork-streaming    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:spork    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:CalcEngine    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:gora-0.3-simplified    文件:PersistentDatumReader.java   
@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;
}
项目:gora-oraclenosql    文件:PersistentDatumReader.java   
@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;
}
项目:Cubert    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:spork-streaming    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:avro-netty    文件:NettyGenericDatumReader.java   
@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;
}
项目:spork    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:CalcEngine    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:gora-0.3-simplified    文件:PersistentDatumReader.java   
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;
}
项目:gora-oraclenosql    文件:PersistentDatumReader.java   
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;
}
项目:sedge    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:sedge    文件:PigAvroDatumReader.java   
/**
 * 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;
}
项目:cdk    文件:ReadAvroContainerBuilder.java   
protected ResolvingDecoder createResolver(Schema writerSchema, Schema readerSchema) throws IOException {
  return DecoderFactory.get().resolvingDecoder(
      Schema.applyAliases(writerSchema, readerSchema), readerSchema, null);
}
项目:cdk    文件:FastGenericDatumReader.java   
/** Call this whenever appropriate */
public void setResolver(ResolvingDecoder resolver) {
  this.resolver = resolver;
}