[
https://issues.apache.org/jira/browse/DRILL-7495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17005863#comment-17005863
]
ASF GitHub Bot commented on DRILL-7495:
---------------------------------------
cgivre commented on 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:
[email protected]
> Excel Reader Not Parsing Dates Correctly in First Column
> --------------------------------------------------------
>
> Key: DRILL-7495
> URL: https://issues.apache.org/jira/browse/DRILL-7495
> Project: Apache Drill
> Issue Type: Bug
> Affects Versions: 1.17.0
> Reporter: Charles Givre
> Assignee: Charles Givre
> Priority: Minor
> Labels: ready-to-commit
> Fix For: 1.18.0
>
>
> The Excel format plugin is throwing an error if there is a date/time in the
> first column.
> *Workaround*
> Set {{allTextMode}} to true and it will query the data w/o issues.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)