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 7D7EA200C24 for ; Wed, 8 Feb 2017 13:09:18 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7C355160B4E; Wed, 8 Feb 2017 12:09:18 +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 CA636160B5A for ; Wed, 8 Feb 2017 13:09:17 +0100 (CET) Received: (qmail 69098 invoked by uid 500); 8 Feb 2017 12:09:17 -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 68866 invoked by uid 99); 8 Feb 2017 12:09:17 -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; Wed, 08 Feb 2017 12:09:17 +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 705AFC05D7 for ; Wed, 8 Feb 2017 12:09:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-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 (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id znUUJxvNeTLR for ; Wed, 8 Feb 2017 12:09:15 +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 692315F1BA for ; Wed, 8 Feb 2017 12:09:15 +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 4685EE05F2 for ; Wed, 8 Feb 2017 12:08:43 +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 067CA2529A for ; Wed, 8 Feb 2017 12:08:42 +0000 (UTC) Date: Wed, 8 Feb 2017 12:08:42 +0000 (UTC) From: "Fei Hui (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-15849) hplsql should add enterGlobalScope func to UDF MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 08 Feb 2017 12:09:18 -0000 [ https://issues.apache.org/jira/browse/HIVE-15849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fei Hui updated HIVE-15849: --------------------------- Attachment: HIVE-15832.patch patch uploaded > hplsql should add enterGlobalScope func to UDF > ---------------------------------------------- > > Key: HIVE-15849 > URL: https://issues.apache.org/jira/browse/HIVE-15849 > Project: Hive > Issue Type: Bug > Components: hpl/sql > Affects Versions: 2.2.0 > Reporter: Fei Hui > Assignee: Fei Hui > Attachments: HIVE-15832.patch > > > code in Udf.java > {quote} > if (exec == null) { > exec = new Exec(); > exec.enterGlobalScope(); > String query = queryOI.getPrimitiveJavaObject(arguments[0].get()); > String[] args = { "-e", query, "-trace" }; > try { > exec.setUdfRun(true); > exec.init(args); > } catch (Exception e) { > throw new HiveException(e.getMessage()); > } > } > if (arguments.length > 1) { > setParameters(arguments); > } > Var result = exec.run(); > if (result != null) { > return result.toString(); > } > {quote} > we should add 'exec.enterGlobalScope(); ' before set parameters > before fixing this > we get the wrong result, result contains empty string > Starting pre-SQL statement > Starting pre-SQL statement > Starting pre-SQL statement > Starting pre-SQL statement > Starting pre-SQL statement > Starting query > Query executed successfully (2.30 sec) > Ln:8 SELECT completed successfully > Ln:8 Standalone SELECT executed: 1 columns in the result set > Hello, ! > Hello, ! > after fixing it > we get the right result > Starting pre-SQL statement > Starting pre-SQL statement > Starting pre-SQL statement > Starting pre-SQL statement > Starting pre-SQL statement > Starting query > Query executed successfully (2.35 sec) > Ln:8 SELECT completed successfully > Ln:8 Standalone SELECT executed: 1 columns in the result set > Hello, fei! > Hello, fei! > tests come from HIVE-15832 -- This message was sent by Atlassian JIRA (v6.3.15#6346)