cgivre commented on a change in pull request #1941: DRILL-7495: Excel Reader 
Not Parsing Dates Correctly in First Column
URL: https://github.com/apache/drill/pull/1941#discussion_r362129794
 
 

 ##########
 File path: 
contrib/format-excel/src/main/java/org/apache/drill/exec/store/excel/ExcelBatchReader.java
 ##########
 @@ -519,7 +519,10 @@ public void load(Cell cell) {
       if (cellValue == null) {
         columnWriter.setNull();
       } else {
-        Instant timeStamp = new Instant(cellValue.getNumberValue());
+        logger.debug("Cell value: {}", cellValue.getNumberValue());
+
+        Date dt = DateUtil.getJavaDate(cellValue.getNumberValue());
 
 Review comment:
   That was actually the source of the bug.  I didn't realize it when I wrote 
the plugin but as it turns out, Excel generates all kinds of weird 
representations of dates.  Specifically in the case dates (no time) it 
generates a `double` and when it has a time, it generates a `long`.  Using the 
`DateUtil` class that is part of the POI library solves this problem and gets 
consistent dates out of Excel.

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


With regards,
Apache Git Services

Reply via email to