You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/stream-analytics/stream-analytics-twitter-sentiment-analysis-trends.md
+12-24Lines changed: 12 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,44 +177,32 @@ Now that tweet events are streaming in real time from Twitter, you can set up a
177
177
178
178
## Specify the job query
179
179
180
-
Stream Analytics supports a simple, declarative query model that describes transformations. To learn more about the language, see the [Azure Stream Analytics Query Language Reference](https://docs.microsoft.com/stream-analytics-query/stream-analytics-query-language-reference). This how-to guide helps you author and test several queries over Twitter data.
180
+
Stream Analytics supports a simple, declarative query model that describes transformations. To learn more about the language, see the [Azure Stream Analytics Query Language Reference](https://docs.microsoft.com/stream-analytics-query/stream-analytics-query-language-reference). This how-to guide helps you author and test several queries over Twitter data.
181
181
182
182
To compare the number of mentions among topics, you can use a [Tumbling window](https://docs.microsoft.com/stream-analytics-query/tumbling-window-azure-stream-analytics) to get the count of mentions by topic every five seconds.
183
183
184
184
1. In your job **Overview**, select **Edit query** near the top right of the Query box. Azure lists the inputs and outputs that are configured for the job and lets you create a query to transform the input stream as it is sent to the output.
185
185
186
-
2.In the **Query** page, click the dots next to the `TwitterStream` input and then select **Sample data from input**.
186
+
2.Change the query in the query editor to the following:
187
187
188
-

189
-
190
-
This opens a blade that lets you specify how much sample data to get, defined in terms of how long to read the input stream.
191
-
192
-
4. Set **Minutes** to 3 and then click **OK**.
193
-
194
-

188
+
```sql
189
+
SELECT*
190
+
FROM TwitterStream
191
+
```
195
192
196
-
Azure samples 3 minutes' worth of data from the input stream and notifies you when the sample datais ready. (This takes a short while.)
193
+
3. Event data from the messages should appear in the **Input preview** window below your query. Ensure the **View** is set to **JSON**. If you do not see any data, ensure that your data generator is sending events to your event hub, and that you've selected **GZip** as the compression type for the input.
197
194
198
-
The sample data is stored temporarily and is available while you have the query window open. If you close the query window, the sample data is discarded, and you have to create a new set of sample data.
195
+
4. Select **Test query**and notice the results in the **Test results**window below your query.
199
196
200
-
5. Change the query in the code editor to the following:
197
+
5. Change the query in the code editor to the following and select **Test query**:
201
198
202
-
```
203
-
SELECT System.Timestamp as Time, Topic, COUNT(*)
199
+
```sql
200
+
SELECTSystem.TimestampasTime, Topic, COUNT(*)
204
201
FROM TwitterStream TIMESTAMP BY CreatedAt
205
202
GROUP BY TUMBLINGWINDOW(s, 5), Topic
206
203
```
207
204
208
-
If didn't use `TwitterStream` as the alias for the input, substitute your alias for `TwitterStream` in the query.
209
-
210
-
This query uses the **TIMESTAMP BY** keyword to specify a timestamp field in the payload to be used in the temporal computation. If this field isn't specified, the windowing operation is performed by using the time that each event arrived at the event hub. Learn more in the "Arrival Time vs Application Time" section of [Stream Analytics Query Reference](https://docs.microsoft.com/stream-analytics-query/stream-analytics-query-language-reference).
211
-
212
-
This query also accesses a timestamp for the end of each window by using the **System.Timestamp** property.
213
-
214
-
5. Click **Test**. The query runs against the data that you sampled.
215
-
216
-
6. Click **Save**. This saves the query as part of the Streaming Analytics job. (It doesn't save the sample data.)
217
-
205
+
6.
218
206
219
207
## Experiment using different fields from the stream
0 commit comments