orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From majetideepak <...@git.apache.org>
Subject [GitHub] orc pull request #113: ORC-176: Refactor common classes for writer and reade...
Date Thu, 27 Apr 2017 19:56:43 GMT
Github user majetideepak commented on a diff in the pull request:

    https://github.com/apache/orc/pull/113#discussion_r113784951
  
    --- Diff: c++/include/orc/Statistics.hh ---
    @@ -37,12 +37,76 @@ namespace orc {
          * of rows because of NULL values and repeated values.
          * @return the number of values
          */
    -    virtual uint64_t getNumberOfValues() const = 0;
    +    virtual uint64_t getNumberOfValues() const {
    +      return valueCount;
    +    }
    +
    +    /**
    +     * Set the number of values in this column
    +     * @param newValueCount new number of values to be set
    +     */
    +    virtual void setNumberOfValues(uint64_t newValueCount) {
    +      valueCount = newValueCount;
    +    }
    +
    +    /**
    +     * Check whether column has null value
    +     * @return true if has null value
    +     */
    +    virtual bool hasNull() const {
    +      return hasNullValue;
    +    }
    +
    +    /**
    +     * Set whether column has null value
    +     * @param newHasNull has null value
    +     */
    +    virtual void setHasNull(bool newHasNull) {
    +      hasNullValue = newHasNull;
    +    }
     
         /**
          * print out statistics of column if any
          */
         virtual std::string toString() const = 0;
    +
    +    /**
    +     * Increases count of values
    +     * @param count number of values to be increased
    +     */
    +    virtual void increase(uint64_t count) {
    +      valueCount += count;
    +    }
    +
    +    /**
    +     * reset column statistics to initial state
    +     */
    +    virtual void reset() {
    +      hasNullValue = false;
    +      valueCount = 0;
    +    }
    +
    +    /**
    +     * Merges another statistics
    +     * @param other statistics to be merged
    +     */
    +    virtual void merge(const ColumnStatistics& other) {
    +      hasNullValue |= other.hasNull();
    +      valueCount += other.getNumberOfValues();
    +    }
    +
    +    /**
    +     * Convert statistics to protobuf version
    +     * @param pbStats output of protobuf stats
    +     */
    +    virtual void toProtoBuf(proto::ColumnStatistics& pbStats) const {
    +      pbStats.set_hasnull(hasNullValue);
    +      pbStats.set_numberofvalues(valueCount);
    +    }
    +
    +  protected:
    +    uint64_t valueCount;
    --- End diff --
    
    The class members should belong to the Impl class in  `c++/include/orc/Statistics.hh`
as well.
    What is the reason behind moving them here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message