Package org.apache.flink.types

Examples of org.apache.flink.types.IntValue


   
    int[] hit = new int[numChannels];

    for (int i = 0; i < numRecords; i++) {
      Record rec = new Record(4);
      rec.setField(0, new IntValue(i));
      rec.setField(1, new StringValue("AB"+i+"CD"+i));
      rec.setField(3, new DoubleValue(i*3.141d));
      delegate.setInstance(rec);
     
      int[] chans = oe1.selectChannels(delegate, hit.length);
View Full Code Here


    final TypeComparator<Record> intComp = new RecordComparatorFactory(new int[] {1}, new Class[] {IntValue.class}).createComparator();
    final ChannelSelector<SerializationDelegate<Record>> oe1 = new OutputEmitter<Record>(ShipStrategyType.PARTITION_HASH, intComp);
    final SerializationDelegate<Record> delegate = new SerializationDelegate<Record>(new RecordSerializerFactory().getSerializer());
   
    Record rec = new Record(0);
    rec.setField(0, new IntValue(1));
    delegate.setInstance(rec);
   
    try {
      oe1.selectChannels(delegate, 100);
    } catch (KeyFieldOutOfBoundsException re) {
View Full Code Here

    final TypeComparator<Record> intComp = new RecordComparatorFactory(new int[] {0}, new Class[] {IntValue.class}).createComparator();
    final ChannelSelector<SerializationDelegate<Record>> oe1 = new OutputEmitter<Record>(ShipStrategyType.PARTITION_HASH, intComp);
    final SerializationDelegate<Record> delegate = new SerializationDelegate<Record>(new RecordSerializerFactory().getSerializer());
   
    Record rec = new Record(2);
    rec.setField(1, new IntValue(1));
    delegate.setInstance(rec);

    try {
      oe1.selectChannels(delegate, 100);
    } catch (NullKeyFieldException re) {
View Full Code Here

   
    try {
      out = new DataOutputStream(new PipedOutputStream(pipedInput));
     
      rec = new Record(1);
      rec.setField(0, new IntValue());
     
      rec.write(new OutputViewDataOutputStreamWrapper(out));
      rec = new Record();
      rec.read(new InputViewDataInputStreamWrapper(in));
   
View Full Code Here

  }
 
  public static List<Tuple2<StringValue, IntValue>> createReduceMutableData() {
    List<Tuple2<StringValue, IntValue>> data = new ArrayList<Tuple2<StringValue, IntValue>>();
   
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("a"), new IntValue(1)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("b"), new IntValue(2)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("c"), new IntValue(3)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("d"), new IntValue(4)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("d"), new IntValue(5)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("e"), new IntValue(6)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("e"), new IntValue(7)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("e"), new IntValue(8)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(9)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(10)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(11)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(12)));
   
    return data;
  }
View Full Code Here

  }
 
  public static List<Tuple2<StringValue, IntValue>> createReduceMutableDataGroupedResult() {
    List<Tuple2<StringValue, IntValue>> data = new ArrayList<Tuple2<StringValue, IntValue>>();
   
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("a"), new IntValue(1)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("b"), new IntValue(2)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("c"), new IntValue(3)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("dd"), new IntValue(9)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("eee"), new IntValue(21)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("ffff"), new IntValue(42)));
   
    return data;
  }
View Full Code Here

        bw.write("####_I_AM_INVALID_########\n");
      }
     
      Record rec = new Record();
      while ((rec = inIt.next(rec)) != null) {
        IntValue key = rec.getField(0, IntValue.class);
        IntValue value = rec.getField(1, IntValue.class);
       
        bw.write(key.getValue() + "_" + value.getValue() + "\n");
      }
      if (insertInvalidData) {
        bw.write("####_I_AM_INVALID_########\n");
      }
     
View Full Code Here

    }

    @Override
    public boolean equalToReference(Record candidate) {
      try {
        final IntValue i = candidate.getField(0, IntValue.class);
        return i.getValue() == this.reference;
      } catch (NullPointerException npex) {
        throw new NullKeyFieldException();
      }
    }
View Full Code Here

    }

    @Override
    public int compareToReference(Record candidate) {
      try {
        final IntValue i = candidate.getField(0, IntValue.class);
        return i.getValue() - this.reference;
      } catch (NullPointerException npex) {
        throw new NullKeyFieldException();
      }
    }
View Full Code Here

    int numChans = 100;
    int numRecs = 50000;
    int[] hit = new int[numChans];

    for (int i = 0; i < numRecs; i++) {
      IntValue k = new IntValue(i);
      Record rec = new Record(k);
     
      int[] chans = oe1.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
View Full Code Here

TOP

Related Classes of org.apache.flink.types.IntValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.