This is an automated email from the ASF dual-hosted git repository.
mchades pushed a commit to branch branch-1.1
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-1.1 by this push:
new a7ccf755f8 [#7705] Improvement: Add check for null/empty for partition
field names (#9409)
a7ccf755f8 is described below
commit a7ccf755f808517ffa920db6fc8a922a749c26ed
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 9 11:26:33 2025 +0800
[#7705] Improvement: Add check for null/empty for partition field names
(#9409)
### What changes were proposed in this pull request?
This PR adds a validation check for the fieldName argument in the
PartitionUtils.validateFieldExistence method to ensure it is not null,
empty, or blank.
This prevents invalid inputs from causing unexpected behavior later in
the validation logic.
### Why are the changes needed?
Previously, the method assumed fieldName and its first element were
valid, which could result in a NullPointerException or invalid behavior
if passed a null, empty, or whitespace-only value.
Fix: #(issue)
### Does this PR introduce _any_ user-facing change?
No, this is an internal utility method enhancement and does not
introduce any user-facing API or configuration change.
### How was this patch tested?
Co-authored-by: Raveendra Pujari
<[email protected]>
Co-authored-by: Jerry Shao <[email protected]>
---
common/src/main/java/org/apache/gravitino/dto/rel/PartitionUtils.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/common/src/main/java/org/apache/gravitino/dto/rel/PartitionUtils.java
b/common/src/main/java/org/apache/gravitino/dto/rel/PartitionUtils.java
index a9aa5bf3a9..d965ea6908 100644
--- a/common/src/main/java/org/apache/gravitino/dto/rel/PartitionUtils.java
+++ b/common/src/main/java/org/apache/gravitino/dto/rel/PartitionUtils.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
/** Utility class for partitioning validation. */
public class PartitionUtils {
@@ -39,7 +40,8 @@ public class PartitionUtils {
throws IllegalArgumentException {
Preconditions.checkArgument(ArrayUtils.isNotEmpty(columns), "columns
cannot be null or empty");
Preconditions.checkArgument(
- ArrayUtils.isNotEmpty(fieldName), "fieldName cannot be null or empty");
+ ArrayUtils.isNotEmpty(fieldName) &&
StringUtils.isNotBlank(fieldName[0]),
+ "fieldName cannot be null or empty");
// Check if nested fields are supported (currently not supported)
Preconditions.checkArgument(