drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-5689) IntervalDay data type returns a non-normalized Period object
Date Wed, 26 Jul 2017 01:48:00 GMT
Paul Rogers created DRILL-5689:

             Summary: IntervalDay data type returns a non-normalized Period object
                 Key: DRILL-5689
                 URL: https://issues.apache.org/jira/browse/DRILL-5689
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.10.0
            Reporter: Paul Rogers
            Priority: Minor

Set an IntervalDay column using a {{Period}} object of the form P3DT4H5M23S.

Retrieve the data using {{getObject()}}, which returns a {{Period}}. However, the object is
not normalized; it comes back as P3DT14723S.

The problem is how we create the object:

    public Period getObject(int index) {
      final int offsetIndex = index * VALUE_WIDTH;
      final int millis = data.getInt(offsetIndex + 4);
      final int  days   = data.getInt(offsetIndex);
      final Period p = new Period();
      return p.plusDays(days).plusMillis(millis);

The workaround is to call {{normalizedStandard()}} to the returned value. Instead, this method
should be called before returning the result.

This message was sent by Atlassian JIRA

View raw message