Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2A5E8200C3C for ; Mon, 3 Apr 2017 11:09:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2595C160BA6; Mon, 3 Apr 2017 09:09:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 41235160B8F for ; Mon, 3 Apr 2017 11:09:04 +0200 (CEST) Received: (qmail 78023 invoked by uid 500); 3 Apr 2017 09:08:57 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 76773 invoked by uid 99); 3 Apr 2017 09:08:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Apr 2017 09:08:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 3A8EE1A7A41 for ; Mon, 3 Apr 2017 09:08:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Q0VoKxEcOd5Q for ; Mon, 3 Apr 2017 09:08:44 +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 C22F15FC83 for ; Mon, 3 Apr 2017 09:08:42 +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 32776E0B21 for ; Mon, 3 Apr 2017 09:08:42 +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 A4C6F2401B for ; Mon, 3 Apr 2017 09:08:41 +0000 (UTC) Date: Mon, 3 Apr 2017 09:08:41 +0000 (UTC) From: "Sean Owen (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (SPARK-20166) Use XXX for ISO timezone instead of ZZ which is FastDateFormat specific in CSV/JSON time related options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 03 Apr 2017 09:09:06 -0000 [ https://issues.apache.org/jira/browse/SPARK-20166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Owen reassigned SPARK-20166: --------------------------------- Assignee: Hyukjin Kwon Priority: Minor (was: Trivial) > Use XXX for ISO timezone instead of ZZ which is FastDateFormat specific in CSV/JSON time related options > -------------------------------------------------------------------------------------------------------- > > Key: SPARK-20166 > URL: https://issues.apache.org/jira/browse/SPARK-20166 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 2.2.0 > Reporter: Hyukjin Kwon > Assignee: Hyukjin Kwon > Priority: Minor > Fix For: 2.2.0 > > > We can use {{XXX}} format instead of {{ZZ}}. {{ZZ}} seems a {{FastDateFormat}} specific Please see https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#iso8601timezone and https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/FastDateFormat.html > {{ZZ}} supports "ISO 8601 extended format time zones" but it seems {{FastDateFormat}} specific option. > It seems we better replace {{ZZ}} to {{XXX}} because they look use the same strategy - https://github.com/apache/commons-lang/blob/8767cd4f1a6af07093c1e6c422dae8e574be7e5e/src/main/java/org/apache/commons/lang3/time/FastDateParser.java#L930. > I also checked the codes and manually debugged it for sure. It seems both cases use the same pattern {code}( Z|(?:[+-]\\d{2}(?::)\\d{2})) {code}. > Note that this is a fix about documentation not the behaviour change because {{ZZ}} seems invalid date format in {{SimpleDateFormat}} as documented in {{DataFrameReader}}: > {quote} > *
  • `timestampFormat` (default `yyyy-MM-dd'T'HH:mm:ss.SSSZZ`): sets the string that > * indicates a timestamp format. Custom date formats follow the formats at > * `java.text.SimpleDateFormat`. This applies to timestamp type.
  • > {quote} > {code} > scala> new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse("2017-03-21T00:00:00.000-11:00") > res4: java.util.Date = Tue Mar 21 20:00:00 KST 2017 > scala> new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse("2017-03-21T00:00:00.000Z") > res10: java.util.Date = Tue Mar 21 09:00:00 KST 2017 > scala> new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZ").parse("2017-03-21T00:00:00.000-11:00") > java.text.ParseException: Unparseable date: "2017-03-21T00:00:00.000-11:00" > at java.text.DateFormat.parse(DateFormat.java:366) > ... 48 elided > scala> new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZ").parse("2017-03-21T00:00:00.000Z") > java.text.ParseException: Unparseable date: "2017-03-21T00:00:00.000Z" > at java.text.DateFormat.parse(DateFormat.java:366) > ... 48 elided > {code} > {code} > scala> org.apache.commons.lang3.time.FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse("2017-03-21T00:00:00.000-11:00") > res7: java.util.Date = Tue Mar 21 20:00:00 KST 2017 > scala> org.apache.commons.lang3.time.FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse("2017-03-21T00:00:00.000Z") > res1: java.util.Date = Tue Mar 21 09:00:00 KST 2017 > scala> org.apache.commons.lang3.time.FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZZ").parse("2017-03-21T00:00:00.000-11:00") > res8: java.util.Date = Tue Mar 21 20:00:00 KST 2017 > scala> org.apache.commons.lang3.time.FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZZ").parse("2017-03-21T00:00:00.000Z") > res2: java.util.Date = Tue Mar 21 09:00:00 KST 2017 > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org