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

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


The following commit(s) were added to refs/heads/main by this push:
     new d78fae803 ORC-1506: Replacing deprecated valueOf() with recommended 
forNumber()
d78fae803 is described below

commit d78fae803eba71694c83ae6574e081a5bf2a6f6a
Author: mystic-lama <[email protected]>
AuthorDate: Thu Sep 21 08:43:24 2023 -0700

    ORC-1506: Replacing deprecated valueOf() with recommended forNumber()
    
    ### What changes were proposed in this pull request?
    The PR aims at replacing deprecated valueOf() with recommended forNumber().
    valueOf() has been deprecated for a while and shall be removed in future 
versions. We are only removing it from the code we have written, it still 
exists in auto-generated code. Autogenerate code shall be compliant with 
version upgrade in future.
    
    Couldn't find the exact PR for the change, however the reason seems to be 
performance related from search about the change
    
    ### Why are the changes needed?
    The change helps protect against the removal of deprecated API in future 
releases.
    
    ### How was this patch tested?
    No new tests were added, current tests pass
    
    Closes #1619 from mystic-lama/deprecated_proto_valueOf.
    
    Lead-authored-by: mystic-lama <[email protected]>
    Co-authored-by: Ash <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 java/core/src/java/org/apache/orc/impl/WriterImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/core/src/java/org/apache/orc/impl/WriterImpl.java 
b/java/core/src/java/org/apache/orc/impl/WriterImpl.java
index 73450c68f..b5bb64387 100644
--- a/java/core/src/java/org/apache/orc/impl/WriterImpl.java
+++ b/java/core/src/java/org/apache/orc/impl/WriterImpl.java
@@ -612,7 +612,7 @@ public class WriterImpl implements WriterInternal, 
MemoryManager.Callback {
     HadoopShims.KeyMetadata meta = key.getMetadata();
     result.setKeyName(meta.getKeyName());
     result.setKeyVersion(meta.getVersion());
-    result.setAlgorithm(OrcProto.EncryptionAlgorithm.valueOf(
+    result.setAlgorithm(OrcProto.EncryptionAlgorithm.forNumber(
         meta.getAlgorithm().getSerialization()));
     return result;
   }
@@ -646,7 +646,7 @@ public class WriterImpl implements WriterInternal, 
MemoryManager.Callback {
     for(WriterEncryptionVariant variant: encryption) {
       encrypt.addVariants(writeEncryptionVariant(variant));
     }
-    encrypt.setKeyProvider(OrcProto.KeyProviderKind.valueOf(
+    encrypt.setKeyProvider(OrcProto.KeyProviderKind.forNumber(
         keyProvider.getKind().getValue()));
     return encrypt;
   }

Reply via email to