You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "roryqi (via GitHub)" <gi...@apache.org> on 2026/08/05 14:55:54 UTC
[PR] [#12379] feat(tag): Support tag assignment values on server [gravitino]
roryqi opened a new pull request, #12380:
URL: https://github.com/apache/gravitino/pull/12380
### What changes were proposed in this pull request?
Support tag assignment values across the common, core, and server layers:
- Add REST DTO support for tag value constraints and assignment values.
- Implement valued association, exact-value lookup, hooks, and listener events.
- Expose assignment values through REST endpoints and authorization handling.
- Preserve direct tag assignments when inherited assignments use different values.
- Reject ambiguous mixed valued and valueless additions for the same tag.
### Why are the changes needed?
The tag assignment value API and relational storage support have been merged. This PR connects those layers to the server and supersedes the remaining server portion of #12143.
Fix: #12379
### Does this PR introduce _any_ user-facing change?
Yes. Existing tag REST endpoints support value constraints and per-object assignment values.
### How was this patch tested?
- `./gradlew spotlessApply`
- `./gradlew :common:test --tests org.apache.gravitino.dto.requests.TestTagCreateRequest --tests org.apache.gravitino.dto.requests.TestTagsAssociateRequest --tests org.apache.gravitino.dto.tag.TestTagDTO -PskipITs -PskipDockerTests=false`
- `./gradlew :core:test --tests org.apache.gravitino.tag.TestTagManager --tests org.apache.gravitino.hook.TestTagHookDispatcher --tests org.apache.gravitino.listener.api.event.TestTagEvent -PskipITs -PskipDockerTests=false`
- `./gradlew :server:test --tests org.apache.gravitino.server.web.rest.TestMetadataObjectTagOperations --tests org.apache.gravitino.server.web.rest.TestTagOperations -PskipITs -PskipDockerTests=false`
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(tag): Support assignment values in common and core [gravitino]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12380:
URL: https://github.com/apache/gravitino/pull/12380#issuecomment-5200815381
<!-- coverage-report -->
### Code Coverage Report
|Overall Project|68.29% **`-0.14%`**|:green_circle:|
|:-|:-|:-:|
|Files changed|58.13%|:red_circle:|
<br>
|Module|Coverage||
|:-|:-|:-:|
|aliyun|1.72%|:red_circle:|
|api|49.37%|:green_circle:|
|authorization-common|85.96%|:green_circle:|
|aws|42.04%|:green_circle:|
|azure|2.47%|:red_circle:|
|catalog-common|9.92%|:red_circle:|
|catalog-fileset|79.74%|:green_circle:|
|catalog-glue|68.95%|:green_circle:|
|catalog-hive|79.4%|:green_circle:|
|catalog-jdbc-common|45.7%|:green_circle:|
|catalog-jdbc-doris|81.8%|:green_circle:|
|catalog-jdbc-mysql|79.33%|:green_circle:|
|catalog-jdbc-postgresql|83.39%|:green_circle:|
|catalog-jdbc-starrocks|79.16%|:green_circle:|
|catalog-kafka|77.01%|:green_circle:|
|catalog-lakehouse-generic|59.18%|:green_circle:|
|catalog-lakehouse-hudi|79.1%|:green_circle:|
|catalog-lakehouse-iceberg|85.93%|:green_circle:|
|catalog-lakehouse-paimon|84.23%|:green_circle:|
|catalog-model|77.72%|:green_circle:|
|cli|44.48%|:green_circle:|
|client-java|78.27%|:green_circle:|
|common|52.57% **`-1.6%`**|:green_circle:|
|core|83.19% **`+0.01%`**|:green_circle:|
|filesystem-hadoop3|77.28%|:green_circle:|
|flink|0.0%|:red_circle:|
|flink-common|48.68%|:green_circle:|
|flink-runtime|0.0%|:red_circle:|
|gcp|14.12%|:red_circle:|
|hadoop-auth|68.0%|:green_circle:|
|hadoop-common|12.7%|:red_circle:|
|hive-metastore-common|53.4%|:green_circle:|
|iceberg-common|64.75%|:green_circle:|
|iceberg-rest-server|75.03%|:green_circle:|
|idp-basic|86.02%|:green_circle:|
|integration-test-common|0.0%|:red_circle:|
|jobs|62.92%|:green_circle:|
|lance-common|31.75%|:red_circle:|
|lance-rest-server|63.47%|:green_circle:|
|lineage|53.02%|:green_circle:|
|optimizer|83.17%|:green_circle:|
|optimizer-api|21.95%|:red_circle:|
|server|85.76%|:green_circle:|
|server-common|76.45%|:green_circle:|
|spark|28.57%|:red_circle:|
|spark-common|45.89%|:green_circle:|
|tencent|69.84%|:green_circle:|
|trino-connector|40.29%|:green_circle:|
<details>
<summary>Files</summary>
|Module|File|Coverage||
|:-|:-|:-|:-:|
|common|[TagDTO.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/common/src/main/java/org/apache/gravitino/dto/tag/TagDTO.java)|88.0%|:green_circle:|
||[TagValuesAssociateRequest.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/common/src/main/java/org/apache/gravitino/dto/requests/TagValuesAssociateRequest.java)|80.77%|:green_circle:|
||[TagCreateRequest.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/common/src/main/java/org/apache/gravitino/dto/requests/TagCreateRequest.java)|80.0%|:green_circle:|
||[DTOConverters.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/common/src/main/java/org/apache/gravitino/dto/util/DTOConverters.java)|28.57%|:red_circle:|
|core|[TagEventDispatcher.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/listener/TagEventDispatcher.java)|91.08%|:green_circle:|
||[AssociateTagsForMetadataObjectFailureEvent.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/listener/api/event/AssociateTagsForMetadataObjectFailureEvent.java)|90.91%|:green_circle:|
||[AssociateTagsForMetadataObjectPreEvent.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/listener/api/event/AssociateTagsForMetadataObjectPreEvent.java)|90.91%|:green_circle:|
||[AssociateTagsForMetadataObjectEvent.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/listener/api/event/AssociateTagsForMetadataObjectEvent.java)|88.46%|:green_circle:|
||[TagManager.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/tag/TagManager.java)|85.96%|:green_circle:|
||[TagInfo.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/listener/api/info/TagInfo.java)|66.67%|:green_circle:|
||[TagHookDispatcher.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/hook/TagHookDispatcher.java)|41.67%|:red_circle:|
||[TagDispatcher.java](https://github.com/qqqttt123/gravitino/blob/69e35dc2ee65bc696c0c4ed40a0576b7a922f706/core/src/main/java/org/apache/gravitino/tag/TagDispatcher.java)|0.0%|:red_circle:|
</details>
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(tag): Support assignment values in common and core [gravitino]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #12380:
URL: https://github.com/apache/gravitino/pull/12380#discussion_r3725433074
##########
core/src/main/java/org/apache/gravitino/tag/TagManager.java:
##########
@@ -315,32 +340,37 @@ public Tag getTagForMetadataObject(String metalake, MetadataObject metadataObjec
public String[] associateTagsForMetadataObject(
String metalake, MetadataObject metadataObject, String[] tagsToAdd, String[] tagsToRemove)
throws NoSuchMetadataObjectException, TagAlreadyAssociatedException {
+ return associateTagValuesForMetadataObject(
+ metalake, metadataObject, toNoValue(tagsToAdd), toNoValue(tagsToRemove));
+ }
+
+ @Override
+ public String[] associateTagValuesForMetadataObject(
+ String metalake, MetadataObject metadataObject, TagValue[] tagsToAdd, TagValue[] tagsToRemove)
+ throws NoSuchMetadataObjectException, TagAlreadyAssociatedException {
Preconditions.checkArgument(
SUPPORTED_METADATA_OBJECT_TYPES_FOR_TAGS.contains(metadataObject.type()),
"Cannot associate tags for unsupported metadata object type %s",
metadataObject.type());
+ validateTagValuesToAdd(tagsToAdd);
Review Comment:
associateTagValuesForMetadataObject validates tagsToAdd but does not validate tagsToRemove elements; a null entry in tagsToRemove will flow into the LinkedHashSet and later cause an NPE in toRelationEdgeTargets (tagValue.name()). Add a null check for tagsToRemove similar to tagsToAdd to fail fast with a clear error.
##########
common/src/main/java/org/apache/gravitino/dto/requests/TagCreateRequest.java:
##########
@@ -72,5 +106,12 @@ public TagCreateRequest() {
public void validate() throws IllegalArgumentException {
Preconditions.checkArgument(
StringUtils.isNotBlank(name), "\"name\" is required and cannot be empty");
+
+ if (allowedValues != null) {
+ for (String value : allowedValues) {
+ Preconditions.checkArgument(
+ StringUtils.isNotBlank(value), "allowedValues cannot contain null or empty values");
+ }
Review Comment:
TagCreateRequest.validate() accepts allowedValues longer than 256 characters, but tag assignment values are stored in tag_relation_meta.tag_value as VARCHAR(256) and TagValuesAssociateRequest already enforces a 256-character limit. This can allow creating tags whose allowedValues can never be assigned (or can fail when bypassing REST validation). Add a length check consistent with the assignment value constraint.
##########
core/src/main/java/org/apache/gravitino/tag/TagDispatcher.java:
##########
@@ -96,6 +117,19 @@ public interface TagDispatcher {
*/
MetadataObject[] listMetadataObjectsForTag(String metalake, String name);
+ /**
+ * List all metadata objects associated with the specified tag and exact assignment value.
+ *
+ * @param metalake The name of the metalake.
+ * @param name The name of the tag.
+ * @param value The exact assignment value to match, or null to return all objects for the tag.
+ * @return The array of metadata objects associated with the specified tag and value.
+ */
Review Comment:
The new listMetadataObjectsForTag(metalake, name, value) overload uses null to mean "no filter", but it isn't clear how callers should query for valueless assignments (which are represented in storage as the empty string). Clarifying this in the Javadoc will help avoid misuse.
##########
common/src/test/java/org/apache/gravitino/dto/requests/TestTagCreateRequest.java:
##########
@@ -46,4 +47,32 @@ public void testTagCreateRequestSerDe() throws JsonProcessingException {
Assertions.assertEquals(request1, deserRequest1);
Assertions.assertEquals(properties, deserRequest1.getProperties());
}
+
+ @Test
+ public void testTagCreateRequestSerDeWithAllowedValues() throws JsonProcessingException {
+ String[] allowedValues = new String[] {"finance", "risk"};
+ TagCreateRequest request = new TagCreateRequest("tag_test", "tag comment", null, allowedValues);
+
+ String serJson = JsonUtils.objectMapper().writeValueAsString(request);
+ TagCreateRequest deserRequest =
+ JsonUtils.objectMapper().readValue(serJson, TagCreateRequest.class);
+
+ Assertions.assertEquals(request, deserRequest);
+ Assertions.assertArrayEquals(allowedValues, deserRequest.getAllowedValues());
+ }
+
+ @Test
+ public void testTagCreateRequestValidateAllowedValues() {
+ new TagCreateRequest("tag_test", "tag comment", null, new String[] {"finance"}).validate();
+
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () -> new TagCreateRequest("tag_test", null, null, new String[] {""}).validate());
+ char[] longValueChars = new char[257];
+ Arrays.fill(longValueChars, 'a');
+ Assertions.assertDoesNotThrow(
+ () ->
+ new TagCreateRequest("tag_test", null, null, new String[] {new String(longValueChars)})
+ .validate());
Review Comment:
This test currently asserts that allowedValues of length 257 is valid, but tag assignment values are constrained to VARCHAR(256) (and TagValuesAssociateRequest enforces 256). Update the test to treat 256 as the maximum accepted length and to reject 257+.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(core): Support assignment values in common and core [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi merged PR #12380:
URL: https://github.com/apache/gravitino/pull/12380
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(tag): Support assignment values in common and core [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on PR #12380:
URL: https://github.com/apache/gravitino/pull/12380#issuecomment-5199802728
@mchades Could u take a look for this pull request again?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(tag): Support assignment values in common and core [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12380:
URL: https://github.com/apache/gravitino/pull/12380#discussion_r3725788920
##########
core/src/main/java/org/apache/gravitino/tag/TagManager.java:
##########
@@ -381,6 +413,69 @@ public String[] associateTagsForMetadataObject(
}));
}
+ private static String[] allowedValuesForStorage(TagValueConstraint valueConstraint) {
+ TagValueConstraint normalizedConstraint =
+ valueConstraint == null ? TagValueConstraint.anyValue() : valueConstraint;
+ switch (normalizedConstraint.type()) {
+ case ANY_VALUE:
+ return null;
+ case NO_VALUE:
+ return normalizedConstraint.allowedValues();
+ case ALLOWED_VALUES:
+ return Arrays.stream(normalizedConstraint.allowedValues())
+ .distinct()
+ .toArray(String[]::new);
+ default:
+ throw new IllegalArgumentException("Unknown tag value constraint: " + normalizedConstraint);
+ }
+ }
+
+ private static void validateTagValuesToAdd(TagValue[] tagValues) {
+ if (tagValues == null) {
+ return;
+ }
+
+ Map<String, Boolean> valuedByTagName = Maps.newHashMap();
+ for (TagValue tagValue : tagValues) {
+ Preconditions.checkNotNull(tagValue, "Tag value to add must not be null");
+ boolean valued = tagValue.value().isPresent();
+ Boolean previous = valuedByTagName.putIfAbsent(tagValue.name(), valued);
+ Preconditions.checkArgument(
+ previous == null || previous == valued,
+ "Cannot add assignments both with and without values for tag %s",
+ tagValue.name());
+ }
+ }
+
+ private static void validateTagValuesToRemove(TagValue[] tagValues) {
+ if (tagValues == null) {
+ return;
+ }
+
+ for (TagValue tagValue : tagValues) {
+ Preconditions.checkNotNull(tagValue, "Tag value to remove must not be null");
+ }
+ }
+
+ private static TagValue[] toNoValue(String[] tags) {
+ if (tags == null) {
+ return null;
+ }
+
+ return Arrays.stream(tags).map(TagValue::noValue).toArray(TagValue[]::new);
+ }
+
+ private static RelationEdgeTarget[] toRelationEdgeTargets(String metalake, TagValue[] tagValues) {
Review Comment:
This helper does not access any instance state, so it is intentionally static. This is also consistent with the existing `toRelationEdgeTargets` helpers in `SupportsRelationOperations` and `RelationalEntityStore`.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(tag): Support assignment values in common and core [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades commented on code in PR #12380:
URL: https://github.com/apache/gravitino/pull/12380#discussion_r3725728205
##########
core/src/main/java/org/apache/gravitino/tag/TagManager.java:
##########
@@ -381,6 +413,69 @@ public String[] associateTagsForMetadataObject(
}));
}
+ private static String[] allowedValuesForStorage(TagValueConstraint valueConstraint) {
+ TagValueConstraint normalizedConstraint =
+ valueConstraint == null ? TagValueConstraint.anyValue() : valueConstraint;
+ switch (normalizedConstraint.type()) {
+ case ANY_VALUE:
+ return null;
+ case NO_VALUE:
+ return normalizedConstraint.allowedValues();
+ case ALLOWED_VALUES:
+ return Arrays.stream(normalizedConstraint.allowedValues())
+ .distinct()
+ .toArray(String[]::new);
+ default:
+ throw new IllegalArgumentException("Unknown tag value constraint: " + normalizedConstraint);
+ }
+ }
+
+ private static void validateTagValuesToAdd(TagValue[] tagValues) {
+ if (tagValues == null) {
+ return;
+ }
+
+ Map<String, Boolean> valuedByTagName = Maps.newHashMap();
+ for (TagValue tagValue : tagValues) {
+ Preconditions.checkNotNull(tagValue, "Tag value to add must not be null");
+ boolean valued = tagValue.value().isPresent();
+ Boolean previous = valuedByTagName.putIfAbsent(tagValue.name(), valued);
+ Preconditions.checkArgument(
+ previous == null || previous == valued,
+ "Cannot add assignments both with and without values for tag %s",
+ tagValue.name());
+ }
+ }
+
+ private static void validateTagValuesToRemove(TagValue[] tagValues) {
+ if (tagValues == null) {
+ return;
+ }
+
+ for (TagValue tagValue : tagValues) {
+ Preconditions.checkNotNull(tagValue, "Tag value to remove must not be null");
+ }
+ }
+
+ private static TagValue[] toNoValue(String[] tags) {
+ if (tags == null) {
+ return null;
+ }
+
+ return Arrays.stream(tags).map(TagValue::noValue).toArray(TagValue[]::new);
+ }
+
+ private static RelationEdgeTarget[] toRelationEdgeTargets(String metalake, TagValue[] tagValues) {
Review Comment:
Unnecessary to use `static`?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12379] feat(tag): Support assignment values in common and core [gravitino]
Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #12380:
URL: https://github.com/apache/gravitino/pull/12380#discussion_r3725530835
##########
core/src/main/java/org/apache/gravitino/tag/TagDispatcher.java:
##########
@@ -96,6 +117,19 @@ public interface TagDispatcher {
*/
MetadataObject[] listMetadataObjectsForTag(String metalake, String name);
+ /**
+ * List all metadata objects associated with the specified tag and exact assignment value.
+ *
+ * @param metalake The name of the metalake.
+ * @param name The name of the tag.
+ * @param value The exact assignment value to match, or null to return all objects for the tag.
+ * @return The array of metadata objects associated with the specified tag and value.
+ */
Review Comment:
Thanks. By design, `null` means no value filter, while this overload only supports exact lookup of non-blank assignment values. Valueless assignments are not queryable through the value filter; the empty string is an internal storage representation rather than a public query value.
##########
core/src/main/java/org/apache/gravitino/tag/TagManager.java:
##########
@@ -315,32 +340,37 @@ public Tag getTagForMetadataObject(String metalake, MetadataObject metadataObjec
public String[] associateTagsForMetadataObject(
String metalake, MetadataObject metadataObject, String[] tagsToAdd, String[] tagsToRemove)
throws NoSuchMetadataObjectException, TagAlreadyAssociatedException {
+ return associateTagValuesForMetadataObject(
+ metalake, metadataObject, toNoValue(tagsToAdd), toNoValue(tagsToRemove));
+ }
+
+ @Override
+ public String[] associateTagValuesForMetadataObject(
+ String metalake, MetadataObject metadataObject, TagValue[] tagsToAdd, TagValue[] tagsToRemove)
+ throws NoSuchMetadataObjectException, TagAlreadyAssociatedException {
Preconditions.checkArgument(
SUPPORTED_METADATA_OBJECT_TYPES_FOR_TAGS.contains(metadataObject.type()),
"Cannot associate tags for unsupported metadata object type %s",
metadataObject.type());
+ validateTagValuesToAdd(tagsToAdd);
Review Comment:
Fixed in cba3dee89. `tagsToRemove` is now validated before set normalization and relation conversion, and a regression test verifies that a null entry fails fast with a clear message.
##########
common/src/test/java/org/apache/gravitino/dto/requests/TestTagCreateRequest.java:
##########
@@ -46,4 +47,32 @@ public void testTagCreateRequestSerDe() throws JsonProcessingException {
Assertions.assertEquals(request1, deserRequest1);
Assertions.assertEquals(properties, deserRequest1.getProperties());
}
+
+ @Test
+ public void testTagCreateRequestSerDeWithAllowedValues() throws JsonProcessingException {
+ String[] allowedValues = new String[] {"finance", "risk"};
+ TagCreateRequest request = new TagCreateRequest("tag_test", "tag comment", null, allowedValues);
+
+ String serJson = JsonUtils.objectMapper().writeValueAsString(request);
+ TagCreateRequest deserRequest =
+ JsonUtils.objectMapper().readValue(serJson, TagCreateRequest.class);
+
+ Assertions.assertEquals(request, deserRequest);
+ Assertions.assertArrayEquals(allowedValues, deserRequest.getAllowedValues());
+ }
+
+ @Test
+ public void testTagCreateRequestValidateAllowedValues() {
+ new TagCreateRequest("tag_test", "tag comment", null, new String[] {"finance"}).validate();
+
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () -> new TagCreateRequest("tag_test", null, null, new String[] {""}).validate());
+ char[] longValueChars = new char[257];
+ Arrays.fill(longValueChars, 'a');
+ Assertions.assertDoesNotThrow(
+ () ->
+ new TagCreateRequest("tag_test", null, null, new String[] {new String(longValueChars)})
+ .validate());
Review Comment:
Updated in d56f47200. The test now covers both boundaries: a 256-character allowed value succeeds and a 257-character allowed value is rejected.
##########
common/src/main/java/org/apache/gravitino/dto/requests/TagCreateRequest.java:
##########
@@ -72,5 +106,12 @@ public TagCreateRequest() {
public void validate() throws IllegalArgumentException {
Preconditions.checkArgument(
StringUtils.isNotBlank(name), "\"name\" is required and cannot be empty");
+
+ if (allowedValues != null) {
+ for (String value : allowedValues) {
+ Preconditions.checkArgument(
+ StringUtils.isNotBlank(value), "allowedValues cannot contain null or empty values");
+ }
Review Comment:
Fixed in d56f47200. The validation applies to each individual allowed value: values up to 256 characters are accepted, while values longer than 256 characters are rejected. The `allowedValues` array itself has no count or aggregate-length limit.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org