You can use the mv-apply
operator to apply your user-defined function to every row of your table, and then use the toscalar()
function to convert the resulting array back to a scalar value. Here's an example:
Suppose you have a table called MyTable
with columns Col1
and Col2
, and you want to apply a user-defined function myFunction()
to every row of this table. Here's how you can do it:
MyTable
| mv-apply myFunction() on (Col1, Col2)
| extend Result = toscalar(Result)
The mv-apply
operator applies myFunction()
to every row of the table, using the values in columns Col1
and Col2
as arguments. This will create a new column called Result
which contains an array with the results of the function for each row.
The extend
operator is then used to create a new column called Result
which contains the scalar value in the Result
array. The toscalar()
function is used here to convert the array to a scalar value.
Note that you'll need to modify the mv-apply
expression to match your specific user-defined function and table columns.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-31 02:21:41 +0000
Seen: 9 times
Last updated: May 31 '23
In SCSS, what is the method for grouping and reusing a set of classes and styles?
What is the method to distinguish the presence of a json field in an array using presto?
What is Nextflow for genomics in AWS?
What does "waiting for handler commit" mean in relation to the slow writes experienced in MySQL 8?
What is the best way to arrange the file structure for both the backend and frontend in MERN?
What are the differences between EJS/Handlebars and Nextjs?
How can a Python function (REFPROP 9.1) be turned into a vectorized version?