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:

{code}
    @Override
    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);
    }
{code}

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
(v6.4.14#64029)

Reply via email to