jerryshao commented on code in PR #14953:
URL: https://github.com/apache/gravitino/pull/14953#discussion_r4559726327
##########
core/src/main/java/org/apache/gravitino/catalog/SemanticModelValidator.java:
##########
@@ -100,22 +116,53 @@ private static void validateSource(NameIdentifier source,
String path) {
}
}
- private static void validateFields(@Nullable Field[] fields, String path) {
+ private static Set<String> validateFields(@Nullable Field[] fields, String
path) {
+ Set<String> fieldNames = new HashSet<>();
if (fields == null) {
- return;
+ return fieldNames;
}
- Map<String, String> fieldNames = new HashMap<>();
+ Map<String, String> uniqueNames = new HashMap<>();
for (int index = 0; index < fields.length; index++) {
String fieldPath = path + "[" + index + "]";
Field field = fields[index];
String namePath = fieldPath + ".name";
- validateUniqueName(field.name(), namePath, "field", fieldNames);
+ // Key and relationship references resolve field names
case-insensitively, so two
+ // declared names equal ignoring case would make every reference to them
ambiguous.
+ validateUniqueName(normalizeFieldName(field.name()), namePath, "field",
uniqueNames);
+ fieldNames.add(normalizeFieldName(field.name()));
+ }
+ return fieldNames;
+ }
+
+ private static void validateKeys(Dataset dataset, String path, Set<String>
fieldNames) {
Review Comment:
Datasets with no fields now reject any key or relationship column, so
already-stored models that name source columns would fail on their next alter
even for unrelated changes. Is there existing data or a migration plan for
this, or is the feature unreleased?
--
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]