pvary commented on a change in pull request #2078: URL: https://github.com/apache/iceberg/pull/2078#discussion_r558255721
########## File path: mr/src/main/java/org/apache/iceberg/mr/hive/Deserializer.java ########## @@ -221,51 +223,54 @@ public ObjectInspector listElementPartner(ObjectInspector inspector) { /** * Hive query results schema column names do not match the target Iceberg column names. * Instead we have to rely on the column order. To keep the other parts of the code generic we fix this with a - * wrapper around the ObjectInspector. This wrapper uses the Iceberg schema column names instead of the Hive column - * names for {@link #getStructFieldRef(String) getStructFieldRef} + * wrapper around the ObjectInspectorPair. This wrapper maps the Iceberg schema column names instead of the Hive + * column names. */ - private static class FixNameMappingObjectInspector extends StructObjectInspector { - private final StructObjectInspector innerInspector; - private final Map<String, StructField> nameMap; + private static class FixNameMappingObjectInspectorPair extends ObjectInspectorPair { + private final Map<String, String> sourceNameMap; + + FixNameMappingObjectInspectorPair(Schema schema, ObjectInspectorPair pair) { + super(pair.writerInspector(), pair.sourceInspector()); - private FixNameMappingObjectInspector(Schema schema, ObjectInspector inspector) { - this.nameMap = new HashMap<>(schema.columns().size()); - this.innerInspector = (StructObjectInspector) inspector; - List<? extends StructField> fields = innerInspector.getAllStructFieldRefs(); + this.sourceNameMap = new HashMap<>(schema.columns().size()); + List<? extends StructField> fields = ((StructObjectInspector) sourceInspector()).getAllStructFieldRefs(); for (int i = 0; i < schema.columns().size(); ++i) { - nameMap.put(schema.columns().get(i).name(), fields.get(i)); + sourceNameMap.put(schema.columns().get(i).name(), fields.get(i).getFieldName()); } } @Override - public List<? extends StructField> getAllStructFieldRefs() { - return innerInspector.getAllStructFieldRefs(); + String sourceName(String originalName) { + return sourceNameMap.get(originalName); } + } - @Override - public StructField getStructFieldRef(String fieldName) { - return nameMap.get(fieldName); - } + /** + * To get the data for Iceberg {@link Record}s we have to use the Hive ObjectInspectors (sourceInspector) to get Review comment: Tried my best 😄 Please check the new one. ########## File path: mr/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/WriteObjectInspector.java ########## @@ -19,6 +19,11 @@ package org.apache.iceberg.mr.hive.serde.objectinspector; +/** + * Interface for converting the Hive primitive objects for to the objects which could be added to an Iceberg Record. Review comment: Fixed. Thanks! ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org