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 0AF45200CAC for ; Mon, 5 Jun 2017 02:56:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 09BC1160BE3; Mon, 5 Jun 2017 00:56:11 +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 50237160BE0 for ; Mon, 5 Jun 2017 02:56:10 +0200 (CEST) Received: (qmail 23729 invoked by uid 500); 5 Jun 2017 00:56:09 -0000 Mailing-List: contact dev-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 dev@drill.apache.org Received: (qmail 23718 invoked by uid 99); 5 Jun 2017 00:56:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2017 00:56:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id ECF45C0096 for ; Mon, 5 Jun 2017 00:56:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-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 (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id qJSfYROiKFwA for ; Mon, 5 Jun 2017 00:56:07 +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 60E695F2A9 for ; Mon, 5 Jun 2017 00:56:06 +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 78595E06C6 for ; Mon, 5 Jun 2017 00:56:05 +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 9B0EF2193A for ; Mon, 5 Jun 2017 00:56:04 +0000 (UTC) Date: Mon, 5 Jun 2017 00:56:04 +0000 (UTC) From: "Paul Rogers (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (DRILL-5562) Vector types IntervalYear, IntervalDay and Interval are of the wrong width MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 05 Jun 2017 00:56:11 -0000 Paul Rogers created DRILL-5562: ---------------------------------- Summary: Vector types IntervalYear, IntervalDay and Interval are of the wrong width Key: DRILL-5562 URL: https://issues.apache.org/jira/browse/DRILL-5562 Project: Apache Drill Issue Type: Bug Affects Versions: 1.8.0 Reporter: Paul Rogers Drill provides three interval types, described in `ValueVectorTypes.tdd`: * `IntervalYear`: a duration in months (sic) * `IntervalDay`: a duration in days and ms. * `Interval`: a duration in months, days and ms. The file defines the width of each "field" (ms, days, months) as an int: 4 bytes. But, the total vector width is wrong: * `IntervalYear`: 8 bytes (should be 4: for months) * `IntervalDay`: 12 bytes (should be 8: for days and ms.) * `Interval`: 16 bytes (should be 12: for months, days and ms.) It could be that the extra 4 bytes is supposed to be for a time zone. But, time zones don't apply to intervals: an hour is the same duration everywhere on earth. Since an interval does not contain a point in time, a time-zone is not useful even for daylight savings time adjustments. The code for each type reflects the "missing" 4 bytes. For example, for the 12-byte `IntervalDay` vector: {code} public void set(int index, int days, int milliseconds) { final int offsetIndex = index * VALUE_WIDTH; data.setInt(offsetIndex, days); data.setInt((offsetIndex + 4), milliseconds); } {code} Note also that the Drill IntervalDay need not be two fields wide. Except on a leap second, a day has a fixed number of milliseconds. And, the only way to compensate for a leap second is to know a point in time, which the interval does not have. Even if measured across a leap second, an interval of a minute is always 60 seconds. It is only when doing: {code} end date/time = start date/time + interval {code} is the leap second even needed. Although the ISO format expresses intervals as a tuple of (year, month, day, hour, minute, second), the same value can be expressed as (months, ms) (with the proper conversions), so Drill's interval types need only be 4 and 8 bytes wide. -- This message was sent by Atlassian JIRA (v6.3.15#6346)