pvary commented on a change in pull request #3912:
URL: https://github.com/apache/iceberg/pull/3912#discussion_r790766335
##########
File path: mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergSerDe.java
##########
@@ -176,12 +179,22 @@ private static Schema hiveSchemaOrThrow(Properties
serDeProperties, Exception pr
if (columnComments != null) {
Collections.addAll(comments,
columnComments.split(Character.toString(Character.MIN_VALUE)));
}
+ String identifierFields =
serDeProperties.getProperty(InputFormatConfig.IDENTIFIER_FIELD_NAMES);
+ Set<String> identifierFieldNames =
getIdentifierFieldSet(identifierFields);
Schema hiveSchema = HiveSchemaUtil.convert(names,
TypeInfoUtils.getTypeInfosFromTypeString(columnTypes),
- comments, autoConversion);
+ comments, autoConversion, identifierFieldNames);
LOG.info("Using hive schema {}", SchemaParser.toJson(hiveSchema));
return hiveSchema;
} else {
throw new SerDeException("Please provide an existing table or a valid
schema", previousException);
}
}
+
+ public static Set<String> getIdentifierFieldSet(@Nullable String
identifierFields) {
+ return Optional.ofNullable(identifierFields)
+ .filter(s -> !s.isEmpty())
+ .map(value ->
Arrays.asList((value).split(InputFormatConfig.IDENTIFIER_FIELDS_SEPARATOR)))
Review comment:
What happens when we have a name which contains `,`?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]