共用方式為


serialize 運算子

適用於:✅Microsoft網狀架構✅✅✅

標示輸入數據列集的順序可以安全地用於視窗函式。

運算符具有宣告式意義。 它會將輸入數據列集標示為串行化(已排序),以便 將視窗函式 套用至該數據列。

語法

serialize[Name1, Name2=Expr2]...]

深入瞭解 語法慣例

參數

姓名 類型​​ 必要 描述
名稱 string 要加入或更新的數據行名稱。 如果省略,則會自動產生輸出數據行名稱。
Expr string ✔️ 要對輸入執行的計算。

範例

本節中的範例示範如何使用 語法來協助您開始使用。

本文中的範例會使用 說明叢集中公開可用的數據表,例如 Samples 資料庫中的 StormEvents 數據表。

本文中的範例會使用公開可用的數據表,例如天氣分析中的 StormEvents 數據表,範例數據

依條件串行化數據列的子集

此查詢會從 TraceLogs 數據表擷取具有特定 ClientRequestId 的所有記錄專案,並在處理期間保留這些項目的順序。

TraceLogs
| where ClientRequestId == "5a848f70-9996-eb17-15ed-21b8eb94bf0e"
| serialize

輸出

此數據表只會顯示前 5 個查詢結果。

時間戳 節點 元件 ClientRequestId 消息
2014-03-08T12:24:55.5464757Z Engine000000000757 INGESTOR_GATEWAY 5a848f70-9996-eb17-15ed-21b8eb94bf0e $$IngestionCommand table=fogEvents format=json
2014-03-08T12:24:56.0929514Z Engine000000000757 下載程式 5a848f70-9996-eb17-15ed-21b8eb94bf0e 下載檔案路徑: “”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_0.json.gz"”
2014-03-08T12:25:40.3574831Z Engine000000000341 INGESTOR_EXECUTER 5a848f70-9996-eb17-15ed-21b8eb94bf0e IngestionCompletionEvent:完成擷取檔案路徑:“”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_0.json.gz"”
2014-03-08T12:25:40.9039588Z Engine000000000341 下載程式 5a848f70-9996-eb17-15ed-21b8eb94bf0e 下載檔案路徑: “”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_1.json.gz"”
2014-03-08T12:26:25.1684905Z Engine000000000057 INGESTOR_EXECUTER 5a848f70-9996-eb17-15ed-21b8eb94bf0e IngestionCompletionEvent:完成擷取檔案路徑:“”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_1.json.gz"”
... ... ... ... ...

將數據列編號新增至串行化數據表

若要將數據列編號加入串行化數據表,請使用 row_number() 函式。

TraceLogs
| where ClientRequestId == "5a848f70-9996-eb17-15ed-21b8eb94bf0e"
| serialize rn = row_number()

輸出

此數據表只會顯示前 5 個查詢結果。

時間戳 rn 節點 元件 ClientRequestId 消息
2014-03-08T13:00:01.6638235Z 1 Engine000000000899 INGESTOR_EXECUTER 5a848f70-9996-eb17-15ed-21b8eb94bf0e IngestionCompletionEvent:完成擷取檔案路徑:“”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_46.json.gz"”
2014-03-08T13:00:02.2102992Z 2 Engine000000000899 下載程式 5a848f70-9996-eb17-15ed-21b8eb94bf0e 下載檔案路徑: “”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_47.json.gz"”
2014-03-08T13:00:46.4748309Z 3 Engine000000000584 INGESTOR_EXECUTER 5a848f70-9996-eb17-15ed-21b8eb94bf0e IngestionCompletionEvent:完成擷取檔案路徑:“”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_47.json.gz"”
2014-03-08T13:00:47.0213066Z 4 Engine000000000584 下載程式 5a848f70-9996-eb17-15ed-21b8eb94bf0e 下載檔案路徑: “”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_48.json.gz"”
2014-03-08T13:01:31.2858383Z 5 Engine000000000380 INGESTOR_EXECUTER 5a848f70-9996-eb17-15ed-21b8eb94bf0e IngestionCompletionEvent:完成擷取檔案路徑:“”https://benchmarklogs3.blob.core.windows.net/benchmark/2014/IMAGINEFIRST0_1399_48.json.gz"”
... ... ... ... ...

運算符的串行化行為

下列運算子的輸出數據列集會標示為串行化。

下列運算子的輸出數據列集會標示為非串行化。

所有其他運算符都會保留串行化屬性。 如果輸入數據列集已串行化,則輸出數據列集也會串行化。