amansinha100 commented on a change in pull request #1489: DRILL-6770:
JsonTableGroupScan should use new MapRDB 6.1.0 APIs
URL: https://github.com/apache/drill/pull/1489#discussion_r222793328
##########
File path:
contrib/format-maprdb/src/main/java/org/apache/drill/exec/store/mapr/db/json/JsonTableGroupScan.java
##########
@@ -148,11 +150,16 @@ private void init() {
table = MapRDB.getTable(scanSpec.getTableName());
tabletInfos = table.getTabletInfos(scanSpec.getCondition());
- // Calculate totalRowCount for the table from tabletInfos
estimatedRowCount.
- // This will avoid calling expensive MapRDBTableStats API to get total
rowCount, avoiding
- // duplicate work and RPCs to MapR DB server.
- for (TabletInfo tabletInfo : tabletInfos) {
- totalRowCount += tabletInfo.getEstimatedNumRows();
+ final MetaTable metaTable = table.getMetaTable();
+ com.mapr.db.scan.ScanStats stats = (scanSpec.getCondition() == null)
+ ? metaTable.getScanStats() :
metaTable.getScanStats(scanSpec.getCondition());
+ totalRowCount = stats.getEstimatedNumRows();
+ // MapRDB client can return invalid rowCount i.e. 0, especially right
after table
+ // creation. It takes 15 minutes before table stats are obtained and
cached in client.
+ // If we get 0 rowCount, fallback to getting rowCount using old admin
API.
+ if (totalRowCount == 0) {
Review comment:
Previously, we were not checking this condition of 0 rowcount. I am
thinking since this part of the code has anyways changed in the indexing PR
[1], should we just wait until that change is merged ?
[1] https://github.com/apache/drill/pull/1466
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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