kylin查询出现日期对应不上的情况
2016-07-01 11:51
656 查看
情况:
查询的是2016年1月2日的数据,但返回解析出来的数据确实是2号的,可是时间竟然变成了2016年1月1日。
解决:
是时区问题,修改本地时区
具体代码,主要是看加红加粗的:
查询的是2016年1月2日的数据,但返回解析出来的数据确实是2号的,可是时间竟然变成了2016年1月1日。
解决:
是时区问题,修改本地时区
具体代码,主要是看加红加粗的:
public static void QueryTest() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { System.setProperty("user.timezone","GMT +08"); Driver driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver") .newInstance(); Properties info = new Properties(); info.put("user", "ADMIN"); info.put("password", "KYLIN"); info.put("useLegacyDatetimeCode", "false"); Connection conn = driver.connect( "jdbc:kylin://192.168.22.102:7070/DataPlat", info); Statement state = conn.createStatement(); ResultSet resultSet = state .executeQuery("select cppadate,count(1) from KPI_BASE_DATACPPAFOLLOWCRCCOUNT where cppadate>='2016-01-12' and cppadate<='2016-01-12' group by cppadate"); while (resultSet.next()) { System.out.println(resultSet.getDate(1) + "__" + resultSet.getInt(2) ); } }
相关文章推荐
- 分组统计查询
- Android开发笔记(一百零九)利用网盘实现云存储
- nginx限制请求数ngx_http_limit_req_module模块
- 前端面试大全
- 采用多线程方式,解决由于查询等待造成winfrom假死问题
- UIScrollViewDelegate详解
- OAUTH协议简介
- 手机网游客户端框架搭建
- RecycleView的使用(一)
- 让计算机自动加入指定的某个OU
- LLVM 3.0中的寄存器贪婪分配
- 【bzoj2324】【ZJOI2011】【营救皮卡丘】【有上下界的费用流+Floyd】
- 2015业界良心迷你开发板大盘点
- 2015业界良心迷你开发板大盘点
- FTP配置参数
- Http响应的状态码的类别
- intellij idea自动生成serialVersionUID
- CSS :hover 伪类
- hive & hue 中文乱码的问题
- laravel发送邮件