Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/12#discussion_r17619518
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
---
@@ -1874,6 +1867,95 @@ private void
incrementSequenceValues(List<SequenceKey> keys, long timestamp, lon
}
}
+ @Override
+ public long updateStatistics(final KeyRange keyRange, final byte[]
tableName,
+ final String url) throws SQLException {
+ HTableInterface ht = null;
+ try {
+ // TODO To set the start/stop range for the analyze call based
on tenantId (if not null).
+ ht = this.getTable(tableName);
+ Batch.Call<StatCollectService, StatCollectResponse> callable =
new Batch.Call<StatCollectService, StatCollectResponse>() {
+ ServerRpcController controller = new ServerRpcController();
+ BlockingRpcCallback<StatCollectResponse> rpcCallback = new
BlockingRpcCallback<StatCollectResponse>();
+
+ @Override
+ public StatCollectResponse call(StatCollectService
service) throws IOException {
+ StatCollectRequest.Builder builder =
StatCollectRequest.newBuilder();
+
builder.setStartRow(HBaseZeroCopyByteString.wrap(keyRange.getLowerRange()));
+
builder.setStopRow(HBaseZeroCopyByteString.wrap(keyRange.getUpperRange()));
+
builder.setTableNameBytes(HBaseZeroCopyByteString.wrap(tableName));
+ builder.setUrl(url);
+ service.collectStat(controller, builder.build(),
rpcCallback);
+ if (controller.getFailedOn() != null) { throw
controller.getFailedOn(); }
+ return rpcCallback.get();
+ }
+ };
+ Map<byte[], StatCollectResponse> result =
ht.coprocessorService(StatCollectService.class,
+ HConstants.EMPTY_BYTE_ARRAY,
HConstants.EMPTY_BYTE_ARRAY, callable);
--- End diff --
Here, instead of HConstants.EMPTY_BYTE_ARRAY, just use
keyRange.getLowerRange() and keyRange.getUpperRange(). It'll be correct for all
cases. And remove the TODO above.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---