Return-Path: X-Original-To: apmail-drill-issues-archive@minotaur.apache.org Delivered-To: apmail-drill-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1C1F318A9B for ; Thu, 8 Oct 2015 22:19:36 +0000 (UTC) Received: (qmail 29588 invoked by uid 500); 8 Oct 2015 22:19:26 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 29558 invoked by uid 500); 8 Oct 2015 22:19:26 -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 29545 invoked by uid 99); 8 Oct 2015 22:19:26 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2015 22:19:26 +0000 Date: Thu, 8 Oct 2015 22:19:26 +0000 (UTC) From: "Victoria Markman (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-2355) TRUNC function returns incorrect result when second parameter is specified MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Victoria Markman updated DRILL-2355: ------------------------------------ Priority: Critical (was: Minor) > TRUNC function returns incorrect result when second parameter is specified > -------------------------------------------------------------------------- > > Key: DRILL-2355 > URL: https://issues.apache.org/jira/browse/DRILL-2355 > Project: Apache Drill > Issue Type: Bug > Components: Functions - Drill > Affects Versions: 0.8.0 > Reporter: Victoria Markman > Priority: Critical > Labels: document_if_not_fixed > Fix For: Future > > > I believe our TRUNC function is modeled on Postgres TRUNC function. > Semandics of Postgres TRUNC function: > {code} > postgres=# select trunc(1234.1234); > trunc > ------- > 1234 > (1 row) > postgres=# select trunc(1234.1234, 0); > trunc > ------- > 1234 > (1 row) > postgres=# select trunc(1234.1234, 2); > trunc > --------- > 1234.12 > (1 row) > postgres=# select trunc(1234.1234, -1); > trunc > ------- > 1230 > (1 row) > postgres=# select trunc(1234.1234, -3); > trunc > ------- > 1000 > (1 row) > {code} > This is incorrect, I can't truncate to zero decimal places: > {code} > 0: jdbc:drill:schema=dfs> select trunc(1234.1234) from sys.options limit 1; > +------------+ > | EXPR$0 | > +------------+ > | 1234.0 | > +------------+ > 1 row selected (0.133 seconds) > 0: jdbc:drill:schema=dfs> select trunc(1234.1234,0) from sys.options limit 1; > +------------+ > | EXPR$0 | > +------------+ > | 1234.0 | > +------------+ > 1 row selected (0.065 seconds) > {code} > Second negative parameter, does not do what it is supposed to do as well: > {code} > 0: jdbc:drill:schema=dfs> select trunc(1234.1234, -1) from sys.options limit 1; > +------------+ > | EXPR$0 | > +------------+ > | 1230.0 | > +------------+ > 1 row selected (0.068 seconds) > 0: jdbc:drill:schema=dfs> select trunc(1234.1234, -3) from sys.options limit 1; > +------------+ > | EXPR$0 | > +------------+ > | 1000.0 | > +------------+ > 1 row selected (0.072 seconds) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)