/** * @return <tt>true</tt> if this should include all column qualifiers, <tt>false</tt> otherwise */ public boolean allColumns() { return getQualifier() == ALL_QUALIFIERS; }
/** * @param qual to check against * @return <tt>true</tt> if this column covers the given qualifier. */ public boolean matchesQualifier(byte[] qual) { return matchesQualifier(qual, 0, qual.length); }
/** * @return <tt>true</tt> if this set of columns has seen a column with a timestamp newer than the * requested timestamp, <tt>false</tt> otherwise. */ public boolean hasNewerTimestamps() { return !isNewestTime(this.ts); }
@Override public String toString() { return "ColumnReference - " + Bytes.toString(getFamily()) + ":" + Bytes.toString(getQualifier()); } }
public boolean matchesQualifier(byte[] bytes, int offset, int length) { return allColumns() ? true : match(bytes, offset, length, qualifierPtr.get(), qualifierPtr.getOffset(), qualifierPtr.getLength()); }
public boolean matches(Cell kv) { if (matchesFamily(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength())) { return matchesQualifier(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()); } return false; }
@Override public ImmutableBytesWritable getLatestValue(ColumnReference ref, long ts) { if(ref.equals(dataEmptyKeyValueRef)) return null; return valueMap.get(ref); } @Override
@Override public ReturnCode filterKeyValue(Cell v) { long timestamp = v.getTimestamp(); if (timestamp > ts) { this.column.setTs(timestamp); return ReturnCode.SKIP; } return ReturnCode.INCLUDE; }
/** * @param updates */ public void addAll(Collection<Pair<Mutation, String>> updates) { for (Pair<Mutation, String> update : updates) { addIndexUpdate(Bytes.toBytes(update.getSecond()), update.getFirst()); } }
public ColumnReference(byte[] family, byte[] qualifier) { this.familyPtr = new ImmutableBytesPtr(family); this.qualifierPtr = new ImmutableBytesPtr(qualifier); this.hashCode = calcHashCode(this.familyPtr, this.qualifierPtr); }
/** * @param family to check against * @return <tt>true</tt> if this column covers the given family. */ public boolean matchesFamily(byte[] family) { return matchesFamily(family, 0, family.length); }
public ColumnTracker(Collection<? extends ColumnReference> columns) { this.columns = new ArrayList<ColumnReference>(columns); // sort the columns // no need to do this: Collections.sort(this.columns); this.hashCode = calcHashCode(this.columns); }
private Set<ImmutableBytesPtr> getAllFamilies(Collection<? extends ColumnReference> columns) { Set<ImmutableBytesPtr> families = new HashSet<ImmutableBytesPtr>(); for (ColumnReference ref : columns) { families.add(ref.getFamilyWritable()); } return families; }
public static Scan newLocalStateScan(Scan scan, List<? extends Iterable<? extends ColumnReference>> refsArray) { Scan s = scan; if (scan == null) { s = new Scan(); } s.setRaw(true); // add the necessary columns to the scan for (Iterable<? extends ColumnReference> refs : refsArray) { for (ColumnReference ref : refs) { s.addFamily(ref.getFamily()); } } s.setMaxVersions(); return s; }
public boolean matchesFamily(byte[] bytes, int offset, int length) { return match(bytes, offset, length, familyPtr.get(), familyPtr.getOffset(), familyPtr.getLength()); }
public KeyValue getFirstKeyValueForRow(byte[] row) { return KeyValueUtil.createFirstOnRow(row, getFamily(), getQualifier() == ALL_QUALIFIERS ? null : getQualifier()); }
@Test public void testEnsureGuarranteedMinValid() { assertFalse("Guarranted min wasn't recognized as having newer timestamps!", ColumnTracker.isNewestTime(ColumnTracker.GUARANTEED_NEWER_UPDATES)); }
@Override public boolean equals(Object o){ if(!(o instanceof ColumnTracker)){ return false; } ColumnTracker other = (ColumnTracker)o; if (hashCode != other.hashCode) { return false; } if (other.columns.size() != columns.size()) { return false; } // check each column to see if they match for (int i = 0; i < columns.size(); i++) { if (!columns.get(i).equals(other.columns.get(i))) { return false; } } return true; }
public byte[] getEmptyKeyValueQualifier() { return dataEmptyKeyValueRef.getQualifier(); }
public ColumnReference(byte[] family, int familyOffset, int familyLength, byte[] qualifier, int qualifierOffset, int qualifierLength) { this.familyPtr = new ImmutableBytesPtr(family, familyOffset, familyLength); this.qualifierPtr = new ImmutableBytesPtr(qualifier, qualifierOffset, qualifierLength); this.hashCode = calcHashCode(this.familyPtr, this.qualifierPtr); }