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 #110: ORC-87: [C++] Handle missing timezone conversion for ...
Date Tue, 02 May 2017 15:45:00 GMT
Github user majetideepak commented on a diff in the pull request:

    https://github.com/apache/orc/pull/110#discussion_r114351170
  
    --- Diff: c++/src/Statistics.cc ---
    @@ -279,20 +277,55 @@ namespace orc {
       }
     
       TimestampColumnStatisticsImpl::TimestampColumnStatisticsImpl
    -  (const proto::ColumnStatistics& pb, bool correctStats) {
    +  (const proto::ColumnStatistics& pb, const StatContext& statContext) {
         valueCount = pb.numberofvalues();
    -    if (!pb.has_timestampstatistics() || !correctStats) {
    +    if (!pb.has_timestampstatistics() || !statContext.correctStats) {
           _hasMinimum = false;
           _hasMaximum = false;
    +      _hasLowerBound = false;
    +      _hasUpperBound = false;
           minimum = 0;
           maximum = 0;
    +      lowerBound = 0;
    +      upperBound = 0;
         }else{
           const proto::TimestampStatistics& stats = pb.timestampstatistics();
    -      _hasMinimum = stats.has_minimum();
    -      _hasMaximum = stats.has_maximum();
    -
    -      minimum = stats.minimum();
    -      maximum = stats.maximum();
    +      _hasMinimum = stats.has_minimumutc() || (stats.has_minimum() && (statContext.writerTimezone
!= NULL));
    +      _hasMaximum = stats.has_maximumutc() || (stats.has_maximum() && (statContext.writerTimezone
!= NULL));
    +      _hasLowerBound = stats.has_minimumutc() || stats.has_minimum();
    +      _hasUpperBound = stats.has_maximumutc() || stats.has_maximum();
    +
    +      // Timestamp stats are stored in milliseconds
    +      if (stats.has_minimumutc()) {
    +        minimum = stats.minimumutc();
    +        lowerBound = minimum;
    +      } else if (statContext.writerTimezone) {
    +        int64_t writerTimeSec = stats.minimum() / 1000;
    +        // multiply the offset by 1000 to convert to millisecond
    +        minimum = stats.minimum() + (statContext.writerTimezone->getVariant(writerTimeSec).gmtOffset)
* 1000;
    +        lowerBound = minimum;
    +      } else {
    +        minimum = 0;
    +        // subtract 1 day 1 hour (25 hours) in milliseconds to handle unknown TZ and
daylight savings
    --- End diff --
    
    @omalley Note the change here to 25 hours. The additional 1 hour is to account for daylight
savings.


---
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