This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new 942efb929 ORC-1215: Remove a wrong `NotNull` annotation on `value` of 
`setAttribute`
942efb929 is described below

commit 942efb9295ec02deff4c1160004bcce000295636
Author: William Hyun <[email protected]>
AuthorDate: Sun Jul 17 02:29:34 2022 -0700

    ORC-1215: Remove a wrong `NotNull` annotation on `value` of `setAttribute`
    
    ### What changes were proposed in this pull request?
    This PR aims to remove a wrong `NotNull` annotation on `value`.
    
    ### Why are the changes needed?
    According to ORC-529, attribute value can be null to clear the existing 
value.
    
    
https://github.com/apache/orc/blob/8eef0c495ffe334825655ec22c1516b24ecd9f48/java/core/src/java/org/apache/orc/TypeDescription.java#L245-L249
    
    ### How was this patch tested?
    Pass the CIs with the newly added test case.
    
    Closes #1177 from williamhyun/setattribute.
    
    Authored-by: William Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
    (cherry picked from commit 765a857e83eb81d521ce7c9a3ee181be78c2fd80)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 java/core/src/java/org/apache/orc/TypeDescription.java     | 2 +-
 java/core/src/test/org/apache/orc/TestTypeDescription.java | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/java/core/src/java/org/apache/orc/TypeDescription.java 
b/java/core/src/java/org/apache/orc/TypeDescription.java
index 10520a81d..7b20a0e78 100644
--- a/java/core/src/java/org/apache/orc/TypeDescription.java
+++ b/java/core/src/java/org/apache/orc/TypeDescription.java
@@ -246,7 +246,7 @@ public class TypeDescription
    * @return this for method chaining
    */
   public TypeDescription setAttribute(@NotNull String key,
-                                      @NotNull String value) {
+                                      String value) {
     attributes.put(key, value);
     return this;
   }
diff --git a/java/core/src/test/org/apache/orc/TestTypeDescription.java 
b/java/core/src/test/org/apache/orc/TestTypeDescription.java
index 9203eaf6b..5f16742c6 100644
--- a/java/core/src/test/org/apache/orc/TestTypeDescription.java
+++ b/java/core/src/test/org/apache/orc/TestTypeDescription.java
@@ -509,4 +509,10 @@ public class TestTypeDescription {
           schema.findSubtype(column, true).getFullFieldName());
     }
   }
+
+  @Test
+  public void testSetAttribute() {
+    TypeDescription type = TypeDescription.fromString("int");
+    type.setAttribute("key1", null);
+  }
 }

Reply via email to