Java Code Examples for org.apache.hadoop.io.DoubleWritable#set()
The following examples show how to use
org.apache.hadoop.io.DoubleWritable#set() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomerFlowElement.java From WIFIProbe with Apache License 2.0 | 5 votes |
public void write(DataOutput dataOutput) throws IOException { Text text = new Text(wifiProb==null?"":wifiProb); text.write(dataOutput); IntWritable intWritable = new IntWritable(); intWritable.set(inNoOutWifi); intWritable.write(dataOutput); intWritable.set(inNoOutStore); intWritable.write(dataOutput); intWritable.set(outNoInWifi); intWritable.write(dataOutput); intWritable.set(outNoInStore); intWritable.write(dataOutput); intWritable.set(inAndOutWifi); intWritable.write(dataOutput); intWritable.set(inAndOutStore); intWritable.write(dataOutput); intWritable.set(stayInWifi); intWritable.write(dataOutput); intWritable.set(stayInStore); intWritable.write(dataOutput); DoubleWritable doubleWritable = new DoubleWritable(); doubleWritable.set(jumpRate); doubleWritable.write(dataOutput); doubleWritable.set(deepVisit); doubleWritable.write(dataOutput); doubleWritable.set(inStoreRate); doubleWritable.write(dataOutput); }
Example 2
Source File: KettleTypeToDoubleWritableConverter.java From pentaho-hadoop-shims with Apache License 2.0 | 5 votes |
@Override public DoubleWritable convert( ValueMetaInterface meta, Object obj ) throws TypeConversionException { try { DoubleWritable result = new DoubleWritable(); result.set( meta.getNumber( obj ) ); return result; } catch ( KettleValueException ex ) { throw new TypeConversionException( BaseMessages .getString( TypeConverterFactory.class, "ErrorConverting", DoubleWritable.class.getSimpleName(), obj ), ex ); } }
Example 3
Source File: CustomWritable.java From pxf with Apache License 2.0 | 4 votes |
@Override public void write(DataOutput out) throws IOException { // 0. Timestamp Text tms_text = new Text(tms); tms_text.write(out); // 1. num, int1, int2 IntWritable intw = new IntWritable(); for (int i = 0; i < num.length; i++) { intw.set(num[i]); intw.write(out); } intw.set(int1); intw.write(out); intw.set(int2); intw.write(out); // 2. st1 Text txt = new Text(); for (int i = 0; i < strings.length; i++) { txt.set(strings[i]); txt.write(out); } txt.set(st1); txt.write(out); // 3. doubles DoubleWritable dw = new DoubleWritable(); for (int i = 0; i < dubs.length; i++) { dw.set(dubs[i]); dw.write(out); } dw.set(db); dw.write(out); // 4. floats FloatWritable fw = new FloatWritable(); for (int i = 0; i < fts.length; i++) { fw.set(fts[i]); fw.write(out); } fw.set(ft); fw.write(out); // 5. longs LongWritable lw = new LongWritable(); for (int i = 0; i < lngs.length; i++) { lw.set(lngs[i]); lw.write(out); } lw.set(lng); lw.write(out); // 6. booleans BooleanWritable bw = new BooleanWritable(); for (int i = 0; i < bools.length; ++i) { bw.set(bools[i]); bw.write(out); } bw.set(bool); bw.write(out); // 7. shorts ShortWritable sw = new ShortWritable(); for (int i = 0; i < shrts.length; ++i) { sw.set(shrts[i]); sw.write(out); } sw.set(shrt); sw.write(out); // 8. bytes // BytesWritable btsw = new BytesWritable(bts); // btsw.write(out); BytesWritable btsw = new BytesWritable(); btsw.setCapacity(bts.length); btsw.setSize(bts.length); btsw.set(bts, 0, bts.length); btsw.write(out); }