[ 
https://issues.apache.org/jira/browse/DRILL-6242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16461411#comment-16461411
 ] 

ASF GitHub Bot commented on DRILL-6242:
---------------------------------------

vdiravka commented on a change in pull request #1247: DRILL-6242 Use 
java.time.Local{Date|Time|DateTime} for Drill Date, Time, and Timestamp types
URL: https://github.com/apache/drill/pull/1247#discussion_r185585799
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/VectorOutput.java
 ##########
 @@ -242,8 +247,9 @@ public void writeTimestamp(boolean isNull) throws 
IOException {
           ts.writeTimeStamp(dt.getMillis());
 
 Review comment:
   I run regression tests for your branch and found one test failure:
   
https://github.com/mapr/drill-test-framework/blob/master/framework/resources/Datasources/complex/json/extended.json#L1
   
   The stack trace is the following:
   `java.time.format.DateTimeParseException) Text 
'2015-03-12T21:54:31.809+0530' could not be parsed at index 23
       java.time.format.DateTimeFormatter.parseResolved0():1949
       java.time.format.DateTimeFormatter.parse():1851
       java.time.OffsetDateTime.parse():402
       
org.apache.drill.exec.vector.complex.fn.VectorOutput$MapVectorOutput.writeTimestamp():356
       org.apache.drill.exec.vector.complex.fn.VectorOutput.innerRun():112
       
org.apache.drill.exec.vector.complex.fn.VectorOutput$MapVectorOutput.run():301
       
org.apache.drill.exec.vector.complex.fn.JsonReader.writeMapDataIfTyped():505
       org.apache.drill.exec.vector.complex.fn.JsonReader.writeData():385
       org.apache.drill.exec.vector.complex.fn.JsonReader.writeDataSwitch():316
       org.apache.drill.exec.vector.complex.fn.JsonReader.writeToVector():257
       org.apache.drill.exec.vector.complex.fn.JsonReader.write():212
       org.apache.drill.exec.store.easy.json.JSONRecordReader.next():214
       org.apache.drill.exec.physical.impl.ScanBatch.next():172......`
   
   I suppose you should change `DateTime` everywhere in this class (at least in 
writeTimestamp() method) to solve this issue.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Output format for nested date, time, timestamp values in an object hierarchy
> ----------------------------------------------------------------------------
>
>                 Key: DRILL-6242
>                 URL: https://issues.apache.org/jira/browse/DRILL-6242
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Data Types
>    Affects Versions: 1.12.0
>            Reporter: Jiang Wu
>            Assignee: Jiang Wu
>            Priority: Major
>             Fix For: 1.14.0
>
>
> Some storages (mapr db, mongo db, etc.) have hierarchical objects that 
> contain nested fields of date, time, timestamp types.  When a query returns 
> these objects, the output format for the nested date, time, timestamp, are 
> showing the internal object (org.joda.time.DateTime), rather than the logical 
> data value.
> For example.  Suppose in MongoDB, we have a single object that looks like 
> this:
> {code:java}
> > db.test.findOne();
> {
>     "_id" : ObjectId("5aa8487d470dd39a635a12f5"),
>     "name" : "orange",
>     "context" : {
>         "date" : ISODate("2018-03-13T21:52:54.940Z"),
>         "user" : "jack"
>     }
> }
> {code}
> Then connect Drill to the above MongoDB storage, and run the following query 
> within Drill:
> {code:java}
> > select t.context.`date`, t.context from test t; 
> +--------+---------+ 
> | EXPR$0 | context | 
> +--------+---------+ 
> | 2018-03-13 | 
> {"date":{"dayOfYear":72,"year":2018,"dayOfMonth":13,"dayOfWeek":2,"era":1,"millisOfDay":78774940,"weekOfWeekyear":11,"weekyear":2018,"monthOfYear":3,"yearOfEra":2018,"yearOfCentury":18,"centuryOfEra":20,"millisOfSecond":940,"secondOfMinute":54,"secondOfDay":78774,"minuteOfHour":52,"minuteOfDay":1312,"hourOfDay":21,"zone":{"fixed":true,"id":"UTC"},"millis":1520977974940,"chronology":{"zone":{"fixed":true,"id":"UTC"}},"afterNow":false,"beforeNow":true,"equalNow":false},"user":"jack"}
>  |
> {code}
> We can see that from the above output, when the date field is retrieved as a 
> top level column, Drill outputs a logical date value.  But when the same 
> field is within an object hierarchy, Drill outputs the internal object used 
> to hold the date value.
> The expected output is the same display for whether the date field is shown 
> as a top level column or when it is within an object hierarchy:
> {code:java}
> > select t.context.`date`, t.context from test t; 
> +--------+---------+ 
> | EXPR$0 | context | 
> +--------+---------+ 
> | 2018-03-13 | {"date":"2018-03-13","user":"jack"} |
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to