在发送到UDA功能之前如何订购数据? [英] How to order data before sending to a UDA function?

查看:127
本文介绍了在发送到UDA功能之前如何订购数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个天蓝色的流分析查询.它正在联接2个输入,并且需要作为用户定义的聚合函数的输入.在UDA函数中,我需要对传入的行进行一些字符串连接,并输出一个最终的字符串.所以命令 或连接中的行很重要,要按字符串之一作为列的顺序.

I have an azure stream analytics query. It is joining 2 inputs and that needs to be the input of a user defined aggregate function. In the UDA function, I need to do some string concatenation of the incoming rows and output one final string. So the order or the rows from the join is important to be in order of one of the columns which is a string.

由于在视图中不能使用order by,并且调用UDA的格式是通过视图,因此如何将有序数据发送到UDA.以下是我的代码段

Since order by cannot be used in views, and the format for calling a UDA is through the view, how can I send ordered data to the UDA. The following is my code snippet

CalcData AS
(
SELECT
  x.fqn AS fqn,      
  x.value as xvalue,
  y.value as yvalue,
  x.time as time
FROM (select fqn
,value, time from DataInput1 ) y
join
(SELECT
fqn as fqn,
value as value,
  time as time
FROM DataInput2 ) x on y.time=x.time and x.fqn=y.fqn and DATEDIFF(second, x, y) = 0
--order by time asc, fqn
),
FormatData AS
(
SELECT UDA.svgstring(CalcData) AS v,
time    FROM CalcData
GROUP BY time,TumblingWindow(minute, 1)
)

CalcData AS
(
SELECT
  x.fqn AS fqn,      
  x.value as xvalue,
  y.value as yvalue,
  x.time as time
FROM (select fqn
,value, time from DataInput1 ) y
join
(SELECT
fqn as fqn,
value as value,
  time as time
FROM DataInput2 ) x on y.time=x.time and x.fqn=y.fqn and DATEDIFF(second, x, y) = 0
--order by time asc, fqn
),
FormatData AS
(
SELECT UDA.svgstring(CalcData) AS v,
time    FROM CalcData
GROUP BY time,TumblingWindow(minute, 1)
)

任何帮助将不胜感激

推荐答案

我尝试过

CalcData AS
(
SELECT TOP 10000
   x.fqn AS fqn,      
  x.value as xvalue,
  y.value as yvalue,
  x.time as time
FROM (select fqn
,value, time from DataInput1 ) y
join
(SELECT
fqn as fqn,
value as value,
  time as time
FROM DataInput2 ) x on y.time=x.time and x.fqn=y.fqn and DATEDIFF(second, x, y) = 0
 order by time, fqn
),
FormatData AS
(
SELECT UDA.svgstring(CalcData) AS v,
time    FROM CalcData
GROUP BY time,TumblingWindow(minute, 1)
)

CalcData AS
(
SELECT TOP 10000
   x.fqn AS fqn,      
  x.value as xvalue,
  y.value as yvalue,
  x.time as time
FROM (select fqn
,value, time from DataInput1 ) y
join
(SELECT
fqn as fqn,
value as value,
  time as time
FROM DataInput2 ) x on y.time=x.time and x.fqn=y.fqn and DATEDIFF(second, x, y) = 0
 order by time, fqn
),
FormatData AS
(
SELECT UDA.svgstring(CalcData) AS v,
time    FROM CalcData
GROUP BY time,TumblingWindow(minute, 1)
)

但顺序似乎没有生效


这篇关于在发送到UDA功能之前如何订购数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆