[ https://issues.apache.org/jira/browse/PHOENIX-2714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15167530#comment-15167530 ]
James Taylor commented on PHOENIX-2714: --------------------------------------- Even though it may not be necessary in calcite, I think it'd make sense to expose this in QueryPlan and do the summations ourselves. Also, since we have at least a few weeks before 4.8, I think we should do the rest of the work I mentioned above and avoid the code duplication. Not sure it's necessary to make it static either. Getting the tree of iterators through the QueryPlan.iterators() method is not an expensive operation (it shouldn't cause any execution to occur - if it does we should fix that), so for calcite, we could just call this to get our cost information (at least for now). That way, we'll get accurate row/byte count for all our queries which would be nice. WDYT? > Correct byte estimate in BaseResultIterators and expose as interface > -------------------------------------------------------------------- > > Key: PHOENIX-2714 > URL: https://issues.apache.org/jira/browse/PHOENIX-2714 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.7.0 > Reporter: Maryann Xue > Assignee: Maryann Xue > Labels: statistics > Fix For: 4.8.0 > > Attachments: PHOENIX-2714.patch > > > The bytes are accumulated even if the range intersect is empty (produces a > null scan). > {code} > while (guideIndex < gpsSize && > (currentGuidePost.compareTo(endKey) <= 0 || endKey.length == 0)) { > Scan newScan = scanRanges.intersectScan(scan, > currentKeyBytes, currentGuidePostBytes, keyOffset, > false); > estimatedRows += gps.getRowCounts().get(guideIndex); > estimatedSize += gps.getByteCounts().get(guideIndex); > scans = addNewScan(parallelScans, scans, newScan, > currentGuidePostBytes, false, regionLocation); > currentKeyBytes = currentGuidePost.copyBytes(); > currentGuidePost = PrefixByteCodec.decode(decoder, input); > currentGuidePostBytes = currentGuidePost.copyBytes(); > guideIndex++; > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)