You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/07/14 06:07:24 UTC

[orc] branch main updated: ORC-836: StringGroupFromDoubleTreeReader Use Double toString (#740)

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 5030604  ORC-836: StringGroupFromDoubleTreeReader Use Double toString (#740)
5030604 is described below

commit 503060459de1e47923094df4263038ef5dbe5a98
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Wed Jul 14 02:07:16 2021 -0400

    ORC-836: StringGroupFromDoubleTreeReader Use Double toString (#740)
    
    ### What changes were proposed in this pull request?
    When converting from Double to String, use the Double class methods directly. Lower overhead of encoding by using ASCII.
    
    ### Why are the changes needed?
    Performance.
    
    ### How was this patch tested?
    No change in functionality.  Use existing unit tests.
---
 java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
index 2da0a2b..3e9906f 100644
--- a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
@@ -1101,8 +1101,8 @@ public class ConvertTreeReaderFactory extends TreeReaderFactory {
     public void setConvertVectorElement(int elementNum) {
       double doubleValue = doubleColVector.vector[elementNum];
       if (!Double.isNaN(doubleValue)) {
-        String string = String.valueOf(doubleValue);
-        byte[] bytes = string.getBytes(StandardCharsets.UTF_8);
+        String string = Double.toString(doubleValue);
+        byte[] bytes = string.getBytes(StandardCharsets.US_ASCII);
         assignStringGroupVectorEntry(bytesColVector, elementNum, readerType, bytes);
       } else {
         bytesColVector.noNulls = false;