rdsr commented on a change in pull request #227: ORC column map fix
URL: https://github.com/apache/incubator-iceberg/pull/227#discussion_r296421903
 
 

 ##########
 File path: orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java
 ##########
 @@ -95,24 +97,16 @@ public Metrics metrics() {
       // we don't currently have columnSizes or distinct counts.
       Map<Integer, Long> valueCounts = new HashMap<>();
       Map<Integer, Long> nullCounts = new HashMap<>();
-      Integer[] icebergIds = new Integer[orcSchema.getMaximumId() + 1];
-      for (TypeDescription type : columnIds.keySet()) {
-        icebergIds[type.getId()] = columnIds.get(type);
-      }
-      for (int c = 1; c < stats.length; ++c) {
-        if (icebergIds[c] != null) {
-          valueCounts.put(icebergIds[c], stats[c].getNumberOfValues());
-        }
-      }
-      for (TypeDescription child : orcSchema.getChildren()) {
-        int childId = child.getId();
-        if (icebergIds[childId] != null) {
-          nullCounts.put(icebergIds[childId], rows - 
stats[childId].getNumberOfValues());
-        }
+      Map<ColumnMap.IcebergColumn, TypeDescription> icebertToOrc = 
columnIds.inverse();
+      for (Types.NestedField field : schema.columns()) {
 
 Review comment:
   It seems that here we can iterate using the `icebergToOrc` instead of 
iterating using Iceberg schema and then constructing keys for `icebergToOrc` 
map, no?

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to