Java Code Examples for org.apache.accumulo.core.data.Range#readFields()
The following examples show how to use
org.apache.accumulo.core.data.Range#readFields() .
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: BulkInputFormat.java From datawave with Apache License 2.0 | 6 votes |
/** * Gets the ranges to scan over from a configuration object. * * @param conf * the Hadoop configuration object * @return the ranges * @throws IOException * if the ranges have been encoded improperly * @see #setRanges(Job, Collection) */ protected static List<Range> getRanges(Configuration conf) throws IOException { Path rangesPath = new Path(conf.get(RANGES)); FileSystem fs = FileSystem.get(rangesPath.toUri(), conf); ArrayList<Range> ranges = new ArrayList<>(); try (FSDataInputStream inputStream = fs.open(rangesPath)) { int size = inputStream.readInt(); for (int i = 0; i < size; i++) { Range range = new Range(); range.readFields(inputStream); ranges.add(range); } } return ranges; }
Example 2
Source File: WrappedRange.java From presto with Apache License 2.0 | 5 votes |
@JsonCreator public static WrappedRange fromBytes(byte[] bytes) throws IOException { DataInput in = ByteStreams.newDataInput(bytes); Range range = new Range(); range.readFields(in); return new WrappedRange(range); }
Example 3
Source File: LoadDateFilter.java From datawave with Apache License 2.0 | 5 votes |
private static Range decodeRange(String e) throws IOException { ByteArrayInputStream b = new ByteArrayInputStream(Base64.decodeBase64(e.getBytes())); DataInputStream in = new DataInputStream(b); Range range = new Range(); try { range.readFields(in); } catch (Exception e2) { throw new IOException(e2); } finally { in.close(); b.close(); } return range; }
Example 4
Source File: ColumnRangeIterator.java From datawave with Apache License 2.0 | 5 votes |
public static Range decodeRange(String e) throws IOException { ByteArrayInputStream b = new ByteArrayInputStream(Base64.decodeBase64(e.getBytes())); DataInputStream in = new DataInputStream(b); Range range = new Range(); try { range.readFields(in); } catch (Exception e2) { throw new IOException(e2); } finally { in.close(); b.close(); } return range; }
Example 5
Source File: FileRangeSplit.java From datawave with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { file = new Path(Text.readString(in)); start = in.readLong(); length = in.readLong(); hosts = null; int numberRanges = in.readInt(); for (int i = 0; i < numberRanges; i++) { Range range = new Range(); range.readFields(in); ranges.add(range); } }
Example 6
Source File: RangeSplit.java From datawave with Apache License 2.0 | 5 votes |
public void readFields(DataInput in) throws IOException { ranges = Sets.newTreeSet(); int numLocs = in.readInt(); for (int i = 0; i < numLocs; ++i) { Range range = new Range(); range.readFields(in); ranges.add(range); } numLocs = in.readInt(); locations = new String[numLocs]; for (int i = 0; i < numLocs; ++i) locations[i] = in.readUTF(); }
Example 7
Source File: AccumuloStorage.java From rya with Apache License 2.0 | 5 votes |
@Override public WritableComparable<?> getSplitComparable(final InputSplit inputSplit) throws IOException { //cannot get access to the range directly final AccumuloInputFormat.RangeInputSplit rangeInputSplit = (AccumuloInputFormat.RangeInputSplit) inputSplit; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final DataOutputStream out = new DataOutputStream(baos); rangeInputSplit.write(out); out.close(); final DataInputStream stream = new DataInputStream(new ByteArrayInputStream(baos.toByteArray())); final Range range = new Range(); range.readFields(stream); stream.close(); return range; }