[HUDI-3936] Fix projection for a nested field as pre-combined key (#5379)
This PR fixes the projection logic around a nested field which is used as the pre-combined key field. The fix is to only check and append the root level field for projection, i.e., "a", for a nested field "a.b.c" in the mandatory columns. - Changes the logic to check and append the root level field for a required nested field in the mandatory columns in HoodieBaseRelation.appendMandatoryColumns
This commit is contained in:
@@ -257,6 +257,13 @@ public class TestHoodieAvroUtils {
|
||||
assertEquals(expectedSchema, rec1.getSchema());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRootLevelFieldName() {
|
||||
assertEquals("a", HoodieAvroUtils.getRootLevelFieldName("a.b.c"));
|
||||
assertEquals("a", HoodieAvroUtils.getRootLevelFieldName("a"));
|
||||
assertEquals("", HoodieAvroUtils.getRootLevelFieldName(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNestedFieldVal() {
|
||||
GenericRecord rec = new GenericData.Record(new Schema.Parser().parse(EXAMPLE_SCHEMA));
|
||||
|
||||
Reference in New Issue
Block a user