You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2019/12/06 16:44:00 UTC

[orc] branch branch-1.6 updated: ORC-574: Use const references for string statistics.

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

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


The following commit(s) were added to refs/heads/branch-1.6 by this push:
     new 31dbe13  ORC-574: Use const references for string statistics.
31dbe13 is described below

commit 31dbe1382a5963780474fca730528c6a830c9057
Author: david.zanter <Da...@sas.com>
AuthorDate: Wed Dec 4 15:16:22 2019 -0500

    ORC-574: Use const references for string statistics.
    
    A large portion of cpu in write scenarios is being used in std::string
    alloc/delete due to the getMaximum/Minimum returning std:string
    copies.  Changing the getMaximum/getMinimum methods to return const
    vals will prevent these alloc/copy/deletes from occurring.
    
    This results in about a 30% cpu boost to write.
    
    Fixes #574
    
    Signed-off-by: Owen O'Malley <om...@apache.org>
---
 c++/include/orc/Statistics.hh | 4 ++--
 c++/src/Statistics.hh         | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/c++/include/orc/Statistics.hh b/c++/include/orc/Statistics.hh
index 654956d..1d4b0b6 100644
--- a/c++/include/orc/Statistics.hh
+++ b/c++/include/orc/Statistics.hh
@@ -282,13 +282,13 @@ namespace orc {
      * Get the minimum value for the column.
      * @return minimum value
      */
-    virtual std::string getMinimum() const = 0;
+    virtual const std::string & getMinimum() const = 0;
 
     /**
      * Get the maximum value for the column.
      * @return maximum value
      */
-    virtual std::string getMaximum() const = 0;
+    virtual const std::string & getMaximum() const = 0;
 
     /**
      * Get the total length of all values.
diff --git a/c++/src/Statistics.hh b/c++/src/Statistics.hh
index 0daddfe..633450f 100644
--- a/c++/src/Statistics.hh
+++ b/c++/src/Statistics.hh
@@ -94,7 +94,7 @@ namespace orc {
     // GET / SET _maximum
     bool hasMaximum() const { return _hasMaximum; }
 
-    T getMaximum() const { return _maximum; }
+    const T & getMaximum() const { return _maximum; }
 
     void setHasMaximum(bool hasMax) { _hasMaximum = hasMax; }
 
@@ -105,7 +105,7 @@ namespace orc {
 
     void setHasMinimum(bool hasMin) { _hasMinimum = hasMin; }
 
-    T getMinimum() const { return _minimum; }
+    const T & getMinimum() const { return _minimum; }
 
     void setMinimum(T min) { _minimum = min; }
 
@@ -1077,7 +1077,7 @@ namespace orc {
       _stats.setHasNull(hasNull);
     }
 
-    std::string getMinimum() const override {
+    const std::string & getMinimum() const override {
       if(hasMinimum()){
         return _stats.getMinimum();
       }else{
@@ -1085,7 +1085,7 @@ namespace orc {
       }
     }
 
-    std::string getMaximum() const override {
+    const std::string & getMaximum() const override {
       if(hasMaximum()){
         return _stats.getMaximum();
       }else{