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
INSERT INTO dev_orders SELECT * FROM default_catalog.default_database.prod_orders;
151
156
```
152
157
153
-
* Go to Flink UI and show number of processed records.
154
-
158
+
* Show running job in Flink Web UI [http://localhost:8081](http://localhost:8081)
155
159
* Manually cancel the job
156
-
157
160
* Show file in Minio: [http://localhost:9000](http://localhost:9000)
158
-
159
161
* Show data in SQL client
160
162
161
163
```
@@ -165,7 +167,7 @@ SELECT COUNT(*) AS rowCnt FROM dev_orders;
165
167
166
168
### Run a Query on the Snapshotted Data
167
169
168
-
* Using the batch engine for better efficieny
170
+
* Using the batch engine for better efficiency
169
171
170
172
```
171
173
SET execution.type=batch;
@@ -185,7 +187,7 @@ GROUP BY
185
187
CEIL(o_ordertime TO MINUTE);
186
188
```
187
189
188
-
* Run the same in streaming
190
+
* Run the same query as a continuous streaming query
189
191
190
192
```
191
193
SET execution.type=streaming;
@@ -197,13 +199,6 @@ SET execution.type=streaming;
197
199
SET execution.result-mode=changelog;
198
200
```
199
201
200
-
* Reset to previous settings
201
-
202
-
```
203
-
SET execution.result-mode=table;
204
-
SET execution.type=batch;
205
-
```
206
-
207
202
* We can streamify the query a bit with a TUMBLE window
208
203
209
204
```
@@ -218,11 +213,17 @@ GROUP BY
218
213
TUMBLE(o_ordertime, INTERVAL '1' MINUTE);
219
214
```
220
215
221
-
* Query is still executed with the batch engine
216
+
* We can execute this query also with the batch engine
217
+
* Reset to previous settings
218
+
219
+
```
220
+
SET execution.result-mode=table;
221
+
SET execution.type=batch;
222
+
```
222
223
223
224
### Move query to streaming data
224
225
225
-
* We can run the same query on the dynamic table
226
+
* We can run the same query on the table backed by a Kafka topic
226
227
227
228
```
228
229
SET execution.type=streaming;
@@ -254,6 +255,10 @@ GROUP BY
254
255
SET execution.type=batch;
255
256
```
256
257
258
+
```
259
+
USE CATALOG hive;
260
+
```
261
+
257
262
* show customers and their orders by region and priority for a specific day
258
263
* query joins the snapshot of the orders table
259
264
@@ -284,13 +289,17 @@ ORDER BY r_name, o_orderpriority;
284
289
SET execution.type=streaming;
285
290
```
286
291
292
+
```
293
+
USE CATALOG default_catalog;
294
+
```
295
+
287
296
```
288
297
SELECT
289
298
r_name AS `region`,
290
299
o_orderpriority AS `priority`,
291
300
COUNT(DISTINCT c_custkey) AS `number_of_customers`,
292
301
COUNT(o_orderkey) AS `number_of_orders`
293
-
FROM default_catalog.default_database.prod_orders
302
+
FROM prod_orders
294
303
JOIN prod_customer ON o_custkey = c_custkey
295
304
JOIN prod_nation ON c_nationkey = n_nationkey
296
305
JOIN prod_region ON n_regionkey = r_regionkey
@@ -309,7 +318,6 @@ GROUP BY r_name, o_orderpriority;
309
318
310
319
* A common requirement is to join events of two (or more) dynamic tables that are related with each other in a temporal context, for example events that happened around the same time.
311
320
* Flink SQL features special optimizations for such joins.
312
-
313
321
* First switch to the default catalog (which contains all dynamic tables)
314
322
315
323
```
@@ -344,6 +352,10 @@ WHERE
344
352
345
353
* Example query: enrich `prod_lineitem` table with current exchange rate from `prod_rates` table to compute EUR-normalize amounts.
0 commit comments