Package org.apache.flink.types

Examples of org.apache.flink.types.IntValue


    int numRecords = 50000;
   
    int[] hit = new int[numChannels];

    for (int i = 0; i < numRecords; 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


    int numRecords = 50000;
   
    int[] hit = new int[numChannels];

    for (int i = 0; i < numRecords; 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

 
  public static final class ConcatSumMutableReducer extends RichGroupReduceFunction<Tuple2<StringValue, IntValue>, Tuple2<StringValue, IntValue>> {

    @Override
    public void reduce(Iterable<Tuple2<StringValue, IntValue>> values, Collector<Tuple2<StringValue, IntValue>> out) {
      Tuple2<StringValue, IntValue> current = new Tuple2<StringValue, IntValue>(new StringValue(""), new IntValue(0));
     
      for (Tuple2<StringValue, IntValue> next : values) {
        next.f0.append(current.f0);
        next.f1.setValue(current.f1.getValue() + next.f1.getValue());
        current = next;
View Full Code Here

   
    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));
     
      int[] chans = oe1.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
View Full Code Here

    @SuppressWarnings("unchecked")
    final RecordComparator intComp = new RecordComparator(new int[] {1}, new Class[] {IntValue.class});
    final ChannelSelector<Record> oe1 = new RecordOutputEmitter(ShipStrategyType.PARTITION_HASH, intComp);

    Record rec = new Record(0);
    rec.setField(0, new IntValue(1));
   
    try {
      oe1.selectChannels(rec, 100);
    } catch (KeyFieldOutOfBoundsException re) {
      Assert.assertEquals(1, re.getFieldNumber());
View Full Code Here

      v2 = v2        | (0xFF & buf[4]);
      v2 = (v2 << 8) | (0xFF & buf[5]);
      v2 = (v2 << 8) | (0xFF & buf[6]);
      v2 = (v2 << 8) | (0xFF & buf[7]);
     
      reuse.setField(0,new IntValue(v1));
      reuse.setField(1,new IntValue(v2));
     
      this.cnt++;
     
      return reuse;
    }
View Full Code Here

      v2 = v2        | (0xFF & bytes[startPos+4]);
      v2 = (v2 << 8) | (0xFF & bytes[startPos+5]);
      v2 = (v2 << 8) | (0xFF & bytes[startPos+6]);
      v2 = (v2 << 8) | (0xFF & bytes[startPos+7]);
     
      record.setField(0,new IntValue(v1));
      record.setField(1,new IntValue(v2));
     
      cnt++;
     
      return true;
    }
View Full Code Here

     
      Record r = new Record(2);
     
      try {
        r.setField(0, new StringValue("Hello World"));
        r.setField(1, new IntValue(42));
        format.writeRecord(r);
       
        r.setField(0, new StringValue("AbCdE"));
        r.setField(1, new IntValue(13));
        format.writeRecord(r);
       
        format.close();
       
        BufferedReader dis = new BufferedReader(new FileReader(tempFile));
View Full Code Here

     
      boolean success = true;
     
      try {
        r.setField(0, new StringValue("Hello World"));
        r.setField(1, new IntValue(42));
        format.writeRecord(r);
       
        r.setNull(0);
        r.setField(1, new IntValue(13));
        format.writeRecord(r);
       
        format.close();
             
      } catch (IOException e) {
View Full Code Here

     
      Record r = new Record(2);
     
      try {
        r.setField(0, new StringValue("Hello World"));
        r.setField(1, new IntValue(42));
        format.writeRecord(r);
       
        r.setNull(0);
        r.setField(1, new IntValue(13));
        format.writeRecord(r);
       
        format.close();
       
        BufferedReader dis = new BufferedReader(new FileReader(tempFile));
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.