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 A9A2F200AF8 for ; Thu, 5 May 2016 14:26:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A8297160A03; Thu, 5 May 2016 12:26:19 +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 CCC0D160A02 for ; Thu, 5 May 2016 14:26:18 +0200 (CEST) Received: (qmail 44695 invoked by uid 500); 5 May 2016 12:26:16 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 43764 invoked by uid 99); 5 May 2016 12:26:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2016 12:26:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 82C85C0B7D; Thu, 5 May 2016 12:26:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.448 X-Spam-Level: * X-Spam-Status: No, score=1.448 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id cF0kS8Ib_AAt; Thu, 5 May 2016 12:26:13 +0000 (UTC) Received: from mail-qk0-f176.google.com (mail-qk0-f176.google.com [209.85.220.176]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 9FF3F5F1AE; Thu, 5 May 2016 12:26:12 +0000 (UTC) Received: by mail-qk0-f176.google.com with SMTP id j68so30430998qke.2; Thu, 05 May 2016 05:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=O+bzMOeg8WW9Pf714eNi6PfFxAgGDLf2MtZNKy8hSAU=; b=vJrx0Zu/oWs6fADktwb5eIy4TMiN3/OdZd88KEGnvyhyvyyL8iAsl0GlR1W+iNHnG5 fT+F17K1k5n6A9mrvVSxfhKIjsj6/51eMM0RMR7IKWBAcYtaKtw3Opfrub/9bfZMqHgl uZtxyehhhbkZkOOTapy69EnqjPtgKMbXm5r27sLFfSDUnOpBTZpOlRvp21Bci0+Z86GB OaG7fRgbu1AX7/X6JkV+FHAHLG27O9P/h1+BX6MNL6T1yoPLX4LHiO92CkamFvm1ynHs GuCdSIMo3k5w2felEW57qk2C0u3lR6IBhhmcd+TuQPwdzriLD/0ZkOP/AL9iLYt4Ojl2 R9tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=O+bzMOeg8WW9Pf714eNi6PfFxAgGDLf2MtZNKy8hSAU=; b=jWf/dL2yvG0SbJNszyRY0o6YFjWLEx6Q3nYWu/bmyKP6ujYsaNZ2u2UZcb1Tu3cnYx JzFJDsQPLFyMcF6yo2pwOmc56w4msGrUmcVODmww8kHfgiFl61GCbZXfN8cmKDhfHuHW U6xLLSPirpGi30cLZf0cYpZfxYGpxg48jnVhDOQc1eUGw4nCT5qKnuZM+D+2pB/ke4sr fH2ge8iKlLckZYl9paxL4D3AYBpNmB7/JG9aA9G2bxkxaWJFk14n3Q7ciA2dYbh6+fqN 1nTy+0XvCQ2h3hNGSfeTJI4rlWsP5lB7/wKOxJVCa6EBcKqLlH/rHywV+TLEgcwH/QG5 /Pfw== X-Gm-Message-State: AOPr4FVmVZJB5AB0u4v0X42OM6yQeP/EpMSFVBse7BrsCl7Wka/RhW2eTrOzsDnvNS8pka1jfz+vs+FRCNgIMw== X-Received: by 10.55.72.196 with SMTP id v187mr13892450qka.97.1462451171782; Thu, 05 May 2016 05:26:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.36.66 with HTTP; Thu, 5 May 2016 05:25:32 -0700 (PDT) In-Reply-To: References: From: Amey Barve Date: Thu, 5 May 2016 17:55:32 +0530 Message-ID: Subject: Re: Predicates for 'like' and 'between' operators to custom storage handler. To: user@hive.apache.org Cc: dev@hive.apache.org Content-Type: multipart/alternative; boundary=001a114a7f889876f70532177202 archived-at: Thu, 05 May 2016 12:26:19 -0000 --001a114a7f889876f70532177202 Content-Type: text/plain; charset=UTF-8 Hi, Do you have the equivalent of that operation in pure SQL. ---> This is my hive query: *select count(*) from u_data where unixtime like '%888904884%'* Query evaluates and results are correct. But point is that hive does not give like operator during predicate push down to custom storage handler. I am mapping with *hive's UDFLike* class. Also have you tried Spark query tool with Hive table. ---> *No*. I gather you are doing this through Java? ---> *YES*. Has anybody tried mapping operators other than '=', '!=', '<', '<=', '>' and '>=' ? Regards, Amey On Thu, May 5, 2016 at 5:44 PM, Mich Talebzadeh wrote: > Hi, > > Do you have the equivalent of that operation in pure SQL. Also have you > tried Spark query tool with Hive table. > > I gather you are doing this through Java? > > Dr Mich Talebzadeh > > > > LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw > * > > > > http://talebzadehmich.wordpress.com > > > > On 5 May 2016 at 13:10, Amey Barve wrote: > >> Thanks Mich, >> >> It does work, but with operators other than '=', '!=', '<', '<=', '>' and >> '>=' , my code with custom storage handler gets null expression. >> >> *final String expression = conf.get(TableScanDesc.FILTER_EXPR_CONF_STR); >> // expression is null for hive query that has like operator* >> >> Why does above API return *null* for hive query that has like operator? >> I need to pass like operator for predicate push down to my custom storage >> handler. >> >> Regards, >> Amey >> >> On Thu, May 5, 2016 at 5:30 PM, Mich Talebzadeh < >> mich.talebzadeh@gmail.com> wrote: >> >>> On a normal query using sql in* Hive 2* LIKE predicate works fine. Case >>> in point in a 1 billion rows table with the column random_string of >>> varchar(50) I have one row that satisfies the followinh@ >>> >>> >>> +-----------+------------------+------------------+-------------------+-----------------------------------------------------+-----------------+----------------+--+ >>> | dummy.id | dummy.clustered | dummy.scattered | dummy.randomised >>> | dummy.random_string | dummy.small_vc | >>> dummy.padding | >>> >>> +-----------+------------------+------------------+-------------------+-----------------------------------------------------+-----------------+----------------+--+ >>> | 1 | 0 | 0 | 63 | >>> rMLTDXxxqXOZnqYRJwInlGfGBTxNkAszBGEUGELqTSRnFjRGbi | 1 | >>> xxxxxxxxxx | >>> | 2 | 0 | 1 | 926 | >>> UEDJsfIgoYqwreSuuvjIcPZarpxMdCthpDCsgPlJfvIiylLiBS | 2 | >>> xxxxxxxxxx | >>> >>> Now let us try to select that row with LIKE predicate: >>> >>> 0: jdbc:hive2://rhes564:10010/default> select count(1) from dummy where >>> random_string like 'rMLTDXxxqXOZnqYRJ%'; >>> >>> INFO : >>> Query Hive on Spark job[0] stages: >>> INFO : 0 >>> INFO : 1 >>> INFO : >>> Status: Running (Hive on Spark job[0]) >>> >>> INFO : Completed executing >>> command(queryId=hduser_20160505125700_cbc415b6-91bb-4ed6-95e4-d177e12988f6); >>> Time taken: 153.544 seconds >>> INFO : OK >>> +-----+--+ >>> | c0 | >>> +-----+--+ >>> | 1 | >>> +-----+--+ >>> 1 row selected (153.959 seconds) >>> >>> So it does work >>> >>> HTH >>> >>> >>> Dr Mich Talebzadeh >>> >>> >>> >>> LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw >>> * >>> >>> >>> >>> http://talebzadehmich.wordpress.com >>> >>> >>> >>> On 5 May 2016 at 11:53, Amey Barve wrote: >>> >>>> Hi All, >>>> >>>> I have implemented custom storage-handler and able to get predicates >>>> from hive for '=', '!=', '<', '<=', '>' and '>=' operators. >>>> But I cannot get predicates from hive for 'like', 'between' operators. >>>> >>>> Here's my code: >>>> >>>> *final String expression = >>>> conf.get(TableScanDesc.FILTER_EXPR_CONF_STR);* >>>> >>>> here expression remains null for like and between operators but not >>>> null for above operators. >>>> >>>> Does hive not give predicates for 'like' and 'between' operators to >>>> custom storage handler ? >>>> *Is there some other mechanism to get predicates for 'like' operator*? >>>> >>>> I tested with hive version 1.2 and 0.14. >>>> >>>> Thanks and Regards, >>>> Amey >>>> >>> >>> >> > --001a114a7f889876f70532177202--