簡體   English   中英

如何在 Stream 分析查詢中連接查詢的所有結果?

[英]How to concat all the results of a query in Stream Analytics Query?

我有來自 IoT 中心的輸入和來自 Blob 存儲的參考輸入。 我想將我在將 IoTHubInput.id 與 BlobStorageInput.id 匹配時找到的所有結果連接起來。

目前,查詢如下所示:

   SELECT Blob
   FROM iothub IoTHub
   JOIN blob Blob
   ON IoTHub.id = Blob.deviceId

此查詢的結果如下所示:

[
  {
    "blob": 
    {
        "deviceId": "test001",
        "data": "Sample1"
    }
  },
  {
    "blob": 
    {
        "deviceId": "test002",
        "data": "Sample2"
    }
  },
  {
    "blob": 
    {
        "deviceId": "test003",
        "data": "Sample3"
    }
  },
]

它會向我的 output 返回 3 條消息,但我不希望這樣。

如果 id 匹配,我想要 blob 中的所有數據,但我實際上想要它們全部 CONCAT 並成為一個數組。 例如:

[
    {
        "deviceId": "test001",
        "data": "Sample1"
    },
    {
        "deviceId": "test002",
        "data": "Sample2"
    },
    {
        "deviceId": "test003",
        "data": "Sample3"
    }
]

我在互聯網上搜索並找到了GROUP CONCAT但是 Stream Analytics 不支持。 是否有任何其他替代解決方法可以實現相同的效果?

我重現您的測試數據:

在此處輸入圖像描述

據我所知,ASA 中沒有GROUP CONCAT功能。 實際上,ASA的output已經是一個數組了。您可以在下載結果中驗證:

在此處輸入圖像描述

我用 Blob output 進行了測試,它顯示為數組。 If your output produces 3 rows,I suggest you using Azure Function Output to accept the array first then do next transfer steps.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM