dvjyothsna commented on a change in pull request #1771: DRILL-7199: Optimize 
population of metadata for non-interesting columns
URL: https://github.com/apache/drill/pull/1771#discussion_r280169434
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java
 ##########
 @@ -146,15 +148,23 @@ public boolean isMatchAllMetadata() {
    */
   @Override
   public long getColumnValueCount(SchemaPath column) {
-    long tableRowCount = (long) 
TableStatisticsKind.ROW_COUNT.getValue(getTableMetadata());
+    long tableRowCount, colNulls;
+    Long nulls;
     ColumnStatistics columnStats = 
getTableMetadata().getColumnStatistics(column);
-    long colNulls;
+    ColumnStatistics nonInterestingColStats = 
getNonInterestingColumnsMetadata().getColumnStatistics(column);
+
     if (columnStats != null) {
-      Long nulls = (Long) 
columnStats.getStatistic(ColumnStatisticsKind.NULLS_COUNT);
-      colNulls = nulls != null ? nulls : GroupScan.NO_COLUMN_STATS;
+      tableRowCount = (long) 
TableStatisticsKind.ROW_COUNT.getValue(getTableMetadata());
+    } else if (nonInterestingColStats != null) {
 
 Review comment:
   Yes, tablemetadata holds only the interesting column stats. ColumnStats will 
be non-null only for the interesting columns. There are three scenarios here:
    
   - Column is interesting. Then the columnStats is not null and it has the 
correct row count.
   - Column is non-interesting. Then the columnStats will be null and 
nonInterestingColStats is not null and the row count is marked as unknown.
   - Column doesn't exist in the table. So both columnStats and 
nonInterestingColStats will be null. Since the column doesn't exist, the row 
count is set to 0.
   
   Here we know that a column will only belong to one of the above cases. Thats 
the reason there is an else-if instead of if.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Reply via email to