arina-ielchiieva commented on a change in pull request #1955: DRILL-7491: Incorrect count() returned for complex types in parquet URL: https://github.com/apache/drill/pull/1955#discussion_r366328108
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractGroupScanWithMetadata.java ########## @@ -167,29 +167,46 @@ public boolean isMatchAllMetadata() { */ @Override public long getColumnValueCount(SchemaPath column) { - long tableRowCount, colNulls; - Long nulls; ColumnStatistics<?> columnStats = getTableMetadata().getColumnStatistics(column); - ColumnStatistics<?> nonInterestingColStats = null; - if (columnStats == null) { - nonInterestingColStats = getNonInterestingColumnsMetadata().getColumnStatistics(column); - } + ColumnStatistics<?> nonInterestingColStats = columnStats == null + ? getNonInterestingColumnsMetadata().getColumnStatistics(column) : null; + long tableRowCount; if (columnStats != null) { tableRowCount = TableStatisticsKind.ROW_COUNT.getValue(getTableMetadata()); } else if (nonInterestingColStats != null) { tableRowCount = TableStatisticsKind.ROW_COUNT.getValue(getNonInterestingColumnsMetadata()); + columnStats = nonInterestingColStats; + } else if (existsNestedStatsForColumn(column, getTableMetadata()) + || existsNestedStatsForColumn(column, getNonInterestingColumnsMetadata())) { + // When exists statistic for nested field, this is complex column which is present in table. Review comment: ```suggestion // When statistics for nested field exists, this is complex column which is present in table. ``` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services