Check whether this can help:
http://apache-kylin.74782.x6.nabble.com/JDBC-query-result-Date-column-get-wrong-value-td5370.html

2018-02-04 19:29 GMT+08:00 张 佑铖 <edouard...@hotmail.com>:

> Hi kylin team,
>
> Single problem, column with type Date values '2018-02-02' in hive. Query
> in kylin sight is okay return value with '2018-02-02'.
> But when I used jdbc it returns '2018-02-01'.
>
> Apparently it is a problem with timezone.
> 1. Check the configuration first
> kylin.web.timezone=GMT+8
> user.timezone = Asia/Shanghai
> seems no problem
> 2. Check client
> GMT+8
> I also add code "System.setProperty("user.timezone","GMT +08");" to
> enforce  the same timezone with server
> 3. Follow the code
> after request query, I check the content of response, still '2018-02-02'
> after convert resultset, value is still '2018-02-02'
> and finally rs.getDate("")
>
> public Date getDate(Calendar calendar) throws SQLException {
>     Date date = (Date)this.getObject();
>     if (date == null) {
>         return null;
>     } else {
>         if (calendar != null) {
>             long v = date.getTime();
>             v -= (long)calendar.getTimeZone().getOffset(v);
>             date = new Date(v);
>         }
>
>         return date;
>     }
> }
>
> localCalendar of cource with timezone GMT+8, so after the calculation of
> offset  '2018-02-02' turn out to be '2018-02-01'
>
> So I am confused, according to the above if I set locale to UTC I will get
> the right value, but it is unreasonable.
>
> Is there any configuration  or some params for jdbc url I missed?
>
> One thing should be mentioned, server of kylin was set UTC before, I
> changed locale to Asia/Shanghai and restart kylin, refresh the cube. I
> don't know if that has impact?
>
>
> Thank you
>
>
>
>
>


-- 
Best regards,

Shaofeng Shi 史少锋

Reply via email to