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 C5C68200CAF for ; Thu, 22 Jun 2017 20:47:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C4604160BD3; Thu, 22 Jun 2017 18:47:04 +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 128A5160BE7 for ; Thu, 22 Jun 2017 20:47:03 +0200 (CEST) Received: (qmail 19274 invoked by uid 500); 22 Jun 2017 18:47:03 -0000 Mailing-List: contact issues-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list issues@drill.apache.org Received: (qmail 19265 invoked by uid 99); 22 Jun 2017 18:47:03 -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; Thu, 22 Jun 2017 18:47:03 +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 A14BC1A07CE for ; Thu, 22 Jun 2017 18:47:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 4hj6j3ji3hwm for ; Thu, 22 Jun 2017 18:47:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 3973E5F60D for ; Thu, 22 Jun 2017 18:47:01 +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 54363E03EE for ; Thu, 22 Jun 2017 18:47: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 1114221942 for ; Thu, 22 Jun 2017 18:47:00 +0000 (UTC) Date: Thu, 22 Jun 2017 18:47:00 +0000 (UTC) From: "Vitalii Diravka (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (DRILL-5332) DateVector support uses questionable conversions to a time MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 22 Jun 2017 18:47:05 -0000 [ https://issues.apache.org/jira/browse/DRILL-5332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vitalii Diravka reassigned DRILL-5332: -------------------------------------- Assignee: (was: Vitalii Diravka) > DateVector support uses questionable conversions to a time > ---------------------------------------------------------- > > Key: DRILL-5332 > URL: https://issues.apache.org/jira/browse/DRILL-5332 > Project: Apache Drill > Issue Type: Bug > Affects Versions: 1.9.0 > Reporter: Paul Rogers > > The following code in {{DateVector}} is worrisome: > {code} > @Override > public DateTime getObject(int index) { > org.joda.time.DateTime date = new org.joda.time.DateTime(get(index), org.joda.time.DateTimeZone.UTC); > date = date.withZoneRetainFields(org.joda.time.DateTimeZone.getDefault()); > return date; > } > {code} > This code takes a date/time value stored in a value vector, converts it to UTC, then strips the time zone and replaces it with local time. The result it a "timestamp" in Java format (seconds since the epoch), but not really, it really the time since the epoch, as if the epoch had started in the local time zone rather than UTC. > This is the kind of fun & games that people used to do in Java with the {{Date}} type before the advent of Joda time (and the migration of Joda into Java 8.) > It is, in short, very bad practice and nearly impossible to get right. > Further, converting a pure date (since this is a {{DateVector}}) into a date/time is fraught with peril. A date has no corresponding time. 1 AM on Friday in one time zone might be 11 PM on Thursday in another. Converting from dates to times is very difficult. > If the {{DateVector}} corresponds to a date, then it should be simple date with no implied time zone and no implied relationship to time. If there is to be a mapping of time, it must be to a {{LocalTime}} (in Joda and Java 8) that has no implied time zone. > Note that this code directly contradicts the statement in [Drill documentation|http://drill.apache.org/docs/date-time-and-timestamp/]: "Drill stores values in Coordinated Universal Time (UTC)." Actually, even the documentation is questionable: what does it mean to store a date in UTC because of the above issues? -- This message was sent by Atlassian JIRA (v6.4.14#64029)