From dev-return-54787-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Mon Dec 10 13:57:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B4830180627 for ; Mon, 10 Dec 2018 13:57:03 +0100 (CET) Received: (qmail 24658 invoked by uid 500); 10 Dec 2018 12:57:02 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 24646 invoked by uid 99); 10 Dec 2018 12:57:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Dec 2018 12:57:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 6CFE5CF19F for ; Mon, 10 Dec 2018 12:57:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id tGRQT-inEd4r for ; Mon, 10 Dec 2018 12:57:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id EB18560CE0 for ; Mon, 10 Dec 2018 12:57:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6FED8E02F1 for ; Mon, 10 Dec 2018 12:57:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 20379252EA for ; Mon, 10 Dec 2018 12:57:00 +0000 (UTC) Date: Mon, 10 Dec 2018 12:57:00 +0000 (UTC) From: "Jaanai (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (PHOENIX-5066) The TimeZone is incorrectly used during writing or reading data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-5066?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jaanai updated PHOENIX-5066: ---------------------------- Attachment: DateTest.java > The TimeZone is incorrectly used during writing or reading data > --------------------------------------------------------------- > > Key: PHOENIX-5066 > URL: https://issues.apache.org/jira/browse/PHOENIX-5066 > Project: Phoenix > Issue Type: Bug > Affects Versions: 5.0.0, 4.14.1 > Reporter: Jaanai > Assignee: Jaanai > Priority: Critical > Fix For: 4.15.0, 5.1 > > Attachments: DateTest.java > > > We have two methods to write data when uses JDBC API. > #1. Uses=C2=A0_the exceuteUpdate_=C2=A0method to execute a string that is= an upsert=C2=A0SQL. > #2. Uses the=C2=A0_prepareStatement_ method to set some object and execut= e. > The _string_ data needs to convert to a new object by the schema informat= ion of tables. we'll use some date formatters=C2=A0to convert string data t= o object for Date/Time/Timestamp types when writes data and the formatters= =C2=A0are used when reads data as well. > =C2=A0=C2=A0 > *Uses default timezone test* > =C2=A0Writing 3 records by=C2=A0the different ways. > {code:java} > UPSERT INTO date_test VALUES (1,'2018-12-10 15:40:47','2018-12-10 15:40:4= 7','2018-12-10 15:40:47')=20 > UPSERT INTO date_test VALUES (2,to_date('2018-12-10 15:40:47'),to_time('2= 018-12-10 15:40:47'),to_timestamp('2018-12-10 15:40:47')) > stmt.setInt(1, 3);stmt.setDate(2, date);stmt.setTime(3, time);stmt.setTim= estamp(4, ts); > {code} > Reading the table by the getObject(getDate/getTime/getTimestamp) methods. > {code:java} > 1 | 2018-12-10 | 23:45:07 | 2018-12-10 23:45:07.0=20 > 2 | 2018-12-10 | 23:45:07 | 2018-12-10 23:45:07.0=20 > 3 | 2018-12-10 | 15:45:07 | 2018-12-10 15:45:07.66=20 > {code} > Reading the table by the getString methods=C2=A0 > {code:java} > 1 | 2018-12-10 15:45:07.000 | 2018-12-10 15:45:07.000 | 2018-12-10 15:45:= 07.000=20 > 2 | 2018-12-10 15:45:07.000 | 2018-12-10 15:45:07.000 | 2018-12-10 15:45:= 07.000=20 > 3 | 2018-12-10 07:45:07.660 | 2018-12-10 07:45:07.660 | 2018-12-10 07:45:= 07.660 > {code} > =C2=A0 > =C2=A0*Uses GMT+8 test* > =C2=A0Writing 3 records by=C2=A0the different ways. > {code:java} > UPSERT INTO date_test VALUES (1,'2018-12-10 15:40:47','2018-12-10 15:40:4= 7','2018-12-10 15:40:47') > UPSERT INTO date_test VALUES (2,to_date('2018-12-10 15:40:47'),to_time('2= 018-12-10 15:40:47'),to_timestamp('2018-12-10 15:40:47')) > stmt.setInt(1, 3);stmt.setDate(2, date);stmt.setTime(3, time);stmt.setTim= estamp(4, ts); > {code} > Reading the table by the getObject(getDate/getTime/getTimestamp) methods. > {code:java} > 1 | 2018-12-10 | 23:40:47 | 2018-12-10 23:40:47.0=20 > 2 | 2018-12-10 | 15:40:47 | 2018-12-10 15:40:47.0=20 > 3 | 2018-12-10 | 15:40:47 | 2018-12-10 15:40:47.106 {code} > Reading the table by the getString methods > {code:java} > =C2=A01 | 2018-12-10 23:40:47.000 | 2018-12-10 23:40:47.000 | 2018-12-10 = 23:40:47.000 > 2 | 2018-12-10 15:40:47.000 | 2018-12-10 15:40:47.000 | 2018-12-10 15:40:= 47.000 > 3 | 2018-12-10 15:40:47.106 | 2018-12-10 15:40:47.106 | 2018-12-10 15:40:= 47.106 > {code} > =C2=A0 > _We_ have=C2=A0a historical problem,=C2=A0 we'll parse the string to Date= /Time/Timestamp objects with timezone in #1, which means the actual=C2=A0da= ta is going to be changed when stored in HBase table=E3=80=82 -- This message was sent by Atlassian JIRA (v7.6.3#76005)