phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkrish86 <...@git.apache.org>
Subject [GitHub] phoenix pull request: Phoenix-180
Date Thu, 11 Sep 2014 09:16:47 GMT
Github user ramkrish86 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/12#discussion_r17411273
  
    --- 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 byte[] tenantId, final byte[] schemaName, final
byte[] tableName, final String url)
    +            throws SQLException {
    +        HTableInterface ht = null;
    +        try {
    +            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.setTableNameBytes(HBaseZeroCopyByteString.wrap(tableName));
    +                    builder.setTenantIdBytes(HBaseZeroCopyByteString.wrap(tenantId));
    +                    builder.setSchemaNameBytes(HBaseZeroCopyByteString.wrap(schemaName));
    +                    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);
    +            StatCollectResponse next = result.values().iterator().next();
    +            clearCacheForTable(tenantId, schemaName, tableName);
    +            return next.getRowsScanned();
    +        } catch (ServiceException e) {
    +            throw new SQLException("Unable to update the statistics for the table " +
tableName, e);
    +        } catch (TableNotFoundException e) {
    --- End diff --
    
    Done


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message