gjacoby126 commented on a change in pull request #631: PHOENIX-5494 Batched,
mutable Index updates are unnecessarily run one…
URL: https://github.com/apache/phoenix/pull/631#discussion_r346003039
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/data/LocalTable.java
##########
@@ -49,15 +61,53 @@
public class LocalTable implements LocalHBaseState {
private RegionCoprocessorEnvironment env;
+ private Map<ImmutableBytesPtr, Result> results = new HashMap<>();;
public LocalTable(RegionCoprocessorEnvironment env) {
this.env = env;
}
+ public void scanCurrentRowStates(Set<ImmutableBytesPtr> rows, Collection<?
extends ColumnReference> columns, long ts) throws IOException {
+ Scan s =
IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns));
+ FilterList filterList = new
FilterList(FilterList.Operator.MUST_PASS_ONE);
+ for (ImmutableBytesPtr row : rows) {
+ filterList.addFilter(new RowFilter(CompareOperator.EQUAL, new
BinaryComparator(row.get())));
+ }
+ s.setFilter(filterList);
+ s.setTimeRange(0, ts);
+ Region region = this.env.getRegion();
+ try (RegionScanner scanner = region.getScanner(s)) {
+ boolean more;
+ do {
+ List<Cell> kvs = new ArrayList<Cell>(1);
+ more = scanner.next(kvs);
+ if (kvs.isEmpty()) {
+ return;
+ }
+ Result r = Result.create(kvs);
+ Cell cell = kvs.get(0);
+ byte[] rowKey = new byte[cell.getRowLength()];
+ System.arraycopy(cell.getRowArray(), cell.getRowOffset(),
rowKey, 0, cell.getRowLength());
Review comment:
Can replace with HBase's CellUtil.cloneRow method for this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services