user-defined-functions

Add Function Import not available for function

血红的双手。 提交于 2019-12-12 11:12:12
问题 I've added a function in my database and I wanted it to be callable in my code. For stored procedures I've right clicked on the SP and selected Add Function Import in Model Browser to achieve this, but this option is not available for my function. What can I do to import the function? 回答1: Database functions are not available for Function import. Function import works only with stored procedures. You must manually create stub function and mark it with EdmFunction attribute for database

User defined TYPE across databases

99封情书 提交于 2019-12-12 10:33:43
问题 I have a database that holds common functions that I use across multiple databases. One of these functions takes in a table as a parameter which is a user defined TYPE. I would like to know if there is a way to call this function from another database. I tried to define the type in the other database like so: DECLARE @bits as Common.dbo.Bits However I received an error too many prefixes I have tried adding the TYPE to each database, and then passing a table of that type to the function in the

VBA Public User Defined Function in Excel

自闭症网瘾萝莉.ら 提交于 2019-12-12 09:44:17
问题 I have created the function below: Option Explicit Public Function fyi(x As Double, f As String) As String Application.Volatile Dim data As Double Dim post(5) post(1) = "Ribu " post(2) = "Juta " post(3) = "Milyar " post(4) = "Trilyun " post(5) = "Ribu Trilyun " Dim part As String Dim text As String Dim cond As Boolean Dim i As Integer If (x < 0) Then fyi = " " Exit Function End If If (x = 0) Then fyi = "Nol" Exit Function End If If (x < 2000) Then cond = True End If text = " " If (x >= 1E+15)

Accessing external file in Python UDF

北城以北 提交于 2019-12-12 09:39:50
问题 I am using hive and a python udf. I defined a sql file in which I added the python udf and I call it. So far so good and I can process on my query results using my python function. However, at this point of time, I have to use an external .txt file in my python udf. I uploaded that file into my cluster (the same directory as .sql and .py file) and I also added that in my .sql file using this command: ADD FILE /home/ra/stopWords.txt; When I call this file in my python udf as this: file = open(

how to add a plot on top of another plot in matplotlib?

三世轮回 提交于 2019-12-12 09:06:25
问题 I have two files with data: datafile1 and datafile2, the first one always is present and the second one only sometimes. So the plot for the data on datafile2 is defined as a function (geom_macro) within my python script. At the end of the plotting code for the data on datafile1 I first test that datafile2 is present and if so, I call the defined function. But what I get in the case is present, is two separate figures and not one with the information of the second one on top of the other. That

Where can I find source of string.cpp

我与影子孤独终老i 提交于 2019-12-12 08:59:59
问题 I want to access source file of string.h . I mean the file which have definitions of all functions available in string.h . For example strcpy() is a function in string.h ; where can I get its definition, as string.h only gives prototypes of functions? 回答1: You didn't specify a developer tool - this answer is for Visual Studio 2008 on Windows. CRT sources can be found under: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\crt\src\ if it's installed at the default location. For other

Declare variable in table valued function

五迷三道 提交于 2019-12-12 07:08:15
问题 How can I declare a variable in a table valued function? (like in my title) 回答1: There are two flavors of table valued functions. One that is just a select statement and one that can have more rows than just a select statement. This can not have a variable: create function Func() returns table as return select 10 as ColName You have to do like this instead: create function Func() returns @T table(ColName int) as begin declare @Var int set @Var = 10 insert into @T(ColName) values (@Var) return

Computation with Futures avoiding Await method

☆樱花仙子☆ 提交于 2019-12-12 06:56:59
问题 I have funtion which is calling computeParallel() function which is calling 3 Futures F1,F2,F3 and returning String as return type. def computeParallel():String = { val f1 = Future { "ss" } val f2 = Future { "sss" } val f3 = Future { "ssss" } val result: Future[String] = for { r1 <- f1 r2 <- f2 r3 <- f3 } yield (r1 + r2 + r3) Await.result(result,scala.concurrent.duration.Duration.Inf) } Using Await to collect the Aggregated Results.But People are saying usage of Await is Bad way of coding. So

filter dataframe from external file

百般思念 提交于 2019-12-12 05:39:53
问题 i want to filter my dataframe from an external file. this is how my dataframe look like: val Insert=Append_Ot.filter(col("Name2").equalTo("brazil") || col("Name2").equalTo("france") || col("Name2").equalTo("algeria")|| col("Name2").equalTo("tunisia") || col("Name2").equalTo("egypte") ) The number of countries that i want to filter them is changeable, so created an external this file: 1 brazil 2 france 3 algeria 4 tunisia 5 egypte i want to create UDF to filter my dataframe from this file.

Google cloud Big query UDF limitations

只愿长相守 提交于 2019-12-12 04:32:17
问题 I am facing a problem in Google bigquery. I have some complex computation need to do and save the result in Bigquery. So we are doing that complex computation in Java and saving result in google bigquery with the help of Google cloud dataflow. But this complex calculation is taking around 28 min to complete in java. Customer requirement is to do within 20 sec. So we switch to Google bigquery UDF option. One option is Bigquery legacy UDF. Bigquery legacy UDF have limitation that it is