Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.FloatWritable


    assertEquals(md5HashKey1, md5HashKey2);
  }

  @Test
  public void testMD5HashForFloatWritableKey() throws IOException {
    FloatWritable key = new FloatWritable(1.025f);
    MD5Hash md5HashKey1 = HashUtility.getMD5Hash(key);
    MD5Hash md5HashKey2 = HashUtility.getMD5Hash(key);
    assertEquals(md5HashKey1, md5HashKey2);
  }
View Full Code Here


    return o == null ? null : new OrcLazyFloat((OrcLazyFloat) o);
  }

  @Override
  public Object getPrimitiveJavaObject(Object o) {
    FloatWritable writable = getPrimitiveWritableObject(o);
    return writable == null ? null : Float.valueOf(writable.get());
  }
View Full Code Here

  }

  public OrcLazyFloat(OrcLazyFloat copy) {
    super(copy);
    if (copy.previous != null) {
      previous = new FloatWritable(((FloatWritable)copy.previous).get());
    }
  }
View Full Code Here

    } else {
      assertEquals(expected.long3.longValue(), long3.get());
    }

    OrcLazyFloat lazyFloat1 = (OrcLazyFloat) row.getFieldValue(11);
    FloatWritable float1 = (FloatWritable) lazyFloat1.materialize();
    if (float1 == null) {
      assertNull(expected.float1);
    } else {
      assertEquals(expected.float1.floatValue(), float1.get(), 0.0001);
    }

    OrcLazyDouble lazyDouble1 = (OrcLazyDouble) row.getFieldValue(12);
    DoubleWritable double1 = (DoubleWritable) lazyDouble1.materialize();
    if (double1 == null) {
View Full Code Here

    return latestRead;
  }


  FloatWritable createWritable(Object previous, float value) throws IOException {
    FloatWritable result = null;
    if (previous == null) {
      result = new FloatWritable();
    } else {
      result = (FloatWritable) previous;
    }
    result.set(value);
    return result;
  }
View Full Code Here

    return readFloat();
  }

  @Override
  public Object next(Object previous) throws IOException {
    FloatWritable result = null;
    if (valuePresent) {
      result = createWritable(previous, readFloat());
    }
    return result;
  }
View Full Code Here

      int nextCalls = 0;

      @Override
      public Object next(Object previous) throws IOException {
        if (nextCalls == 0) {
          return new FloatWritable(1.0f);
        }

        throw new IOException("next should only be called once");
      }
View Full Code Here

    map.put(new Text("two"), new VLongWritable(2));
    Writable[] writables = new Writable[] {
      new BytesWritable(new byte[] { 1, 2, 3, 4 }),
      new ByteWritable((byte) 123), new BooleanWritable(true),
      new VIntWritable(12345), new VLongWritable(123456789L),
      new FloatWritable((float) 1.2), new DoubleWritable(1.234),
      new Text("random string"),
      new ObjectWritable("test")
    };
    TypedBytesWritable tbw = new TypedBytesWritable();
    tbw.setValue("typed bytes text");
View Full Code Here

    }

    @Test
    public void addThemUp() throws IOException, InterruptedException {
        Iterable<FloatWritable> those=new RecyclingIterable(FloatWritable.class,
                new FloatWritable(0.2F),
                new FloatWritable(0.7F),
                new FloatWritable(0.1F)
        );

        reducer.reduce(new Text("<http://www.example.com/Headknocker>"),those,context);
        verify(context).write(
                new Text("<http://www.example.com/Headknocker>"),
View Full Code Here

    @Test
    public void tryOne() throws IOException, InterruptedException {
        Text triple=new Text("<http://example.com/>\t<http://rdf.basekb.com/public/subjectiveEye3D>\t\"3.14159\"^^xsd:float\t.");
        mapper.map(new LongWritable(99),triple,context);
        verify(context).write(new Text("<http://example.com/>"),new FloatWritable(3.14159F));
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.FloatWritable

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.