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 EDEAA200CAC for ; Mon, 5 Jun 2017 02:57:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id ECBF5160BE3; Mon, 5 Jun 2017 00:57:10 +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 153AE160BE0 for ; Mon, 5 Jun 2017 02:57:09 +0200 (CEST) Received: (qmail 24718 invoked by uid 500); 5 Jun 2017 00:57:08 -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 24708 invoked by uid 99); 5 Jun 2017 00:57:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2017 00:57:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A9D6F1804F7 for ; Mon, 5 Jun 2017 00:57:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-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-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id JrCnIb74nnxy for ; Mon, 5 Jun 2017 00:57:06 +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 52AA75F2A9 for ; Mon, 5 Jun 2017 00:57:05 +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 6EE34E02F7 for ; Mon, 5 Jun 2017 00:57:04 +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 2A14B2193A for ; Mon, 5 Jun 2017 00:57:04 +0000 (UTC) Date: Mon, 5 Jun 2017 00:57:04 +0000 (UTC) From: "Paul Rogers (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (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:57:11 -0000 [ https://issues.apache.org/jira/browse/DRILL-5562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul Rogers updated DRILL-5562: ------------------------------- Description: 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. was: 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. > 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)