voonhous commented on code in PR #17535:
URL: https://github.com/apache/hudi/pull/17535#discussion_r2608910541
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTableSchemaResolver.java:
##########
@@ -83,28 +84,27 @@ class TestTableSchemaResolver {
@Test
void testRecreateSchemaWhenDropPartitionColumns() {
- Schema originSchema = new
Schema.Parser().parse(HoodieTestDataGenerator.TRIP_EXAMPLE_SCHEMA);
+ HoodieSchema originSchema =
HoodieSchema.parse(HoodieTestDataGenerator.TRIP_EXAMPLE_SCHEMA);
// case2
String[] pts1 = new String[0];
- Schema s2 = TableSchemaResolver.appendPartitionColumns(originSchema,
Option.of(pts1));
+ HoodieSchema s2 = TableSchemaResolver.appendPartitionColumns(originSchema,
Option.of(pts1));
assertEquals(originSchema, s2);
// case3: partition_path is in originSchema
String[] pts2 = {"partition_path"};
- Schema s3 = TableSchemaResolver.appendPartitionColumns(originSchema,
Option.of(pts2));
+ HoodieSchema s3 = TableSchemaResolver.appendPartitionColumns(originSchema,
Option.of(pts2));
assertEquals(originSchema, s3);
// case4: user_partition is not in originSchema
String[] pts3 = {"user_partition"};
- Schema s4 = TableSchemaResolver.appendPartitionColumns(originSchema,
Option.of(pts3));
+ HoodieSchema s4 = TableSchemaResolver.appendPartitionColumns(originSchema,
Option.of(pts3));
assertNotEquals(originSchema, s4);
assertTrue(s4.getFields().stream().anyMatch(f ->
f.name().equals("user_partition")));
- Schema.Field f = s4.getField("user_partition");
- assertEquals(f.schema(),
AvroSchemaUtils.createNullableSchema(Schema.Type.STRING));
+ HoodieSchemaField f = s4.getField("user_partition").get();
+ assertEquals(f.schema(),
HoodieSchema.createNullable(HoodieSchemaType.STRING));
// case5: user_partition is in originSchema, but partition_path is in
originSchema
- String[] pts4 = {"user_partition", "partition_path"};
Review Comment:
Using pts4 for the last test will cause the test to fail. I checked the git
blame. This variable is there since the creation of this file. I hazard that
this is WIP var that the original author forgot to remove this.
--
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]