Return-Path: X-Original-To: apmail-incubator-drill-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-drill-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 10859109C9 for ; Tue, 25 Nov 2014 16:42:06 +0000 (UTC) Received: (qmail 28856 invoked by uid 500); 25 Nov 2014 16:42:00 -0000 Delivered-To: apmail-incubator-drill-user-archive@incubator.apache.org Received: (qmail 28793 invoked by uid 500); 25 Nov 2014 16:42:00 -0000 Mailing-List: contact drill-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: drill-user@incubator.apache.org Delivered-To: mailing list drill-user@incubator.apache.org Received: (qmail 28775 invoked by uid 99); 25 Nov 2014 16:42:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Nov 2014 16:42:00 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cjbourgade@gmail.com designates 209.85.223.180 as permitted sender) Received: from [209.85.223.180] (HELO mail-ie0-f180.google.com) (209.85.223.180) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Nov 2014 16:41:56 +0000 Received: by mail-ie0-f180.google.com with SMTP id rp18so897001iec.11 for ; Tue, 25 Nov 2014 08:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=75AjVMz9tD4B4NNS9c9Fpj3QQVuLUImLkHqwsnfms3E=; b=O38QPTFn4mlYnGsRQUVRfXJOqNh9/u/Ej2oySVW/JfKnn6Mtx/H3tTVIj/FRMUAs2i YjWJ/5HscNCJRsjzSOu5R74bIEfaqO3wAPK++qjFgFzAuKVmhzsVDCl/xE3u7nqS9a88 AlYI5JCAip0HD70YTgllQ2ohErgYqamkAykDBHu0HLuqCJx3TvcblFrl4swszwcXc2ui rJ+LAQsXUyGTPNyjsIG5c1N4t8kysayjQ1ELo5dnX9/2WXNez1pzd9J6ExphLz1ZSDzk 6y0ONgLC3cQPFrnlSvtP2BRlOEnqdZpZ0VhhtP4KTBNtAb3BNGQ7qbmDq/cN2VJAk263 QZFg== MIME-Version: 1.0 X-Received: by 10.107.25.129 with SMTP id 123mr22805424ioz.90.1416933605512; Tue, 25 Nov 2014 08:40:05 -0800 (PST) Received: by 10.64.8.47 with HTTP; Tue, 25 Nov 2014 08:40:05 -0800 (PST) In-Reply-To: References: Date: Tue, 25 Nov 2014 11:40:05 -0500 Message-ID: Subject: Re: convert_from example From: Carol Bourgade To: drill-user@incubator.apache.org Content-Type: multipart/alternative; boundary=001a113fe4ca3a1d2e0508b19000 X-Virus-Checked: Checked by ClamAV on apache.org --001a113fe4ca3a1d2e0508b19000 Content-Type: text/plain; charset=UTF-8 the values in the HBase table are string bytes , ( drill sandbox data) the following works, create an HBase view : create or replace view tview as select cast(row_key as bigint) as cust_id, cast(t.loyalty.membership as varchar(20)) as membership from maprdb.customers t; join view with hive orders : select sum(orders.order_total) as sales, tview.membership from hive.orders, tview where orders.cust_id=tview.cust_id group by tview.membership; But if I create this HBase view: create or replace view tview as select cast(convert_from(row_key, 'UTF8') as bigint) as cust_id, cast(t.loyalty.membership as varchar(20)) as membership from maprdb.customers t; I get this error on the same Join : select sum(orders.order_total) as sales, tview.membership from hive.orders, tview where orders.cust_id=tview.cust_id group by tview.membership; Query failed: Failure due to uncaught exception Encountered an illegal char on line 1, column 31: '' [32b09a52-0a16-4d43-9277-1da03d336b29] Error: exception while executing query: Failure while trying to get next result batch. (state=,code=0) On Mon, Nov 24, 2014 at 6:24 PM, Steven Phillips wrote: > It depends on how the value is encoded. Possible encodings include, e.g. > little endian, big endian, and UTF8 string. > > select convert_from(row_key, 'INT'); // for little endian encoding > select convert_from(row_key, 'INT_BE'); // for big endian encoding > select cast(convert_from(row_key, 'UTF8') as int); // for utf8 string > encoding > > On Mon, Nov 24, 2014 at 3:09 PM, carol Bourgade > wrote: > > > can someone give an example using convert_from instead of cast in the > > following query on an HBase table : > > > > select cast(row_key as int) as cust_id > > from hbase.customers t ; > > > > > > -- > Steven Phillips > Software Engineer > > mapr.com > --001a113fe4ca3a1d2e0508b19000--