org.apache.hadoop.io.VLongWritable Java Examples
The following examples show how to use
org.apache.hadoop.io.VLongWritable.
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: IndexInfo.java From datawave with Apache License 2.0 | 6 votes |
@Override public void readFields(DataInput in) throws IOException { VLongWritable count = new VLongWritable(); count.readFields(in); this.count = count.get(); VIntWritable nUidsReader = new VIntWritable(); nUidsReader.readFields(in); final int nUids = nUidsReader.get(); ImmutableSortedSet.Builder<IndexMatch> setBuilder = ImmutableSortedSet.naturalOrder(); for (int i = 0; i < nUids; ++i) { IndexMatch index = new IndexMatch(); index.readFields(in); setBuilder.add(index); } this.uids = setBuilder.build(); }
Example #2
Source File: IndexInfo.java From datawave with Apache License 2.0 | 5 votes |
@Override public void write(DataOutput out) throws IOException { new VLongWritable(count).write(out); new VIntWritable(uids.size()).write(out); for (IndexMatch uid : uids) uid.write(out); }
Example #3
Source File: TypedBytesWritableInput.java From hadoop with Apache License 2.0 | 5 votes |
public Class<? extends Writable> readType() throws IOException { Type type = in.readType(); if (type == null) { return null; } switch (type) { case BYTES: return BytesWritable.class; case BYTE: return ByteWritable.class; case BOOL: return BooleanWritable.class; case INT: return VIntWritable.class; case LONG: return VLongWritable.class; case FLOAT: return FloatWritable.class; case DOUBLE: return DoubleWritable.class; case STRING: return Text.class; case VECTOR: return ArrayWritable.class; case MAP: return MapWritable.class; case WRITABLE: return Writable.class; default: throw new RuntimeException("unknown type"); } }
Example #4
Source File: TypedBytesWritableOutput.java From hadoop with Apache License 2.0 | 5 votes |
public void write(Writable w) throws IOException { if (w instanceof TypedBytesWritable) { writeTypedBytes((TypedBytesWritable) w); } else if (w instanceof BytesWritable) { writeBytes((BytesWritable) w); } else if (w instanceof ByteWritable) { writeByte((ByteWritable) w); } else if (w instanceof BooleanWritable) { writeBoolean((BooleanWritable) w); } else if (w instanceof IntWritable) { writeInt((IntWritable) w); } else if (w instanceof VIntWritable) { writeVInt((VIntWritable) w); } else if (w instanceof LongWritable) { writeLong((LongWritable) w); } else if (w instanceof VLongWritable) { writeVLong((VLongWritable) w); } else if (w instanceof FloatWritable) { writeFloat((FloatWritable) w); } else if (w instanceof DoubleWritable) { writeDouble((DoubleWritable) w); } else if (w instanceof Text) { writeText((Text) w); } else if (w instanceof ArrayWritable) { writeArray((ArrayWritable) w); } else if (w instanceof MapWritable) { writeMap((MapWritable) w); } else if (w instanceof SortedMapWritable) { writeSortedMap((SortedMapWritable) w); } else if (w instanceof Record) { writeRecord((Record) w); } else { writeWritable(w); // last resort } }
Example #5
Source File: InternalUtilities.java From marklogic-contentpump with Apache License 2.0 | 5 votes |
/** * Create new XdmValue from value type and Writables. * */ public static XdmValue newValue(ValueType valueType, Object value) { if (value instanceof Text) { return ValueFactory.newValue(valueType, ((Text)value).toString()); } else if (value instanceof BytesWritable) { return ValueFactory.newValue(valueType, ((BytesWritable)value).getBytes()); } else if (value instanceof IntWritable) { return ValueFactory.newValue(valueType, ((IntWritable)value).get()); } else if (value instanceof LongWritable) { return ValueFactory.newValue(valueType, ((LongWritable)value).get()); } else if (value instanceof VIntWritable) { return ValueFactory.newValue(valueType, ((VIntWritable)value).get()); } else if (value instanceof VLongWritable) { return ValueFactory.newValue(valueType, ((VLongWritable)value).get()); } else if (value instanceof BooleanWritable) { return ValueFactory.newValue(valueType, ((BooleanWritable)value).get()); } else if (value instanceof FloatWritable) { return ValueFactory.newValue(valueType, ((FloatWritable)value).get()); } else if (value instanceof DoubleWritable) { return ValueFactory.newValue(valueType, ((DoubleWritable)value).get()); } else if (value instanceof MarkLogicNode) { return ValueFactory.newValue(valueType, ((MarkLogicNode)value).get()); } else { throw new UnsupportedOperationException("Value " + value.getClass().getName() + " is unsupported."); } }
Example #6
Source File: TypedBytesWritableOutput.java From big-c with Apache License 2.0 | 5 votes |
public void write(Writable w) throws IOException { if (w instanceof TypedBytesWritable) { writeTypedBytes((TypedBytesWritable) w); } else if (w instanceof BytesWritable) { writeBytes((BytesWritable) w); } else if (w instanceof ByteWritable) { writeByte((ByteWritable) w); } else if (w instanceof BooleanWritable) { writeBoolean((BooleanWritable) w); } else if (w instanceof IntWritable) { writeInt((IntWritable) w); } else if (w instanceof VIntWritable) { writeVInt((VIntWritable) w); } else if (w instanceof LongWritable) { writeLong((LongWritable) w); } else if (w instanceof VLongWritable) { writeVLong((VLongWritable) w); } else if (w instanceof FloatWritable) { writeFloat((FloatWritable) w); } else if (w instanceof DoubleWritable) { writeDouble((DoubleWritable) w); } else if (w instanceof Text) { writeText((Text) w); } else if (w instanceof ArrayWritable) { writeArray((ArrayWritable) w); } else if (w instanceof MapWritable) { writeMap((MapWritable) w); } else if (w instanceof SortedMapWritable) { writeSortedMap((SortedMapWritable) w); } else if (w instanceof Record) { writeRecord((Record) w); } else { writeWritable(w); // last resort } }
Example #7
Source File: StatsCounters.java From datawave with Apache License 2.0 | 5 votes |
/** * Creates a shard stats for a field name/datatype pair. * * @param sumCount * total number of values * @param unique * total number of unique values */ StatsCounters(long sumCount, long unique) { this.count = new VLongWritable(sumCount); int selVal; // hyperlog unique count could be greater than total count if (unique < sumCount) { this.uniqueCount = new VLongWritable(unique); selVal = (int) ((float) unique / (float) sumCount * SELECTIVITY_MULTIPLIER); } else { // use total count if unique is > total this.uniqueCount = new VLongWritable(sumCount); selVal = SELECTIVITY_MULTIPLIER; } this.selectivity = new VIntWritable(selVal); }
Example #8
Source File: TypedBytesWritableInput.java From big-c with Apache License 2.0 | 5 votes |
public Class<? extends Writable> readType() throws IOException { Type type = in.readType(); if (type == null) { return null; } switch (type) { case BYTES: return BytesWritable.class; case BYTE: return ByteWritable.class; case BOOL: return BooleanWritable.class; case INT: return VIntWritable.class; case LONG: return VLongWritable.class; case FLOAT: return FloatWritable.class; case DOUBLE: return DoubleWritable.class; case STRING: return Text.class; case VECTOR: return ArrayWritable.class; case MAP: return MapWritable.class; case WRITABLE: return Writable.class; default: throw new RuntimeException("unknown type"); } }
Example #9
Source File: WritableUtils.java From incubator-hivemall with Apache License 2.0 | 5 votes |
public static Writable toWritable(Object object) { if (object == null) { return null; //return NullWritable.get(); } if (object instanceof Writable) { return (Writable) object; } if (object instanceof String) { return new Text((String) object); } if (object instanceof Long) { return new VLongWritable((Long) object); } if (object instanceof Integer) { return new VIntWritable((Integer) object); } if (object instanceof Byte) { return new ByteWritable((Byte) object); } if (object instanceof Double) { return new DoubleWritable((Double) object); } if (object instanceof Float) { return new FloatWritable((Float) object); } if (object instanceof Boolean) { return new BooleanWritable((Boolean) object); } if (object instanceof byte[]) { return new BytesWritable((byte[]) object); } return new BytesWritable(object.toString().getBytes()); }
Example #10
Source File: DiscoveredThing.java From datawave with Apache License 2.0 | 5 votes |
public DiscoveredThing(String term, String field, String type, String date, String columnVisibility, long count, MapWritable countsByColumnVisibility) { this.term = term; this.field = field; this.type = type; this.date = date; this.columnVisibility = columnVisibility; this.count = new VLongWritable(count); this.countsByColumnVisibility = countsByColumnVisibility; }
Example #11
Source File: Phase.java From datawave with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { name = in.readUTF(); VLongWritable vlaw = new VLongWritable(); vlaw.readFields(in); start = vlaw.get(); vlaw.readFields(in); end = vlaw.get(); }
Example #12
Source File: Phase.java From datawave with Apache License 2.0 | 5 votes |
@Override public void write(DataOutput out) throws IOException { out.writeUTF(name); VLongWritable vlaw = new VLongWritable(); vlaw.set(start); vlaw.write(out); vlaw.set(end); vlaw.write(out); }
Example #13
Source File: FileLatency.java From datawave with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { areDurationsReady = false; fileName = in.readUTF(); VLongWritable eventCount = new VLongWritable(); eventCount.readFields(in); this.eventCount = eventCount.get(); ArrayWritable phases = new ArrayWritable(Phase.class); phases.readFields(in); this.phases = makeList(phases.get()); }
Example #14
Source File: TypedBytesWritableInput.java From big-c with Apache License 2.0 | 4 votes |
public VLongWritable readVLong() throws IOException { return readVLong(null); }
Example #15
Source File: WritableTypeToJsonTest.java From elasticsearch-hadoop with Apache License 2.0 | 4 votes |
@Test public void testVLong() { writableTypeToJson(new VLongWritable(Long.MAX_VALUE)); }
Example #16
Source File: TypedBytesWritableOutput.java From big-c with Apache License 2.0 | 4 votes |
public void writeVLong(VLongWritable vlw) throws IOException { out.writeLong(vlw.get()); }
Example #17
Source File: FileLatency.java From datawave with Apache License 2.0 | 4 votes |
@Override public void write(DataOutput out) throws IOException { out.writeUTF(getFileName()); new VLongWritable(getEventCount()).write(out); makeWritable(phases, Phase.class).write(out); }
Example #18
Source File: TypedBytesWritableInput.java From hadoop with Apache License 2.0 | 4 votes |
public VLongWritable readVLong() throws IOException { return readVLong(null); }
Example #19
Source File: TypedBytesWritableOutput.java From hadoop with Apache License 2.0 | 4 votes |
public void writeVLong(VLongWritable vlw) throws IOException { out.writeLong(vlw.get()); }
Example #20
Source File: StatsHyperLogSummary.java From datawave with Apache License 2.0 | 4 votes |
StatsHyperLogSummary() { this.count = new VLongWritable(); this.hyperLog = new BytesWritable(); this.uniqueCount = new VIntWritable(); }
Example #21
Source File: StatsCounters.java From datawave with Apache License 2.0 | 4 votes |
public StatsCounters() { this.count = new VLongWritable(); this.uniqueCount = new VLongWritable(); this.selectivity = new VIntWritable(); }
Example #22
Source File: IndexStatsRecord.java From datawave with Apache License 2.0 | 4 votes |
public VLongWritable getWordCount() { return count; }
Example #23
Source File: IndexStatsRecord.java From datawave with Apache License 2.0 | 4 votes |
public VLongWritable getNumberOfUniqueWords() { return numberUnique; }
Example #24
Source File: IndexStatsRecord.java From datawave with Apache License 2.0 | 4 votes |
public IndexStatsRecord() { numberUnique = new VLongWritable(); count = new VLongWritable(); averageWordLength = new FloatWritable(); }
Example #25
Source File: DiscoveredThing.java From datawave with Apache License 2.0 | 4 votes |
public DiscoveredThing() { count = new VLongWritable(); countsByColumnVisibility = new MapWritable(); }
Example #26
Source File: StatsHyperLogSummary.java From datawave with Apache License 2.0 | 2 votes |
/** * Creates a stats HyperLog summary object. * * @param sumCount * total number of field name/dataype pair entries * @param logPlus * populated hyperlog object * @param uniqueCount * actual count of unique values (debug only) * @throws IOException * serialization error */ StatsHyperLogSummary(long sumCount, HyperLogLogPlus logPlus, int uniqueCount) throws IOException { this.count = new VLongWritable(sumCount); this.hyperLog = new BytesWritable(logPlus.getBytes()); this.uniqueCount = new VIntWritable(uniqueCount); }