You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/07/01 20:45:55 UTC

[GitHub] [incubator-iceberg] edgarRd commented on a change in pull request #227: ORC column map fix

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

 ##########
 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:
   I've avoided constructing keys by using `Integer` for the column mapping. I think this is more straightforward. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org