udf

Alter code to Remove instead of Allow characters

时光总嘲笑我的痴心妄想 提交于 2019-12-24 17:53:20
问题 The function allows the character listed (in this case) Case 48 To 57, 65 To 90, 97 To 122: Is it possible to change this to Remove the characters listed instead? Thanks Function AlphaNumericOnly(strSource As String) As String Dim i As Integer Dim strResult As String For i = 1 To Len(strSource) Select Case Asc(Mid(strSource, i, 1)) Case 48 To 57, 65 To 90, 97 To 122: strResult = strResult & Mid(strSource, i, 1) End Select Next AlphaNumericOnly = strResult End Function 回答1: If you intend to

Force UDF in VBA to display a MsgBox when the user enters more than expected arguments?

雨燕双飞 提交于 2019-12-24 00:52:45
问题 When the user enters too many arguments for the COUNTBLANK function,the function displays this error message, and returns to edit mode: You've entered too many arguments for this function. How to make any UDF work like that? For example: Function COUNT2 (c As Range) COUNT2 = c.Count End Function By default this UDF returns #VALUE! error when the user enters more than one argument. How to make it work like the COUNTBLANK function? 回答1: We can only simulate the behavior to some extent, but it

How to return complex types using spark UDFs

北慕城南 提交于 2019-12-23 11:51:23
问题 Hello and thank you in advance. My program is written in java and i can not move to scala. I am currently working with a spark DataFrame extracted from a json file using the following line: DataFrame dff = sqlContext.read().json("filePath.son"); SQLContext and SparkContext are correctly initialzied and running perfectly. The problem is the json i'm reading from has nested structs, and I want to clean/verify the inner data, without changing the schema. One of the dataframe's columns in

bigquery udf out of memory issues

天大地大妈咪最大 提交于 2019-12-23 04:43:54
问题 When running a relatively simple UDF on a dataset in Google's BigQuery, I have run into the following error: Resources exceeded during query execution: UDF out of memory. Running the UDF on a single row, or even 3 rows, the function works fine, and outputs ca. 150,000 rows per UDF run to a separate table. An example which ran on 2 rows and produced output has job-ID broad-cga-het:bquijob_48bd79dc_155ffe83f48. However, when running the UDF on 5+ rows, the function fails. An example for which

Spark - Java UDF returning multiple columns

时光毁灭记忆、已成空白 提交于 2019-12-22 17:46:28
问题 I'm using sparkSql 1.6.2 (Java API) and I have to process the following DataFrame that has a list of value in 2 columns: ID AttributeName AttributeValue 0 [an1,an2,an3] [av1,av2,av3] 1 [bn1,bn2] [bv1,bv2] The desired table is: ID AttributeName AttributeValue 0 an1 av1 0 an2 av2 0 an3 av3 1 bn1 bv1 1 bn2 bv2 I think I have to use a combination of the explode function and a custom UDF function. I found the following resources: Explode (transpose?) multiple columns in Spark SQL table How do I

Spark - Java UDF returning multiple columns

半城伤御伤魂 提交于 2019-12-22 17:46:15
问题 I'm using sparkSql 1.6.2 (Java API) and I have to process the following DataFrame that has a list of value in 2 columns: ID AttributeName AttributeValue 0 [an1,an2,an3] [av1,av2,av3] 1 [bn1,bn2] [bv1,bv2] The desired table is: ID AttributeName AttributeValue 0 an1 av1 0 an2 av2 0 an3 av3 1 bn1 bv1 1 bn2 bv2 I think I have to use a combination of the explode function and a custom UDF function. I found the following resources: Explode (transpose?) multiple columns in Spark SQL table How do I

Register UDF with descriptions of arguments using excel addin

回眸只為那壹抹淺笑 提交于 2019-12-19 21:22:03
问题 I have an addin with an UDF getRegExResult . I want to add a function description and arguments descriptions to this function, so when user installs the addin, closes, opens excel few times and goes to "Insert Function" Dialog box he will be able to find the function with description of the arguments. The same is asked here. I found one answer that suits my needs. Except... I want to be able to do this through an Excel Addin. My idea is to put call into addin workbook_open event like so:

Register UDF with descriptions of arguments using excel addin

白昼怎懂夜的黑 提交于 2019-12-19 21:20:23
问题 I have an addin with an UDF getRegExResult . I want to add a function description and arguments descriptions to this function, so when user installs the addin, closes, opens excel few times and goes to "Insert Function" Dialog box he will be able to find the function with description of the arguments. The same is asked here. I found one answer that suits my needs. Except... I want to be able to do this through an Excel Addin. My idea is to put call into addin workbook_open event like so:

SQL Server中的功能与存储过程

若如初见. 提交于 2019-12-19 17:58:03
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我学习函数和存储过程已经有一段时间了,但是我不知道为什么以及何时应该使用函数或存储过程。 在我看来,它们看起来一样,也许是因为我对此有些新手。 有人可以告诉我为什么吗? #1楼 函数可以用在select语句中,而过程则不能。 存储过程同时接受输入和输出参数,而功能仅接受输入参数。 函数无法在过程可以的地方返回text,ntext,image和timestamps类型的值。 函数可以在创建表中用作用户定义的数据类型,但过程不能。 ***例如:-创建 table <tablename>(name varchar(10),salary getsal(name)) 这里的getsal是一个用户定义的函数,它返回一个薪金类型,在创建表时没有为薪金类型分配存储空间,也没有执行getsal函数,但是当我们从该表中获取某些值时,将执行getsal函数get和return类型作为结果集返回。 #2楼 函数是计算值,不能对SQL Server进行永久的环境更改(即,不允许INSERT或UPDATE语句)。 如果函数返回标量值,则可以在SQL语句中内联使用;如果返回结果集,则可以将其加入。 注释总结了答案,这一点值得一提。 感谢 @Sean K Anderson: 函数遵循计算机科学的定义,因为它们必须返回一个值

DataLakeAnalytics: 解析IP地址对应的国家城市地址的能力

萝らか妹 提交于 2019-12-14 11:51:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Data Lake Analytics 作为云上数据处理的枢纽,最近加入了通过IP地址查找对应的国家、省份、城市、ISP的函数, 今天带大家体验一下。 函数详细介绍 本次一共添加了下面这些函数: ip2region : 功能最全的函数,可以获取国家,省份,城市的信息,而且支持语言切换, 但是参数较多。 ip_country : 获取IP地址对应的国家。 ip_province : 获取IP地址对应的地址/省。 ip_city : 获取IP地址对应的城市。 ip_isp : 获取IP地址对应的ISP(Internet Service Provider)的信息。 ip2long : 把IP地址转换成一个数字。 long2ip : 把数字转换成一个IP地址。 ip2region ip2region(ip, level, lang) 参数详解: ip: 要查询的IP地址 level: country/province/city/isp lang: cn/en, 返回结果的语言 ip_country/ip_province/ip_city/ip_isp ip_country/ip_province/ip_city/ip_isp是ip2region的一种快捷用法,参数较少,这几个函数风格类似,两种调用方式: ip