/** * It gives the row count, by summing up the individual results obtained from * regions. In case the qualifier is null, FirstKeyValueFilter is used to * optimised the operation. In case qualifier is provided, I can't use the * filter as it may set the flag to skip to next row, but the value read is * not of the given filter: in this case, this particular row will not be * counted ==> an error. * @param tableName the name of the table to scan * @param ci the user's ColumnInterpreter implementation * @param scan the HBase scan object to use to read data from HBase * @return <R, S> * @throws Throwable The caller is supposed to handle the exception as they are thrown * & propagated to it. */ public <R, S, P extends Message, Q extends Message, T extends Message> long rowCount( final TableName tableName, final ColumnInterpreter<R, S, P, Q, T> ci, final Scan scan) throws Throwable { try (Table table = connection.getTable(tableName)) { return rowCount(table, ci, scan); } }
/** * It gives the row count, by summing up the individual results obtained from * regions. In case the qualifier is null, FirstKeyValueFilter is used to * optimised the operation. In case qualifier is provided, I can't use the * filter as it may set the flag to skip to next row, but the value read is * not of the given filter: in this case, this particular row will not be * counted ==> an error. * @param tableName * @param ci * @param scan * @return <R, S> * @throws Throwable */ public <R, S, P extends Message, Q extends Message, T extends Message> long rowCount( final TableName tableName, final ColumnInterpreter<R, S, P, Q, T> ci, final Scan scan) throws Throwable { try (Table table = connection.getTable(tableName)) { return rowCount(table, ci, scan); } }
/** * It gives the row count, by summing up the individual results obtained from * regions. In case the qualifier is null, FirstKeyValueFilter is used to * optimised the operation. In case qualifier is provided, I can't use the * filter as it may set the flag to skip to next row, but the value read is * not of the given filter: in this case, this particular row will not be * counted ==> an error. * @param tableName the name of the table to scan * @param ci the user's ColumnInterpreter implementation * @param scan the HBase scan object to use to read data from HBase * @return <R, S> * @throws Throwable The caller is supposed to handle the exception as they are thrown * & propagated to it. */ public <R, S, P extends Message, Q extends Message, T extends Message> long rowCount( final TableName tableName, final ColumnInterpreter<R, S, P, Q, T> ci, final Scan scan) throws Throwable { try (Table table = connection.getTable(tableName)) { return rowCount(table, ci, scan); } }
/** * It gives the row count, by summing up the individual results obtained from * regions. In case the qualifier is null, FirstKeyValueFilter is used to * optimised the operation. In case qualifier is provided, I can't use the * filter as it may set the flag to skip to next row, but the value read is * not of the given filter: in this case, this particular row will not be * counted ==> an error. * @param tableName * @param ci * @param scan * @return <R, S> * @throws Throwable */ public <R, S, P extends Message, Q extends Message, T extends Message> long rowCount( final TableName tableName, final ColumnInterpreter<R, S, P, Q, T> ci, final Scan scan) throws Throwable { try (Table table = connection.getTable(tableName)) { return rowCount(table, ci, scan); } }
private static long countNumberOfRows(HConnection connection, byte[] tableName, byte[] columnFamily) throws Throwable { AggregationClient aggregationClient = new AggregationClient(connection.getConfiguration()); Scan scan = new Scan(); scan.addFamily(columnFamily); return aggregationClient.rowCount(tableName, null, scan); }
private static long countNumberOfRows(HConnection connection, byte[] tableName, byte[] columnFamily) throws Throwable { AggregationClient aggregationClient = new AggregationClient(connection.getConfiguration()); Scan scan = new Scan(); scan.addFamily(columnFamily); return aggregationClient.rowCount(tableName, null, scan); }