Class CountProductSalesWindowing
java.lang.Object
org.apache.flink.streaming.examples.dsv2.windowing.CountProductSalesWindowing
Example illustrating how to use Window to count the sales of each product in each hour by
DataStream API V2.
The input is a list of orders, each order is a consist of productId and orderTimestamp.
Usage:
--output <path>The output directory where the Job will write the results. If no output path is provided, the Job will print the results tostdout.
This example shows how to:
- Usage of Window extension in DataStream API V2
Please note that if you intend to run this example in an IDE, you must first add the following VM options: "--add-opens=java.base/java.util=ALL-UNNAMED". This is necessary because the module system in JDK 17+ restricts some reflection operations.
Please note that the DataStream API V2 is a new set of APIs, to gradually replace the original DataStream API. It is currently in the experimental stage and is not fully available for production.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCount sales quantity per product.static classPojo class for order.static classTheCountProductSalesWindowing.ProductSalesclass represents the count of product sales within one hour. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CountProductSalesWindowing
public CountProductSalesWindowing()
-
-
Method Details
-
main
- Throws:
Exception
-