Questions tagged [udf]

A user-defined function (UDF) is a function provided by the user of a program or environment, in a context where the usual assumption is that functions are built into the program or environment. Although the term is widely known in Hadoop components such Hive and Pig, it is also used in other contexts such programming languages and some DBMSs.

From the docs:

Introduction

Pig provides extensive support for user defined functions (UDFs) as a way to specify custom processing. Pig UDFs can currently be implemented in three languages: Java, Python, and JavaScript.

The most extensive support is provided for Java functions. You can customize all parts of the processing including data load/store, column transformation, and aggregation. Java functions are also more efficient because they are implemented in the same language as Pig and because additional interfaces are supported such as the Algebraic Interface and the Accumulator Interface.

Limited support is provided for Python and JavaScript functions. These functions are new, still evolving, additions to the system. Currently only the basic interface is supported; load/store functions are not supported. Furthermore, JavaScript is provided as an experimental feature because it did not go through the same amount of testing as Java or Python. At runtime note that Pig will automatically detect the usage of a scripting UDF in the Pig script and will automatically ship the corresponding scripting jar, either Jython or Rhino, to the backend.

537 questions
0
votes
1 answer

'runtime error 1004 application-defined or object-defined error' when trying to input UDF through range.formula

I'm trying to put a user defined function in cell J3 through Range.Formula method, but I encounter application-defined or object-defined error, can someone please tell me if it is even possible to put UDFs in cells that way? I tested the function by…
0
votes
2 answers

How to create UDF in AS400

I have this code of UDF that stars with create function... But I have NO idea where to put it inside the iseries navigator screen. can anyone help me? Google isn't helping
Luigi
  • 439
  • 5
  • 23
0
votes
1 answer

sql user defined function to retrieve same value

this is my asp.net method public static DataSet ProgressReport(int FirmID) { if (HttpContext.Current.Session["CNYearID"] != null && HttpContext.Current.Session["CNYearID"].ToString() != "") { firmcomplianceyear =…
0
votes
1 answer

Pig SUM a column until it reaches a certain value and return the rows

Can someone help me how to calculate the sum of a coloumn until it reaches a certain value. Usecase: top product which produced 50% of the revenue. Is there any library like piggybank to get it done, I couldn't find it in piggybank. I am trying to…
user1954395
  • 112
  • 8
0
votes
1 answer

Multiple tuples as input in a pig UDF written in Java

Example output from pig script: (1, 10) (2, 100) (3,44) (4,99) I eventually want to create a histogram in my java UDF. How can I input all of this at once in my UDF?
mrlarssen
  • 325
  • 8
  • 19
0
votes
1 answer

SQL Server function returns unrecognized text

I have created a user defined function that strips input text from HTML tags, but found that it also destroys Arabic text for some reason. I thought: maybe the function's logic causes the text to be converted to VARCHAR somewhere, so I made the…
Ahmad
  • 12,336
  • 6
  • 48
  • 88
0
votes
1 answer

Strange behavior of simple UDF in Hive

I have a hive table, which created using this code: CREATE EXTERNAL TABLE IPRegions ( ip STRING, -- other fields don't matter ) I need to output each ip in reverse order (yes, it is a very simple problem similar to SELECT ip FROM…
VeLKerr
  • 2,995
  • 3
  • 24
  • 47
0
votes
2 answers

Ad-hoc SQL and inline function giving different results

In MS SQL Server 2012 SP1, when I execute: SELECT rt.RoleId, ur.RoleName, app.ApplicationName FROM [TV_ClientPortal].[dbo].[UserRoleTie] rt JOIN [TV_ClientPortal].[dbo].[UserRoles] ur ON rt.RoleId = ur.RoleId …
prmph
  • 7,616
  • 11
  • 37
  • 46
-1
votes
1 answer

hive UDF on data with delimiters

I'm using the python & hive UDF to unpivot data. 'python.py' unpivots the data but I want to run this on Hive. I'm not able to get a handle on items that contain space and period. Is there a good way to get around it? My starting table looks like: …
kiki
  • 15
  • 5
-1
votes
1 answer

Error while setting UDF description in VBA

I am trying to Make a description for my user defined functions. I had no problem using this code: Sub RegisterUDF23() Dim FD As String FD = "Find the CN value based on landuse and soil type" & vbLf _ & "CNLookup(Landuse As Integer,…
M--
  • 25,431
  • 8
  • 61
  • 93
-1
votes
1 answer

Passing each column of a table to a UDF

I need to write a script in Python using which I run a query on all the columns of the table uploaded on bigquery. I understand that I can select individual columns by their names and process them like : SELECT DISTINCT column_name FROM…
-1
votes
1 answer

can't create a user defined function in sql to compute distance

Hello everyone i am trying to create an advanced search for restaurants with many filters for the user to select. One of the them is going to be the distance between his/her home and the restaurants. So i want to use a function in sql where it gets…
Bro Code
  • 1
  • 2
-1
votes
1 answer

How to write PIG UDF for tab separated data and adding timestamp on left hand side?

I'm trying to write PIG UDF for the below sample input file, and I'm specifying the expected output also. Please help me with the udf template for the same, or let me know if there is a way to do it without UDF. my Sample…
Rohit Nimmala
  • 1,459
  • 10
  • 28
-1
votes
1 answer

How to "select" inside a stored procedure or a UDF in DB2 LUW?

I believe this question is very trivial. I' unable to select rows inside a stored procedure that I defined, nor inside a UDF. Here is the syntax that I used: Create Or Replace Procedure GenerateSequence( In InternalUnitID SmallInt, In ObjectTypeID…
-1
votes
1 answer

Array UDF keeps repeating single value

I use an array UDF to select elements from a large data file that comply with several criteria. The formula works fine when I have multiple eligible elements, but when there is only one eligible element. The element keeps getting repeated…
1 2 3
35
36