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 794FE200C24 for ; Thu, 23 Feb 2017 09:30:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 77F4C160B78; Thu, 23 Feb 2017 08:30:00 +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 93BDF160B62 for ; Thu, 23 Feb 2017 09:29:59 +0100 (CET) Received: (qmail 43557 invoked by uid 500); 23 Feb 2017 08:29:58 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 43547 invoked by uid 99); 23 Feb 2017 08:29:58 -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; Thu, 23 Feb 2017 08:29:58 +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 374761A07A9 for ; Thu, 23 Feb 2017 08:29:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id AOr-yDUNjL2H for ; Thu, 23 Feb 2017 08:29:56 +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 2946A5F30C for ; Thu, 23 Feb 2017 08:29:56 +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 A13CBE08F5 for ; Thu, 23 Feb 2017 08:29:50 +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 2D2292413E for ; Thu, 23 Feb 2017 08:29:50 +0000 (UTC) Date: Thu, 23 Feb 2017 08:29:50 +0000 (UTC) From: "Lokesh Yadav (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-18832) Spark SQL: thiriftserver unable to run a registered Hive UDTF MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 23 Feb 2017 08:30:00 -0000 [ https://issues.apache.org/jira/browse/SPARK-18832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15880108#comment-15880108 ] Lokesh Yadav commented on SPARK-18832: -------------------------------------- This is the code for the sample UDTF that I am using to test: {{ package com.fuzzylogix.experiments.udf.hiveUDF; import org.apache.hadoop.hive.ql.exec.UDFArgumentException; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableConstantStringObjectInspector; import java.util.ArrayList; import java.util.List; /* * This is the class for a sample User Defined Table Function (UDTF) * * * Example: * Input: * * Input : "Paris" * * Output : * "***Paris***" * "###Paris###" * */ public class SampleUDTF extends GenericUDTF { private PrimitiveObjectInspector nameOI = null; static String pName = null; @Override public StructObjectInspector initialize(ObjectInspector[] args) throws UDFArgumentException { // input inspectors nameOI = (PrimitiveObjectInspector) args[0]; pName = ((WritableConstantStringObjectInspector) nameOI).getWritableConstantValue() .toString(); // output inspectors List fieldNames = new ArrayList(); List fieldOIs = new ArrayList(); fieldNames.add("First"); fieldOIs.add(PrimitiveObjectInspectorFactory.javaStringObjectInspector); fieldNames.add("Second"); fieldOIs.add(PrimitiveObjectInspectorFactory.javaStringObjectInspector); return ObjectInspectorFactory.getStandardStructObjectInspector(fieldNames, fieldOIs); } @Override public void process(Object[] record) throws HiveException { ArrayList outList = new ArrayList(); outList.add("***" + pName + "***"); outList.add("###" + pName + "###"); forward(outList); } @Override public void close() throws HiveException { // do nothing } } }} > Spark SQL: thiriftserver unable to run a registered Hive UDTF > ------------------------------------------------------------- > > Key: SPARK-18832 > URL: https://issues.apache.org/jira/browse/SPARK-18832 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.0.0, 2.0.1, 2.0.2 > Environment: HDP: 2.5 > Spark: 2.0.0 > Reporter: Lokesh Yadav > > Spark Thriftserver is unable to run a HiveUDTF. > It throws the error that it is unable to find the functions although the function registration succeeds and the funtions does show up in the list output by {{show functions}}. > I am using a Hive UDTF, registering it using a jar placed on my local machine. Calling it using the following commands: > //Registering the functions, this command succeeds. > {{CREATE FUNCTION SampleUDTF AS 'com.fuzzylogix.experiments.udf.hiveUDF.SampleUDTF' USING JAR '/root/spark_files/experiments-1.2.jar';}} > //Thriftserver is able to look up the functuion, on this command: > {{DESCRIBE FUNCTION SampleUDTF;}} > {quote} > Output: > +-----------------------------------------------------------+--+ > | function_desc | > +-----------------------------------------------------------+--+ > | Function: default.SampleUDTF | > | Class: com.fuzzylogix.experiments.udf.hiveUDF.SampleUDTF | > | Usage: N/A. | > +-----------------------------------------------------------+--+ > {quote} > // Calling the function: > {{SELECT SampleUDTF('Paris');}} > bq. Output of the above command: Error: org.apache.spark.sql.AnalysisException: Undefined function: 'SampleUDTF'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'.; line 1 pos 7 (state=,code=0) > I have also tried with using a non-local (on hdfs) jar, but I get the same error. > My environment: HDP 2.4 with spark 2.00 -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org