sv2000 commented on a change in pull request #3038:
URL: https://github.com/apache/incubator-gobblin/pull/3038#discussion_r439692012



##########
File path: 
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/orc/OrcUtils.java
##########
@@ -482,4 +483,32 @@ public static WritableComparable 
createValueRecursively(TypeDescription schema,
   public static WritableComparable createValueRecursively(TypeDescription 
schema) {
     return createValueRecursively(schema, 1);
   }
+
+  /**
+   * Check recursively if owning schema is eligible to be up-converted to 
targetSchema:
+   * 1. TargetSchema is a subset of originalSchema.
+   * 2. TargetSchema is larger than originalSchema.
+   */
+  public static boolean eligibleForUpConvert(TypeDescription originalSchema, 
TypeDescription targetSchema) {
+    if (!targetSchema.getCategory().isPrimitive()) {
+      if (originalSchema.getFieldNames().size() < 
targetSchema.getFieldNames().size()) {
+        return true;

Review comment:
       Why is targetSchema having more fields than original schema a sufficient 
condition for up conversion?

##########
File path: 
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/orc/OrcUtils.java
##########
@@ -482,4 +483,32 @@ public static WritableComparable 
createValueRecursively(TypeDescription schema,
   public static WritableComparable createValueRecursively(TypeDescription 
schema) {
     return createValueRecursively(schema, 1);
   }
+
+  /**
+   * Check recursively if owning schema is eligible to be up-converted to 
targetSchema:
+   * 1. TargetSchema is a subset of originalSchema.
+   * 2. TargetSchema is larger than originalSchema.
+   */
+  public static boolean eligibleForUpConvert(TypeDescription originalSchema, 
TypeDescription targetSchema) {
+    if (!targetSchema.getCategory().isPrimitive()) {
+      if (originalSchema.getFieldNames().size() < 
targetSchema.getFieldNames().size()) {
+        return true;

Review comment:
       Shouldn't we be checking if each field in the target Schema is present 
in the record schema? 




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


Reply via email to