Java Code Examples for org.apache.accumulo.core.data.Range#isStartKeyInclusive()
The following examples show how to use
org.apache.accumulo.core.data.Range#isStartKeyInclusive() .
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: GlobalIndexTermMatchingIterator.java From datawave with Apache License 2.0 | 6 votes |
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { this.scanRange = range; this.scanCFs = columnFamilies; this.scanInclusive = inclusive; getSource().seek(range, columnFamilies, inclusive); // if we have been reseeked after being torn down, and we are only returning unique terms, then advance to the next unique row/cf if (!range.isStartKeyInclusive() && uniqueTermsOnly && getSource().hasTop()) { Key start = range.getStartKey(); // verify this was actually from being torn down in that this key looks like a global index term if (start.getColumnFamily().getLength() > 0 && start.getColumnQualifier().getLength() > 0 && start.getColumnQualifier().toString().indexOf('\0') > 0) { advance(start); } } findTopEntry(); }
Example 2
Source File: CreateUidsIterator.java From datawave with Apache License 2.0 | 5 votes |
/** * This iterator returns a top level key whose column qualifier includes only the shard. In that event, we must ensure we skip to the next sorted entry, * using skipkey */ @Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { Range seekRange = range; if (!range.isStartKeyInclusive()) { seekRange = skipKey(range); } src.seek(seekRange, columnFamilies, inclusive); next(); }
Example 3
Source File: FinalDocumentTrackingIterator.java From datawave with Apache License 2.0 | 5 votes |
private boolean isStatsEntryReturned(Range r) { // first check if this is a rebuild key (post teardown) if (!r.isStartKeyInclusive()) { // now check if the start key is a final document return return isFinalDocumentKey(r.getStartKey()); } return false; }
Example 4
Source File: IndexIterator.java From datawave with Apache License 2.0 | 5 votes |
/** * Permute a "Document" Range to the equivalent "Field Index" Range for a Field:Term * * @param r * @return */ protected Range buildIndexRange(Range r) { Key startKey = permuteRangeKey(r.getStartKey(), r.isStartKeyInclusive()); Key endKey = permuteRangeKey(r.getEndKey(), r.isEndKeyInclusive()); return new Range(startKey, r.isStartKeyInclusive(), endKey, r.isEndKeyInclusive()); }
Example 5
Source File: EventDataScanNestedIterator.java From datawave with Apache License 2.0 | 5 votes |
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { this.totalRange = range; this.columnFamilies = columnFamilies; this.inclusive = inclusive; // determine if we have been torn down and rebuilt if (!range.isInfiniteStartKey() && !range.isStartKeyInclusive()) { move(nextStartKey(range.getStartKey())); } else { source.seek(range, columnFamilies, inclusive); findNextDocument(); } }
Example 6
Source File: AccumuloQueryRuleset.java From rya with Apache License 2.0 | 5 votes |
private static boolean rangeContainsRange(final Range r1, final Range r2) { // 1. If r1.start is infinite, r1 contains r2.start if (!r1.isInfiniteStartKey()) { // 2. Otherwise, if r2.start is infinite, r1 can't contain r2 if (r2.isInfiniteStartKey()) { return false; } final Key start2 = r2.getStartKey(); // 3. If r2 is inclusive, r1 needs to contain r2's start key. if (r2.isStartKeyInclusive()) { if (!r1.contains(start2)) { return false; } } // 4. Otherwise, the only failure is if r2's start key comes first (they can be equal) else if (start2.compareTo(r1.getStartKey()) < 0) { return false; } } // Similar logic for end points if (!r1.isInfiniteStopKey()) { if (r2.isInfiniteStopKey()) { return false; } final Key end2 = r2.getEndKey(); if (r2.isEndKeyInclusive()) { if (!r1.contains(end2)) { return false; } } else if (end2.compareTo(r1.getEndKey()) > 0) { return false; } } return true; }
Example 7
Source File: TermFrequencyIndexIterator.java From datawave with Apache License 2.0 | 4 votes |
public TermFrequencyIndexIterator(Range fiRange, SortedKeyValueIterator<Key,Value> source, TimeFilter timeFilter, TypeMetadata typeMetadata, boolean buildDocument, Predicate<Key> datatypeFilter, FieldIndexAggregator aggregator) { this(fiRange.getStartKey(), fiRange.isStartKeyInclusive(), fiRange.getEndKey(), fiRange.isEndKeyInclusive(), source, timeFilter, typeMetadata, buildDocument, datatypeFilter, aggregator); }
Example 8
Source File: MetadataCacheLoader.java From datawave with Apache License 2.0 | 4 votes |
@Override public Set<Tuple2<String,Set<String>>> load(Range inputKey) throws Exception { Set<Tuple2<String,Set<String>>> locations = new HashSet<>(); // determine the table id final String metadataString = inputKey.getStartKey().getRow().toString().intern(); final String tableId = getTableId(metadataString); // determine our stop criteria final String stopRow = inputKey.getEndKey().getRow().toString().intern(); // create a scan range that goes through the default tablet Key endKey = new Key(new KeyExtent(tableId, null, null).getMetadataEntry()).followingKey(PartialKey.ROW); Range metadataRange = new Range(inputKey.getStartKey(), inputKey.isStartKeyInclusive(), endKey, false); Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LastLocationColumnFamily.NAME); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.FutureLocationColumnFamily.NAME); scanner.setRange(metadataRange); RowIterator rowIter = new RowIterator(scanner); String baseLocation = defaultBasePath + MultiRfileInputformat.tableStr + tableId + Path.SEPARATOR; try { while (rowIter.hasNext()) { Iterator<Entry<Key,Value>> row = rowIter.next(); String location = ""; String endRow = ""; Set<String> fileLocations = Sets.newHashSet(); while (row.hasNext()) { Entry<Key,Value> entry = row.next(); Key key = entry.getKey(); endRow = key.getRow().toString().intern(); if (key.getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) { String fileLocation = entry.getKey().getColumnQualifier().toString(); if (!fileLocation.contains(HDFS_BASE)) fileLocation = baseLocation.concat(entry.getKey().getColumnQualifier().toString()); fileLocations.add(fileLocation); } if (key.getColumnFamily().equals(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME) || key.getColumnFamily().equals(MetadataSchema.TabletsSection.FutureLocationColumnFamily.NAME)) { location = entry.getValue().toString(); } } locations.add(new Tuple2<>(location, fileLocations)); // if this row is equal to or past our stop row, then terminate if (endRow.compareTo(stopRow) >= 0) { break; } } } finally { scanner.close(); } return locations; }
Example 9
Source File: AccumuloSplitsProvider.java From geowave with Apache License 2.0 | 4 votes |
public static GeoWaveRowRange fromAccumuloRange(final Range range, final int partitionKeyLength) { if (partitionKeyLength <= 0) { return new GeoWaveRowRange( null, range.getStartKey() == null ? null : range.getStartKey().getRowData().getBackingArray(), range.getEndKey() == null ? null : range.getEndKey().getRowData().getBackingArray(), range.isStartKeyInclusive(), range.isEndKeyInclusive()); } else { byte[] partitionKey; boolean partitionKeyDiffers = false; if ((range.getStartKey() == null) && (range.getEndKey() == null)) { return null; } else if (range.getStartKey() != null) { partitionKey = ArrayUtils.subarray( range.getStartKey().getRowData().getBackingArray(), 0, partitionKeyLength); if (range.getEndKey() != null) { partitionKeyDiffers = !Arrays.equals( partitionKey, ArrayUtils.subarray( range.getEndKey().getRowData().getBackingArray(), 0, partitionKeyLength)); } } else { partitionKey = ArrayUtils.subarray( range.getEndKey().getRowData().getBackingArray(), 0, partitionKeyLength); } return new GeoWaveRowRange( partitionKey, range.getStartKey() == null ? null : ArrayUtils.subarray( range.getStartKey().getRowData().getBackingArray(), partitionKeyLength, range.getStartKey().getRowData().getBackingArray().length), partitionKeyDiffers ? null : range.getEndKey() == null ? null : ArrayUtils.subarray( range.getEndKey().getRowData().getBackingArray(), partitionKeyLength, range.getEndKey().getRowData().getBackingArray().length), range.isStartKeyInclusive(), partitionKeyDiffers ? true : range.isEndKeyInclusive()); } }
Example 10
Source File: AndIterator.java From accumulo-recipes with Apache License 2.0 | 4 votes |
private void doSeek(Range range) throws IOException { overallRange = new Range(range); if (range.getEndKey() != null && range.getEndKey().getRow() != null) { this.parentEndRow = range.getEndKey().getRow(); } // seek each of the sources to the right column family within the row given by key for (int i = 0; i < sourcesCount; i++) { Key sourceKey; Text dataLocation = (sources[i].dataLocation == null) ? nullText : sources[i].dataLocation; if (range.getStartKey() != null) { // Build a key with the DocID if one is given if (range.getStartKey().getColumnFamily() != null) { sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation, (sources[i].term == null) ? nullText : new Text(sources[i].term + NULL_BYTE + range.getStartKey().getColumnFamily())); } // Build a key with just the term. else { sourceKey = buildKey(getPartition(range.getStartKey()), dataLocation, (sources[i].term == null) ? nullText : sources[i].term); } if (!range.isStartKeyInclusive()) sourceKey = sourceKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL); sources[i].iter.seek(new Range(sourceKey, true, null, false), sources[i].seekColumnFamilies, SEEK_INCLUSIVE); } else { sources[i].iter.seek(range, sources[i].seekColumnFamilies, SEEK_INCLUSIVE); } } advanceToIntersection(); if (hasTop()) { if (overallRange != null && !overallRange.contains(topKey)) { topKey = null; if (log.isDebugEnabled()) { log.debug("doSeek, topKey is outside of overall range: " + overallRange); } } } }
Example 11
Source File: SpanUtil.java From fluo with Apache License 2.0 | 2 votes |
/** * Converts an Accumulo Range to a Fluo Span * * @param range Range * @return Span */ public static Span toSpan(Range range) { return new Span(toRowColumn(range.getStartKey()), range.isStartKeyInclusive(), toRowColumn(range.getEndKey()), range.isEndKeyInclusive()); }