[ 
https://issues.apache.org/jira/browse/DRILL-6641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16560003#comment-16560003
 ] 

ASF GitHub Bot commented on DRILL-6641:
---------------------------------------

vvysotskyi commented on a change in pull request #1406: DRILL-6641: Fix 
columnValueCounts in ParquetGroupScanStatistics when ParquetGroupScan has 
RowGroupInfo without column statistics
URL: https://github.com/apache/drill/pull/1406#discussion_r205838330
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScanStatistics.java
 ##########
 @@ -88,19 +88,14 @@ public void collect(List<RowGroupInfo> rowGroupInfos, 
ParquetTableMetadataBase p
       for (ColumnMetadata column : rowGroup.getColumns()) {
         SchemaPath schemaPath = SchemaPath.getCompoundPath(column.getName());
         Long previousCount = columnValueCounts.get(schemaPath);
-        if (previousCount != null) {
-          if (previousCount != GroupScan.NO_COLUMN_STATS && 
column.isNumNullsSet()) {
-            Long newCount = rowCount - column.getNulls();
-            columnValueCounts.put(schemaPath, 
columnValueCounts.get(schemaPath) + newCount);
-          }
+        previousCount = previousCount == null ? 0 : previousCount;
 
 Review comment:
   @vrozov, thanks for taking a look at this change. I think we should leave 
this code as it is for the next reasons:
   - boxing of `0` is happened only once;
   - unboxing happens in both cases: when `+=` is produced for your case or 
when `+` is done.
   - `continue` in the `else` block will cause problems for detecting that 
column is partitioned (see usage of `first` local variable);
   - existing code looks clearer, since the logic is just splitted only into 
two branches.

----------------------------------------------------------------
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]


> TestConvertCountToDirectScan.ensureCorrectCountWithMissingStatistics() test 
> fails randomly
> ------------------------------------------------------------------------------------------
>
>                 Key: DRILL-6641
>                 URL: https://issues.apache.org/jira/browse/DRILL-6641
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Volodymyr Vysotskyi
>            Assignee: Volodymyr Vysotskyi
>            Priority: Major
>              Labels: ready-to-commit
>             Fix For: 1.15.0
>
>
> {{TestConvertCountToDirectScan.ensureCorrectCountWithMissingStatistics()}} 
> fails randomly with assertion error:
> {noformat}
> Found unwanted pattern in plan: DynamicPojoRecordReader
> 00-00    Screen
> 00-01      Project(cnt_str=[$0], cnt_total=[$1])
> 00-02        Scan(groupscan=[files = 
> [/home/vitalii/IdeaProjects/drill-fork/exec/java-exec/target/org.apache.drill.exec.planner.logical.TestConvertCountToDirectScan/dfsTestTmp/1532655133770-0/wide_str_table/0_0_2.parquet,
>  
> /home/vitalii/IdeaProjects/drill-fork/exec/java-exec/target/org.apache.drill.exec.planner.logical.TestConvertCountToDirectScan/dfsTestTmp/1532655133770-0/wide_str_table/0_0_1.parquet],
>  numFiles = 2, DynamicPojoRecordReader{records = [[0, 2]]}])
> {noformat}
> This test uses a table with two partitions and it may fail when a partition 
> with set statistics is taken first in the 
> {{ParquetGroupScanStatistics.collect()}} method, which is indirectly called 
> from {{ConvertCountToDirectScan}} rule.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to