You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by zhongyuhai <19...@qq.com> on 2017/04/05 14:24:42 UTC

请教关于KYLIN JDBC中对于Date维度的PreparedStatement问题

你好:

    代码如下

Driver driver = (Driver)
Class.forName("org.apache.kylin.jdbc.Driver").newInstance();

        Properties p = new Properties();
        p.put("user" , "ADMIN");
        p.put("password" , "KYLIN");
        //控制查询结果的显示。
        p.put("timeZone", "UTC");

        Connection c = driver.connect(
                "jdbc:kylin://spark1:7070/learn_kylin",
                p
        );

        PreparedStatement ps = c.prepareStatement(
                "SELECT part_dt , sum(price) FROM KYLIN_SALES where part_dt
= ? group by part_dt"
        );

        Date d = new Date(112,0,12);
        java.sql.Date dd = new java.sql.Date(d.getTime());

        ps.setDate(1,dd);

        ResultSet rs = ps.executeQuery();

    后台LOG如下,没有显示有查询结果

Query Id: 01a75351-73eb-41eb-94c5-9845d5f83a01
SQL: SELECT part_dt , sum(price) FROM KYLIN_SALES where part_dt = ? group by
part_dt
User: ADMIN
Success: true
Duration: 0.125
Project: learn_kylin
Realization Names: [kylin_sales_cube]
Cuboid Ids: [16384]
Total scan count: 0
Total scan bytes: 0
Result row count: 0
Accept Partial: false
Is Partial Result: false
Hit Exception Cache: false
Storage cache used: false
Message: null

      但通过INSIGHT查询是有相关结果。
<http://apache-kylin.74782.x6.nabble.com/file/n7592/INSIGHT.jpg> 



     请问该如何解决?

     谢谢!




--
View this message in context: http://apache-kylin.74782.x6.nabble.com/KYLIN-JDBC-Date-PreparedStatement-tp7592.html
Sent from the Apache Kylin mailing list archive at Nabble.com.

Re: 请教关于KYLIN JDBC中对于Date维度的PreparedStatement问题

Posted by Billy Liu <bi...@apache.org>.
consider this thread first:
http://apache-kylin.74782.x6.nabble.com/JDBC-query-result-Date-column-get-wrong-value-td5370.html


2017-04-05 22:24 GMT+08:00 zhongyuhai <19...@qq.com>:

> 你好:
>
>     代码如下
>
> Driver driver = (Driver)
> Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
>
>         Properties p = new Properties();
>         p.put("user" , "ADMIN");
>         p.put("password" , "KYLIN");
>         //控制查询结果的显示。
>         p.put("timeZone", "UTC");
>
>         Connection c = driver.connect(
>                 "jdbc:kylin://spark1:7070/learn_kylin",
>                 p
>         );
>
>         PreparedStatement ps = c.prepareStatement(
>                 "SELECT part_dt , sum(price) FROM KYLIN_SALES where part_dt
> = ? group by part_dt"
>         );
>
>         Date d = new Date(112,0,12);
>         java.sql.Date dd = new java.sql.Date(d.getTime());
>
>         ps.setDate(1,dd);
>
>         ResultSet rs = ps.executeQuery();
>
>     后台LOG如下,没有显示有查询结果
>
> Query Id: 01a75351-73eb-41eb-94c5-9845d5f83a01
> SQL: SELECT part_dt , sum(price) FROM KYLIN_SALES where part_dt = ? group
> by
> part_dt
> User: ADMIN
> Success: true
> Duration: 0.125
> Project: learn_kylin
> Realization Names: [kylin_sales_cube]
> Cuboid Ids: [16384]
> Total scan count: 0
> Total scan bytes: 0
> Result row count: 0
> Accept Partial: false
> Is Partial Result: false
> Hit Exception Cache: false
> Storage cache used: false
> Message: null
>
>       但通过INSIGHT查询是有相关结果。
> <http://apache-kylin.74782.x6.nabble.com/file/n7592/INSIGHT.jpg>
>
>
>
>      请问该如何解决?
>
>      谢谢!
>
>
>
>
> --
> View this message in context: http://apache-kylin.74782.x6.
> nabble.com/KYLIN-JDBC-Date-PreparedStatement-tp7592.html
> Sent from the Apache Kylin mailing list archive at Nabble.com.
>