Return-Path: X-Original-To: apmail-tajo-dev-archive@minotaur.apache.org Delivered-To: apmail-tajo-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 207D910560 for ; Sun, 8 Dec 2013 07:47:11 +0000 (UTC) Received: (qmail 45449 invoked by uid 500); 8 Dec 2013 07:47:06 -0000 Delivered-To: apmail-tajo-dev-archive@tajo.apache.org Received: (qmail 45428 invoked by uid 500); 8 Dec 2013 07:47:03 -0000 Mailing-List: contact dev-help@tajo.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tajo.incubator.apache.org Delivered-To: mailing list dev@tajo.incubator.apache.org Received: (qmail 45415 invoked by uid 99); 8 Dec 2013 07:47:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Dec 2013 07:47:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 08 Dec 2013 07:46:57 +0000 Received: (qmail 44108 invoked by uid 99); 8 Dec 2013 07:46:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Dec 2013 07:46:35 +0000 Date: Sun, 8 Dec 2013 07:46:35 +0000 (UTC) From: "Hyunsik Choi (JIRA)" To: dev@tajo.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (TAJO-344) Tajo cannot recognize negative numeric expressions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/TAJO-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13842440#comment-13842440 ] Hyunsik Choi edited comment on TAJO-344 at 12/8/13 7:46 AM: ------------------------------------------------------------ Thank you for your detailed review. The result of Math.round may be different from other programming languages. This is because there are various round half-down/up manners \[1\] and Math.round uses some different round manner. So, we can get a mismatch as follows: {code:title=Math.round} Math.round(-5.5) -> -5 {code} {code:title=PostgreSQL} hyunsik=> select round(-5.5); round ------- -6 (1 row) {code} {code:title=MySQL} MariaDB [(none)]> select round(-5.5); +-------------+ | round(-5.5) | +-------------+ | -6 | +-------------+ 1 row in set (0.00 sec) {code} Especially, we could face the result mismatch problem when we use a vectorized engine based on C++. This patch also contains the workaround code. I missed the detail comment for this reason. Since this workaround code may make other guys confuse, I'll add some notes on Round class. In addition, in my opinion, succeeded hunks are not problem because it just means somewhat difference of diff lines but success. If we have to rebase all patches that cause even success hunk, contributors will be exhausted due to too frequent rebase. \[1\] https://en.wikipedia.org/wiki/Rounding#Round_half_up was (Author: hyunsik): Thank you for your detailed review. The result of Math.round may be different from other programming languages. This is because there are various rounding half-down/up manners \[1\] and Math.round uses some different rounding half-down manner. So, we can get a mismatch as follows: {code:title=Math.round} Math.round(-5.5) -> -5 {code} {code:title=PostgreSQL} hyunsik=> select round(-5.5); round ------- -6 (1 row) {code} {code:title=MySQL} MariaDB [(none)]> select round(-5.5); +-------------+ | round(-5.5) | +-------------+ | -6 | +-------------+ 1 row in set (0.00 sec) {code} Especially, we could face the result mismatch problem when we use a vectorized engine based on C++. This patch also contains the workaround code. I missed the detail comment for this reason. Since this workaround code may make other guys confuse, I'll add some notes on Round class. In my opinion, succeeded hunks are not problem because it just means somewhat difference of diff lines but success. If we have to rebase all patches that cause even success hunk, contributors will be exhausted due to too frequent rebase. \[1\] https://en.wikipedia.org/wiki/Rounding#Round_half_up > Tajo cannot recognize negative numeric expressions > -------------------------------------------------- > > Key: TAJO-344 > URL: https://issues.apache.org/jira/browse/TAJO-344 > Project: Tajo > Issue Type: Bug > Components: operator/function/udf, parser, planner/optimizer > Reporter: Hyunsik Choi > Assignee: Hyunsik Choi > Fix For: 0.8-incubating > > Attachments: TAJO-344.patch > > > The parser cannot deal with negative numeric values. You can reproduce the problem as follows: > {code} > select -1; > {code} > We have to fix it. -- This message was sent by Atlassian JIRA (v6.1#6144)