Skip to content

Commit b2df20b

Browse files
authored
Merge pull request #312589 from spelluru/commonquery0304
Applies to Eventstream too
2 parents c3ad446 + 48ac396 commit b2df20b

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Query Language in Azure Stream Analytics and Microsoft Fabric Eventstream
3+
description: This file includes a note staging that Fabric Eventstream Query Language and Azure Stream Analytics Query Language are the same, and links to the built-in functions article.
4+
author: spelluru
5+
ms.service: azure-stream-analytics
6+
ms.topic: include
7+
ms.date: 03/09/2026
8+
ms.author: spelluru
9+
ms.custom: "include file"
10+
---
11+
12+
13+
> [!NOTE]
14+
> [Fabric Eventstream](/fabric/real-time-intelligence/event-streams/overview) is built on the same runtime as Azure Stream Analytics. Therefore, the concepts explained in this article are applicable to both Azure Stream Analytics and the Fabric Eventstream.

articles/stream-analytics/stream-analytics-stream-analytics-query-patterns.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
---
22
title: Common query patterns in Azure Stream Analytics
3-
description: This article describes several common query patterns and designs that are useful in Azure Stream Analytics jobs.
3+
description: This article describes several common query patterns and designs that are useful in Azure Stream Analytics jobs and Fabric Eventstream.
44
ms.service: azure-stream-analytics
55
ms.topic: how-to
6-
ms.date: 12/17/2024
6+
ms.date: 03/04/2026
77
ms.custom: devx-track-js
88
---
99

10-
# Common query patterns in Azure Stream Analytics
10+
# Common query patterns in Azure Stream Analytics and Fabric Eventstream
1111

12-
Queries in Azure Stream Analytics are expressed in an SQL-like query language. The language constructs are documented in the [Stream Analytics query language reference](/stream-analytics-query/stream-analytics-query-language-reference) guide.
12+
[!INCLUDE [stream-analytics-fabric-event-stream-query-language](./includes/stream-analytics-fabric-event-stream-query-language.md)]
13+
14+
Queries in Azure Stream Analytics are expressed in a SQL-like query language. The language constructs are documented in the [Stream Analytics query language reference](/stream-analytics-query/stream-analytics-query-language-reference) guide.
1315

1416
The query design can express simple pass-through logic to move event data from one input stream into an output data store, or it can do rich pattern matching and temporal analysis to calculate aggregates over various time windows as in the [Build an IoT solution by using Stream Analytics](stream-analytics-build-an-iot-solution-using-stream-analytics.md) guide. You can join data from multiple inputs to combine streaming events, and you can do lookups against static reference data to enrich the event values. You can also write data to multiple outputs.
1517

@@ -83,7 +85,7 @@ HAVING
8385
```
8486

8587

86-
The **INTO** clause tells the Stream Analytics service which of the outputs to write the data to. The first **SELECT** defines a pass-through query that receives data from the input and sends it to the output named **ArchiveOutput**. The second query aggregates and filters data before sending the results to a downstream alerting system output called **AlertOutput**.
88+
The **INTO** clause tells the Stream Analytics service, which of the outputs to write the data to. The first **SELECT** defines a pass-through query that receives data from the input and sends it to the output named **ArchiveOutput**. The second query aggregates and filters data before sending the results to a downstream alerting system output called **AlertOutput**.
8789

8890
The **WITH** clause can be used to define multiple subquery blocks. This option has the benefit of opening fewer readers to the input source.
8991

@@ -115,7 +117,7 @@ For more information, see [**WITH** clause](/stream-analytics-query/with-azure-s
115117

116118
## Simple pass-through query
117119

118-
A simple pass-through query can be used to copy the input stream data into the output. For example, if a stream of data containing real-time vehicle information needs to be saved in an SQL database for later analysis, a simple pass-through query does the job.
120+
A simple pass-through query can be used to copy the input stream data into the output. For example, if a stream of data containing real-time vehicle information needs to be saved in a SQL database for later analysis, a simple pass-through query does the job.
119121

120122
Consider the following **input**:
121123

@@ -434,7 +436,7 @@ WHERE
434436
LAG(Make, 1) OVER (LIMIT DURATION(second, 90)) = Make
435437
```
436438

437-
The **LAG** function can look into the input stream one event back and retrieve the *Make* value, comparing that with the *Make* value of the current event. Once the condition is met, data from the previous event can be projected using **LAG** in the **SELECT** statement.
439+
The **LAG** function can look into the input stream one event back and retrieve the *Make* value, comparing that with the *Make* value of the current event. Once the condition is met, data from the previous event can be projected using **LAG** in the **SELECT** statement.
438440

439441
For more information, see [LAG](/stream-analytics-query/lag-azure-stream-analytics).
440442

@@ -851,6 +853,9 @@ For more information on SessionWindow, see [Session Window](/stream-analytics-qu
851853

852854
## User defined functions in JavaScript and C#
853855

856+
> [!NOTE]
857+
> This section doesn't apply to Fabric Eventstream.
858+
854859
Azure Stream Analytics query language can be extended with custom functions written either in JavaScript or C# language. User Defined Functions (UDF) are custom/complex computations that can’t be easily expressed using the **SQL** language. These UDFs can be defined once and used multiple times within a query. For example, an UDF can be used to convert a hexadecimal *nvarchar(max)* value to a *bigint* value.
855860

856861
Sample **input**:
@@ -945,14 +950,14 @@ MATCH_RECOGNIZE (
945950

946951
This query matches at least two consecutive failure events and generates an alarm when the conditions are met.
947952
**PATTERN** defines the regular expression to be used on the matching, in this case, at least two consecutive warnings after at least one successful operation.
948-
Success and Warning are defined using Return_Code value and once the condition is met, the **MEASURES** are projected with *ATM_id*, the first warning operation and first warning time.
953+
Success and Warning are defined using Return_Code value and once the condition is met. The MEASURES** are projected with *ATM_id*, the first warning operation, and first warning time.
949954

950955
For more information, see [MATCH_RECOGNIZE](/stream-analytics-query/match-recognize-stream-analytics).
951956

952957
## Geofencing and geospatial queries
953958

954959
Azure Stream Analytics provides built-in geospatial functions that can be used to implement scenarios such as fleet management, ride sharing, connected cars, and asset tracking.
955-
Geospatial data can be ingested in either GeoJSON or WKT formats as part of event stream or reference data.
960+
Geospatial data can be ingested in either GeoJSON or WKT formats as part of eventstream or reference data.
956961
For example, a company that is specialized in manufacturing machines for printing passports, leases their machines to governments and consulates. The location of those machines is heavily controlled as to avoid the misplacing and possible use for counterfeiting of passports. Each machine is fitted with a GPS tracker, that information is relayed back to an Azure Stream Analytics job.
957962
The manufacture would like to keep track of the location of those machines and be alerted if one of them leaves an authorized area, this way they can remotely disable, alert authorities and retrieve the equipment.
958963

0 commit comments

Comments
 (0)