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 00046200C1D for ; Thu, 16 Feb 2017 10:07:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F2C53160B6F; Thu, 16 Feb 2017 09:07:47 +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 49A91160B57 for ; Thu, 16 Feb 2017 10:07:47 +0100 (CET) Received: (qmail 31769 invoked by uid 500); 16 Feb 2017 09:07:46 -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 31760 invoked by uid 99); 16 Feb 2017 09:07:46 -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; Thu, 16 Feb 2017 09:07:46 +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 E6C43185E69 for ; Thu, 16 Feb 2017 09:07:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id rKyQkmNdNmYu for ; Thu, 16 Feb 2017 09:07:45 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id BED1D5FAFB for ; Thu, 16 Feb 2017 09:07:44 +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 ED792E02BA for ; Thu, 16 Feb 2017 09:07:41 +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 B46E62411D for ; Thu, 16 Feb 2017 09:07:41 +0000 (UTC) Date: Thu, 16 Feb 2017 09:07:41 +0000 (UTC) From: "Serhii Harnyk (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-4939) to_date function returns incorrect result MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 16 Feb 2017 09:07:48 -0000 [ https://issues.apache.org/jira/browse/DRILL-4939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15869573#comment-15869573 ] Serhii Harnyk commented on DRILL-4939: -------------------------------------- [~khfaraaz] This function returns correct result, and it's behavior does not changed. According to http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html you should use pattern yyyy-MM-dd. If you want to use Postgres-based date-time format, you should use function sql_to_date. {code:sql} values(to_date('2016-09-22','yyyy-MM-dd')); +-------------+ | EXPR$0 | +-------------+ | 2016-09-22 | +-------------+ {code} > to_date function returns incorrect result > ----------------------------------------- > > Key: DRILL-4939 > URL: https://issues.apache.org/jira/browse/DRILL-4939 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Data Types > Affects Versions: 1.9.0 > Reporter: Khurram Faraaz > Priority: Critical > > to_date function returns wrong result > correct results from Postgres > {noformat} > postgres=# values(to_date('2016-09-22','yyyy-mm-dd')); > column1 > ------------ > 2016-09-22 > (1 row) > {noformat} > wrong results returned by Drill 1.9.0 git commit id: 4edabe7a > {noformat} > : jdbc:drill:schema=dfs.tmp> values(to_date('2016-09-22','yyyy-mm-dd')); > +-------------+ > | EXPR$0 | > +-------------+ > | 2016-01-22 | > +-------------+ > 1 row selected (0.125 seconds) > {noformat} > Postgres 9.3 returns true for below query whereas drill 1.9.0 returns false. > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select (res1 = to_date('2016-09-22','yyyy-mm-dd')) res2 > . . . . . . . . . . . . . . > from > . . . . . . . . . . . . . . > ( > . . . . . . . . . . . . . . > select (case when (false) then null else cast('2016/09/22' as date) end) res1 > . . . . . . . . . . . . . . > from (values(1)) foo > . . . . . . . . . . . . . . > ) foobar; > +--------+ > | res2 | > +--------+ > | false | > +--------+ > 1 row selected (0.146 seconds) > postgres=# select (res1 = to_date('2016/09/22','yyyy-mm-dd')) res2 > postgres-# from > postgres-# ( > postgres(# select (case when (false) then null else cast('2016/09/22' as date) end) res1 > postgres(# from (values(1)) foo > postgres(# ) foobar; > res2 > ------ > t > (1 row) > {noformat} > Postgres 9.3 returns an error for below query, where as Drill git commit ID: 4edabe7a returns some results. > This looks like it has to do with the to_date function in drill. > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select (res1 = to_date(2016/09/22)) res2 > . . . . . . . . . . . . . . > from > . . . . . . . . . . . . . . > ( > . . . . . . . . . . . . . . > select (case when (false) then null else cast('2016/09/22' as date) end) res1 > . . . . . . . . . . . . . . > from (values(1)) foo > . . . . . . . . . . . . . . > ) foobar; > +--------+ > | res2 | > +--------+ > | false | > +--------+ > 1 row selected (0.166 seconds) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346)