user-defined-functions

Is main() a User-Defined Function? [duplicate]

自古美人都是妖i 提交于 2020-01-02 10:07:23
问题 This question already has answers here : main() in C, C++, Java, C# (9 answers) Closed 4 months ago . The programmer does define what happens inside main() , after all. So, should it be considered a user-defined function? 回答1: The C++ standard doesn't have the notion of user-defined functions. Instead, it has the notion of library functions . main is not a library function. However, the standard also imposes some requirements on its signature, and that it must not be overloaded or declared

Excel: Passing Array to User Defined Function (VBA)

…衆ロ難τιáo~ 提交于 2020-01-02 06:42:19
问题 edit: solution - see original question below In passing arrays like {1,2,3} to a UDF I found two things to be considered: the locale - see answer 1. The list separator on a german system (usually) is ";" therefore I need to use {1 ; 2 ; 3}. the passed array appears as a 2-dimensional array within the function. Therefore it's n-th element must be targeted as myArray(n, 1 ). Disregarding this gave me the #VALUE! error. Thus, a short "select case"-UDF may look like this: Function SelCase(a1, a2,

Select from Table Valued Function nhibernate

浪子不回头ぞ 提交于 2020-01-02 04:35:12
问题 I need a little help on this. I'm trying to use a table-valued function in a select, but I got the error that this is not mapped. dbo.FnListEvnt is not mapped [from dbo.FnListEvnt(:dt, :id, :code) ] Function CREATE FUNCTION [dbo].[FnListEvnt] (@DT DATETIME, @ID INT, @CODE VARCHAR (4)) RETURNS @RESULTADO TABLE ( ID INT , DT_INIC DATETIME , DT_TMNO DATETIME , CD_EVNT VARCHAR (5) ) AS BEGIN Custom Dialect (this is defined in .config ) public class CustomFunctionsMsSql2008Dialect :

UDF result error

╄→尐↘猪︶ㄣ 提交于 2020-01-01 20:27:28
问题 I try to install "mysqludf_sys". But i got this error: ERROR 1126 (HY000) at line 29: Can't open shared library 'lib_mysqludf_sys.so' (errno: 0 /usr/lib/mysql/plugin/lib_mysqludf_sys.so: cannot open shared object file: No such file or directory) ERROR: unable to install the UDF So, i tried to solve it with the following mofification in Makefile: LIBDIR=/usr/lib to LIBDIR=/usr/lib/mysql/plugin Also make sure that gcc has the -fPIC option ie: gcc -fPIC -Wall -I/usr/include/mysql -I. -shared lib

Pass a struct to an UDAF in spark

偶尔善良 提交于 2020-01-01 19:36:16
问题 I have the following schema - root |-- id:string (nullable = false) |-- age: long (nullable = true) |-- cars: struct (nullable = true) | |-- car1: string (nullable = true) | |-- car2: string (nullable = true) | |-- car3: string (nullable = true) |-- name: string (nullable = true) How can I pass the struct 'cars' to an udaf? What should be the inputSchema if i just want to pass the cars sub-struct. 回答1: You could, but the logic of the UDAF would be different. For example, if you have two rows:

Pass a struct to an UDAF in spark

被刻印的时光 ゝ 提交于 2020-01-01 19:35:49
问题 I have the following schema - root |-- id:string (nullable = false) |-- age: long (nullable = true) |-- cars: struct (nullable = true) | |-- car1: string (nullable = true) | |-- car2: string (nullable = true) | |-- car3: string (nullable = true) |-- name: string (nullable = true) How can I pass the struct 'cars' to an udaf? What should be the inputSchema if i just want to pass the cars sub-struct. 回答1: You could, but the logic of the UDAF would be different. For example, if you have two rows:

User Defined Functions in Excel and Speed Issues

馋奶兔 提交于 2020-01-01 10:53:31
问题 I have an Excel model that uses almost all UDFs. There are say, 120 columns and over 400 rows. The calculations are done vertically and then horizontally --- that is first all the calculations for column 1 are done, then the final output of column 1 is the input of column 2, etc. In each column I call about six or seven UDFs which call other UDFs. The UDFs often output an array. The inputs to each of the UDFs are a number of variables, some range variables, some doubles. The range variables

User Defined Functions in Excel and Speed Issues

坚强是说给别人听的谎言 提交于 2020-01-01 10:53:29
问题 I have an Excel model that uses almost all UDFs. There are say, 120 columns and over 400 rows. The calculations are done vertically and then horizontally --- that is first all the calculations for column 1 are done, then the final output of column 1 is the input of column 2, etc. In each column I call about six or seven UDFs which call other UDFs. The UDFs often output an array. The inputs to each of the UDFs are a number of variables, some range variables, some doubles. The range variables

MySQL Procedure within a Select?

别等时光非礼了梦想. 提交于 2020-01-01 05:19:05
问题 I have a procedure that works like this: mysql> call Ticket_FiscalTotals(100307); +---------+--------+----------+------------+------------+ | Service | Items | SalesTax | eTaxAmount | GrandTotal | +---------+--------+----------+------------+------------+ | 75.00 | 325.00 | 25.19 | 8.00 | 433.19 | +---------+--------+----------+------------+------------+ 1 row in set (0.08 sec) I would like to call this procedure from within a select, like so: SELECT Ticket.TicketID as `Ticket`, Ticket

PySpark 2.1: Importing module with UDF's breaks Hive connectivity

那年仲夏 提交于 2019-12-31 02:37:49
问题 I'm currently working with Spark 2.1 and have a main script that calls a helper module that contains all my transformation methods. In other words: main.py helper.py At the top of my helper.py file I have several custom UDFs that I have defined in the following manner: def reformat(s): return reformat_logic(s) reformat_udf = udf(reformat, StringType()) Before I broke off all the UDFs into the helper file, I was able to connect to my Hive metastore through my SparkSession object using spark