You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "liyang (JIRA)" <ji...@apache.org> on 2016/07/05 09:07:11 UTC
[jira] [Resolved] (KYLIN-1817) No result from JDBC with Date filter
in prepareStatement
[ https://issues.apache.org/jira/browse/KYLIN-1817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
liyang resolved KYLIN-1817.
---------------------------
Resolution: Fixed
Fix Version/s: v1.5.3
> No result from JDBC with Date filter in prepareStatement
> --------------------------------------------------------
>
> Key: KYLIN-1817
> URL: https://issues.apache.org/jira/browse/KYLIN-1817
> Project: Kylin
> Issue Type: Bug
> Components: Driver - JDBC
> Reporter: Dong Li
> Assignee: Yiming Liu
> Priority: Minor
> Labels: newbie
> Fix For: v1.5.3
>
> Attachments: KYLIN-1817.patch
>
>
> From Qiu Tongxin:
> 大家好:
> 用kylin的JDBC查询,查询条件是date类型的,但是查询不出数据,以下是代码:
> driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
>
> Properties info = new Properties();
> info.put("user", "ADMIN");
> info.put("password", "KYLIN");
>
> conn = driver.connect("jdbc:kylin://IP:7070/learn_kylin", info); (此处IP代替了真实IP地址)
> state = conn.prepareStatement("select * from KYLIN_SALES where part_dt = ?");
>
> SimpleDateFormat simpleTime = new SimpleDateFormat("yyyy-MM-dd");
> java.util.Date passUtilDate = simpleTime.parse("2013-01-01");
> java.sql.Date passSqlDate = new java.sql.Date(passUtilDate.getTime());
>
> System.out.println("passSqlDate-------->"+passSqlDate);
>
> state.setDate(1, passSqlDate);
>
> resultSet = state.executeQuery();
>
>
> 控制台日志为:
> passSqlDate-------->2013-01-01
> 2016-06-23 14:19:52,591 DEBUG [main] jdbc.KylinClient:341 : Post body:
> {"sql":"select * from KYLIN_SALES where part_dt = ?","project":"learn_kylin","acceptPartial":false,"params":[{"className":"java.lang.Integer","value":"15706"}]}
> 2016-06-23 14:19:52,592 DEBUG [main] wire.content:84 : << "{"userDetails":{"password":null,"username":"ADMIN","authorities":[{"authority":"ROLE_ADMIN"},{"authority":"ROLE_ANALYST"},{"authority":"ROLE_MODELER"}],"accountNonExpired":true,"accountNonLocked":true,"credentialsNonExpired":true,"enabled":true}}"
>
> 为什么kylin把传进的参数转为了"params":[{"className":"java.lang.Integer","value":"15706"}]???
> From Bhanu Mohanty:
> Issues with Kylin PreparedStatement
> Data Type : Date
> // From Date
> PreparedStatement.setDate(1, java.sql.Date.valueOf("2016-01-01"));
> // To Date
> PreparedStatement.setDate(2, java.sql.Date.valueOf("2016-06-01"));
> Kylin Debug Statement - Post body:
> {"sql":"************","project":"*******","acceptPartial":false,"params":[{"className":"java.lang.Integer","value":"16801"},{"className":"java.lang.Integer","value":"16953"}]}
> No data is returned.
> If I pass the date part of the Query String , then it returns data.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)