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 15FDC200BAE for ; Fri, 28 Oct 2016 16:09:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 149EA160AE3; Fri, 28 Oct 2016 14:09:38 +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 5A044160ADD for ; Fri, 28 Oct 2016 16:09:37 +0200 (CEST) Received: (qmail 29358 invoked by uid 500); 28 Oct 2016 14:09:36 -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 29346 invoked by uid 99); 28 Oct 2016 14:09:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2016 14:09:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A3F011A9A64 for ; Fri, 28 Oct 2016 14:09:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.302 X-Spam-Level: X-Spam-Status: No, score=-0.302 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=maprtech.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 7oEWmem3yVt1 for ; Fri, 28 Oct 2016 14:09:32 +0000 (UTC) Received: from mail-pf0-f170.google.com (mail-pf0-f170.google.com [209.85.192.170]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 0762B5F24F for ; Fri, 28 Oct 2016 14:09:31 +0000 (UTC) Received: by mail-pf0-f170.google.com with SMTP id n85so38236779pfi.1 for ; Fri, 28 Oct 2016 07:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maprtech.com; s=google; h=mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=6jJTJWWdAEdS4kH7EaUreuxM5eGNoohHC8QgafQkWFg=; b=GmilWZkr87AHnRulv39jhKNGkVWvihHt+FUF7/kmHx29lPsHq7ItRb2IzBDDQBS/jf TnSWWVd1tRivDE+fCO06CrC4r4xbgog+4EiiWRxsnK+IekyJ49dsqRcvpJUW8N3pOjb4 lKRrdDJAY7GeLZ7OVAWLkMzDwBvwTKiUDC68A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=6jJTJWWdAEdS4kH7EaUreuxM5eGNoohHC8QgafQkWFg=; b=ZpyJdV3OmEPokGirSzGzf/SSkqKX5/o//v0nR7ZNFksRkB0YYIF2SyrGRwgi/J0dON LaxFzhSVqM9uUsqXYN32PmTafN54L7Sc6hLUeEbAkqnLBvk/sniIhlCw/yxeOjnp7I5p aT8SqYz5VTHD8LyLz7KO7vyBxZ4HIApJJ2oXeJNNWWQK1KoMTZOl+GKUGV6Roy/ZGE/Q 3fe4ypgFtscYdXUX7SzD4lLYz752/aYz0ixD5nD7ZAzjqRkc1GU6wfy1To1jkDI+hlnl K4kwIrG/BCSFG8hAGOIBUl/1lVzgy5VqoRJpuEGwetQltuF1HA8hjdZOVq+4tqW5/+4t U/ag== X-Gm-Message-State: ABUngvcEsuzfYUImQQEGuq+8TIFlxNlNwnFWExrwBkwDz/ruMwxctO7uErCaTaIwXY2mdpQX X-Received: by 10.98.24.198 with SMTP id 189mr25000043pfy.31.1477663755210; Fri, 28 Oct 2016 07:09:15 -0700 (PDT) Received: from [192.168.7.25] (astound-66-234-202-236.ca.astound.net. [66.234.202.236]) by smtp.gmail.com with ESMTPSA id wc6sm19369640pab.47.2016.10.28.07.09.13 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Oct 2016 07:09:14 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: to_date(csv-columns[x],'yyyy-mm-dd') - IllegalArgumentException From: Andries Engelbrecht In-Reply-To: Date: Fri, 28 Oct 2016 07:09:13 -0700 Content-Transfer-Encoding: 7bit Message-Id: <94A1F428-7AE4-4447-84D9-CF47660D6CA1@maprtech.com> References: To: dev@drill.apache.org X-Mailer: Apple Mail (2.3124) archived-at: Fri, 28 Oct 2016 14:09:38 -0000 You should use yyyy-MM-dd. I have not noticed the issue before with CSV. --Andries > On Oct 28, 2016, at 6:24 AM, Khurram Faraaz wrote: > > All, > > Question is - why does it work for a parquet column and fails when CSV > column is used ? > > Drill 1.9.0 commit : a29f1e29 > > This is a simple project of column from a csv file, works. > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select columns[4] FROM `typeall_l.csv` t1 > limit 5; > +-------------+ > | EXPR$0 | > +-------------+ > | 2011-11-04 | > | 1986-10-22 | > | 1992-09-10 | > | 2016-08-07 | > | 1986-01-25 | > +-------------+ > 5 rows selected (0.26 seconds) > {noformat} > > Using TO_DATE function with columns[x] as first input fails, with an > IllegalArgumentException > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select to_date(columns[4],'yyyy-mm-dd') FROM > `typeall_l.csv` t1 limit 5; > Error: SYSTEM ERROR: IllegalArgumentException: Invalid format: "" > > Fragment 0:0 > > [Error Id: 9cff3eb9-4045-4d9a-a6a1-1eadaa597f30 on centos-01.qa.lab:31010] > (state=,code=0) > {noformat} > > However, interestingly same query over parquet column returns correct > results, on same data. > > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select to_date(col_dt,'yyyy-mm-dd') FROM > typeall_l limit 5; > +-------------+ > | EXPR$0 | > +-------------+ > | 2011-01-04 | > | 1986-01-22 | > | 1992-01-10 | > | 2016-01-07 | > | 1986-01-25 | > +-------------+ > 5 rows selected (0.286 seconds) > {noformat} > > When the date string is passed as first input, to_date function returns > correct results. > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select to_date('2011-01-04','yyyy-mm-dd') > from (values(1)); > +-------------+ > | EXPR$0 | > +-------------+ > | 2011-01-04 | > +-------------+ > 1 row selected (0.235 seconds) > {noformat} > > Thanks, > Khurram