voonhous commented on code in PR #21096:
URL: https://github.com/apache/hudi/pull/21096#discussion_r4811682268
##########
hudi-trino/src/main/java/io/trino/plugin/hudi/HudiUtil.java:
##########
@@ -494,13 +495,25 @@ public static List<HiveColumnHandle>
appendMissingSchemaColumns(HoodieSchema dat
List<HiveColumnHandle> columns = new ArrayList<>(projection);
for (HoodieSchemaField field : dataSchema.getFields()) {
- if (existingColumns.add(field.name().toLowerCase(Locale.ROOT))) {
+ if (!isNullOnly(field) &&
existingColumns.add(field.name().toLowerCase(Locale.ROOT))) {
Review Comment:
Good catch, fixed in e299d80fd78a. `toColumnHandle` now types the field with
its null-only members left out, at any depth (records, arrays, maps, union
branches), as Hive sync does for the struct.
The merger fixture gains a `detail` record with a null-only member,
registered as `struct<label:string>`. Without the fix, the two queries that do
not project it fail with `No null column type support`.
`testNestedRecordWithNullOnlyMemberMerges` checks its merged values when
projected.
##########
hudi-trino/src/test/java/io/trino/plugin/hudi/TestHudiUtilColumnHandles.java:
##########
@@ -155,6 +155,23 @@ public void testAppendMissingSchemaColumns()
assertThat(expanded.get(2).getType()).isEqualTo(INTEGER);
}
+ @Test
+ public void testAppendMissingSchemaColumnsSkipsNullOnlyFields()
Review Comment:
Added `testNullOnlyMergeRequiredFieldIsLeftOut` to
`TestHudiMergeRequiredColumns` (e299d80fd78a). It orders on `ts,seq` with `seq`
typed `null` and `_hoodie_operation` typed `["null"]`. Both are left out, and
`ts` is still recovered.
--
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]