if (nextKV == null || comparator.compare(curKV, nextKV) < 0) {
@Override public Cell next() throws IOException { if (this.current == null) { return null; } Cell kvReturn = this.current.next(); Cell kvNext = this.current.peek(); if (kvNext == null || this.comparator.kvComparator.compareRows(kvNext, kvReturn) > 0) { if (this.current.seekToPreviousRow(kvReturn)) { this.heap.add(this.current); } else { this.scannersForDelayedClose.add(this.current); } this.current = null; this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); if (topScanner != null && this.comparator.compare(this.current, topScanner) > 0) { this.heap.add(this.current); this.current = null; this.current = pollRealKV(); } } return kvReturn; }
@Override public Cell next() throws IOException { if(this.current == null) { return null; } Cell kvReturn = this.current.next(); Cell kvNext = this.current.peek(); if (kvNext == null) { this.scannersForDelayedClose.add(this.current); this.current = null; this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); // no need to add current back to the heap if it is the only scanner left if (topScanner != null && this.comparator.compare(kvNext, topScanner.peek()) >= 0) { this.heap.add(this.current); this.current = null; this.current = pollRealKV(); } } return kvReturn; }
if (nextKV == null || comparator.compare(curKV, nextKV) < 0) {
if (nextKV == null || comparator.compare(curKV, nextKV) < 0) {
@Override public Cell next() throws IOException { if (this.current == null) { return null; } Cell kvReturn = this.current.next(); Cell kvNext = this.current.peek(); if (kvNext == null || this.comparator.kvComparator.compareRows(kvNext, kvReturn) > 0) { if (this.current.seekToPreviousRow(kvReturn)) { this.heap.add(this.current); } else { this.current.close(); } this.current = null; this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); if (topScanner != null && this.comparator.compare(this.current, topScanner) > 0) { this.heap.add(this.current); this.current = null; this.current = pollRealKV(); } } return kvReturn; }
public Cell next() throws IOException { if(this.current == null) { return null; } Cell kvReturn = this.current.next(); Cell kvNext = this.current.peek(); if (kvNext == null) { this.current.close(); this.current = null; this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); // no need to add current back to the heap if it is the only scanner left if (topScanner != null && this.comparator.compare(kvNext, topScanner.peek()) >= 0) { this.heap.add(this.current); this.current = null; this.current = pollRealKV(); } } return kvReturn; }
public int compare(KeyValueScanner left, KeyValueScanner right) { int comparison = compare(left.peek(), right.peek()); if (comparison != 0) { return comparison; } else { // Since both the keys are exactly the same, we break the tie in favor // of the key which came latest. long leftSequenceID = left.getSequenceID(); long rightSequenceID = right.getSequenceID(); if (leftSequenceID > rightSequenceID) { return -1; } else if (leftSequenceID < rightSequenceID) { return 1; } else { return 0; } } } /**
public int compare(KeyValueScanner left, KeyValueScanner right) { int comparison = compare(left.peek(), right.peek()); if (comparison != 0) { return comparison; } else { // Since both the keys are exactly the same, we break the tie in favor // of the key which came latest. long leftSequenceID = left.getSequenceID(); long rightSequenceID = right.getSequenceID(); if (leftSequenceID > rightSequenceID) { return -1; } else if (leftSequenceID < rightSequenceID) { return 1; } else { return 0; } } } /**
public KeyValue next() throws IOException { if(this.current == null) { return null; } KeyValue kvReturn = this.current.next(); KeyValue kvNext = this.current.peek(); if (kvNext == null) { this.current.close(); this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); if (topScanner == null || this.comparator.compare(kvNext, topScanner.peek()) >= 0) { this.heap.add(this.current); this.current = pollRealKV(); } } return kvReturn; }
@Override public int compare(KeyValueScanner left, KeyValueScanner right) { int rowComparison = compareRows(left.peek(), right.peek()); if (rowComparison != 0) { return -rowComparison; } return super.compare(left, right); }
@Override public int compare(KeyValueScanner left, KeyValueScanner right) { int rowComparison = compareRows(left.peek(), right.peek()); if (rowComparison != 0) { return -rowComparison; } return super.compare(left, right); }
@Override public int compare(KeyValueScanner left, KeyValueScanner right) { int comparison = compare(left.peek(), right.peek()); if (comparison != 0) { return comparison; } else { // Since both the keys are exactly the same, we break the tie in favor of higher ordered // scanner since it'll have newer data. Since higher value should come first, we reverse // sort here. return Long.compare(right.getScannerOrder(), left.getScannerOrder()); } } /**