From issues-return-152412-archive-asf-public=cust-asf.ponee.io@hive.apache.org Mon Mar 11 18:00:06 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 683E6180763 for ; Mon, 11 Mar 2019 19:00:06 +0100 (CET) Received: (qmail 89928 invoked by uid 500); 11 Mar 2019 18:00:05 -0000 Mailing-List: contact issues-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 issues@hive.apache.org Received: (qmail 89348 invoked by uid 99); 11 Mar 2019 18:00:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Mar 2019 18:00:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 43B93C0CC4 for ; Mon, 11 Mar 2019 18:00:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id g7z1nhRSrbhk for ; Mon, 11 Mar 2019 18:00:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 139405FAFD for ; Mon, 11 Mar 2019 18:00:02 +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 E8D1FE0EF6 for ; Mon, 11 Mar 2019 18:00:00 +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 4010B2580A for ; Mon, 11 Mar 2019 18:00:00 +0000 (UTC) Date: Mon, 11 Mar 2019 18:00:00 +0000 (UTC) From: "Jesus Camacho Rodriguez (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-21388) Constant UDF is not pushed to JDBCStorage Handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-21388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jesus Camacho Rodriguez updated HIVE-21388: ------------------------------------------- Resolution: Fixed Fix Version/s: 3.2.0 4.0.0 Status: Resolved (was: Patch Available) Updated comment and pushed to master, branch-3. Thanks [~jdere] > Constant UDF is not pushed to JDBCStorage Handler > ------------------------------------------------- > > Key: HIVE-21388 > URL: https://issues.apache.org/jira/browse/HIVE-21388 > Project: Hive > Issue Type: Improvement > Components: CBO, StorageHandler > Affects Versions: 4.0.0 > Reporter: Daniel Dai > Assignee: Jesus Camacho Rodriguez > Priority: Major > Fix For: 4.0.0, 3.2.0 > > Attachments: HIVE-21388.01.patch, HIVE-21388.02.patch, HIVE-21388.patch > > > A query involve a Hive UDF which produce a constant value does not push to JDBC table. Replacing the UDF with a constant push down works. Ideally, Hive shall first do constant folding and then push the computation. > Here is the example: > {code} > explain select PRINCIPAL_NAME from sys.TBL_PRIVS where PRINCIPAL_NAME=current_user(); > +----------------------------------------------------+ > | Explain | > +----------------------------------------------------+ > | Plan optimized by CBO. | > | | > | Stage-0 | > | Fetch Operator | > | limit:-1 | > | Select Operator [SEL_3] | > | Output:["_col0"] | > | Filter Operator [FIL_2] | > | predicate:(_col5 = 'hrt_qa') | > | Select Operator [SEL_1] | > | Output:["_col5"] | > | TableScan [TS_0] | > | Output:["principal_name"],properties:{"hive.sql.query":"SELECT `tbl_grant_id`, `create_time`, `grant_option`, `grantor`, `grantor_type`, `principal_name`, `principal_type`, `tbl_priv`, `tbl_id`, `authorizer`\nFROM `TBL_PRIVS`","hive.sql.query.fieldNames":"tbl_grant_id,create_time,grant_option,grantor,grantor_type,principal_name,principal_type,tbl_priv,tbl_id,authorizer","hive.sql.query.fieldTypes":"bigint,int,int,string,string,string,string,string,bigint,string","hive.sql.query.split":"true"} | > | | > +----------------------------------------------------+ > {code} > If I replace current_user() with a constant, the predicate is pushed to table scan. > Also, setting annotation deterministic=true and make initialize() return a ConstantObjectInspector of GenericUDFCurrentUser does not make a difference. -- This message was sent by Atlassian JIRA (v7.6.3#76005)