jonvex commented on code in PR #13711:
URL: https://github.com/apache/hudi/pull/13711#discussion_r2357307064


##########
hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestDataGenerator.java:
##########
@@ -598,6 +669,106 @@ public GenericRecord 
generateRecordForTripEncodedDecimalSchema(String rowKey, St
     return rec;
   }
 
+  public GenericRecord generateRecordForTripLogicalTypesSchema(HoodieKey key, 
String riderName, String driverName,
+                                                               long timestamp, 
boolean isDeleteRecord, boolean v6, boolean hasLTS) {
+    GenericRecord rec;
+    if (!hasLTS) {
+      rec = new GenericData.Record(AVRO_TRIP_LOGICAL_TYPES_SCHEMA_NO_LTS);
+    } else if (v6) {
+      rec = new GenericData.Record(AVRO_TRIP_LOGICAL_TYPES_SCHEMA_V6);
+    } else {
+      rec = new GenericData.Record(AVRO_TRIP_LOGICAL_TYPES_SCHEMA);
+    }
+    generateTripPrefixValues(rec, key.getRecordKey(), key.getPartitionPath(), 
riderName, driverName, timestamp);
+
+    int hash = key.getRecordKey().hashCode();
+    boolean above = (hash & 1) == 0; // half above, half below threshold
+
+    // -------------------
+    // Threshold definitions
+    // -------------------
+    Instant tsMillisThreshold = Instant.parse("2020-01-01T00:00:00Z");
+    Instant tsMicrosThreshold = Instant.parse("2020-06-01T12:00:00Z");
+
+    //LocalTime timeMillisThreshold = LocalTime.of(12, 0, 0);  // noon
+    //LocalTime timeMicrosThreshold = LocalTime.of(6, 0, 0);   // 6 AM
+
+    Instant localTsMillisThreshold = ZonedDateTime.of(
+        2015, 5, 20, 12, 34, 56, 0, ZoneOffset.UTC).toInstant();
+    Instant localTsMicrosThreshold = ZonedDateTime.of(
+        2017, 7, 7, 7, 7, 7, 0, ZoneOffset.UTC).toInstant();
+
+    LocalDate dateThreshold = LocalDate.of(2000, 1, 1);
+
+    // -------------------
+    // Assign edge values
+    // -------------------
+
+    // ts_millis
+    long tsMillisBase = tsMillisThreshold.toEpochMilli();
+    rec.put("ts_millis", above ? tsMillisBase + 1 : tsMillisBase - 1);
+
+    // ts_micros
+    long tsMicrosBase = 
TimeUnit.SECONDS.toMicros(tsMicrosThreshold.getEpochSecond()) + 
tsMicrosThreshold.getNano() / 1_000L;
+    rec.put("ts_micros", above ? tsMicrosBase + 1 : tsMicrosBase - 1);
+
+    // time_millis
+    //int timeMillisBase = (int) 
TimeUnit.SECONDS.toMillis(timeMillisThreshold.toSecondOfDay());
+    //rec.put("time_millis", above ? timeMillisBase + 1 : timeMillisBase - 1);
+
+    // time_micros
+    //long timeMicrosBase = 
TimeUnit.SECONDS.toMicros(timeMicrosThreshold.toSecondOfDay());
+    //rec.put("time_micros", above ? timeMicrosBase + 1 : timeMicrosBase - 1);

Review Comment:
   remove these because spark doesn't currently have support



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