voonhous commented on code in PR #17763:
URL: https://github.com/apache/hudi/pull/17763#discussion_r2656170455


##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/util/AvroOrcUtils.java:
##########
@@ -671,13 +622,65 @@ public static TypeDescription createOrcSchema(Schema 
avroSchema) {
       case INT:
         return TypeDescription.createInt();
       case BYTES:
+      case FIXED:
         return TypeDescription.createBinary();
+      case DECIMAL:
+        return TypeDescription.createDecimal()
+            .withPrecision(((HoodieSchema.Decimal) schema).getPrecision())
+            .withScale(((HoodieSchema.Decimal) schema).getScale());
+      case DATE:
+        // The date logical type represents a date within the calendar, with 
no reference to a particular time zone
+        // or time of day.
+        //
+        // A date logical type annotates an Avro int, where the int stores the 
number of days from the unix epoch, 1
+        // January 1970 (ISO calendar).
+        return TypeDescription.createDate();
+      case TIME:
+        HoodieSchema.Time timeSchema = (HoodieSchema.Time) schema;
+        if (timeSchema.getPrecision() == TimePrecision.MILLIS) {
+          // The time-millis logical type represents a time of day, with no 
reference to a particular calendar, time
+          // zone or date, with a precision of one millisecond.
+          //
+          // A time-millis logical type annotates an Avro int, where the int 
stores the number of milliseconds after
+          // midnight, 00:00:00.000.
+          return TypeDescription.createInt();
+        } else if (timeSchema.getPrecision() == TimePrecision.MICROS) {
+          // The time-micros logical type represents a time of day, with no 
reference to a particular calendar, time
+          // zone or date, with a precision of one microsecond.
+          //
+          // A time-micros logical type annotates an Avro long, where the long 
stores the number of microseconds after
+          // midnight, 00:00:00.000000.
+          return TypeDescription.createLong();
+        } else {
+          throw new IllegalStateException(
+              String.format("Unrecognized TimePrecision for: %s for Time type: 
%s", timeSchema.getPrecision(), timeSchema));
+        }
+      case TIMESTAMP:

Review Comment:
   Yeap, we should preserve as this is a refactoring. Let's try not to change 
any behaviour first.
   
   I will add a comment to this explicit handling too.
   
   Will add a test for this too.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to