Kylin query occurrence date does not correspond to the situation

Source: Internet
Author: User

Case

The data that was queried was January 2, 2016, but the data that was parsed was really number 2nd, but the time turned out to be January 1, 2016.

Solve:

is the time zone problem, modify the local time zone

The specific code, mainly look at the red plus bold:

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));}}

  

Kylin query occurrence date does not correspond to the situation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.