Github user jiang-wu commented on a diff in the pull request:
https://github.com/apache/drill/pull/1184#discussion_r183862162
--- Diff: exec/vector/src/main/codegen/templates/FixedValueVectors.java ---
@@ -509,15 +509,15 @@ public long getTwoAsLong(int index) {
public ${friendlyType} getObject(int index) {
org.joda.time.DateTime date = new org.joda.time.DateTime(get(index),
org.joda.time.DateTimeZone.UTC);
date =
date.withZoneRetainFields(org.joda.time.DateTimeZone.getDefault());
- return date;
+ return new java.sql.Date(date.getMillis());
--- End diff --
As I work through using Local[Date|Time|DateTime] inside the vector
package, I notice that it will create the following inconsistency on the JDBC
output:
SqlAccessor provides "getDate()", "getTime()", and "getTimestamp()" that
are returns java.sql.[Date|Time|Timestamp]. This will convert
Local[Date|Time|DateTime] into java.sql.[Date|Time|Timestamp]
For complex objects, SqlAccessor provides "getObject()" which will return
JsonStringHashMap or JsonStringArrayList. If the Local[Date|Time|DateTime]
objects are inside the map and list, then they will NOT be converted into
java.sql.[Date|Time|Timestamp].
Example:
`select t.context.date, t.context from test t; `
will return a java.sql.Date object for column 1, but a java.time.LocalDate
for the same object inside column 2. This doesn't seem like a good thing.
What should be the right thing to do here? Introduce
SqlAccessor.getLocal[Date|Time|Timestamp] accessors to supplement the existing
get[Date|Time|Timestamp]?
---