Commit 1d7ea378 authored by duanledexianxianxian's avatar duanledexianxianxian 😁

sync

parent 7bd5609d
package com.duanledexianxianxian.maven.flink;
import org.apache.flink.core.fs.Path;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
/**
* 热门商品推荐
*
* @author duanledexianxianxian
* <p>
* refer to https://github.com/wuchong/my-flink-project/blob/master/src/main/java/myflink/HotItems.java
* 根据淘宝提供的用户行为数据,分析每天topn热点商品
*/
public class HotItems {
public static void main(String[] args) throws URISyntaxException {
// 创建 execution environment
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// 告诉系统按照 EventTime 处理时间
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
// 为了打印到控制台的结果不乱序,我们配置全局的并发为1,改变并发对结果正确性没有影响
env.setParallelism(1);
// UserBehavior.csv 的本地文件路径, 在 resources 目录下
URL fileUrl = HotItems.class.getClassLoader().getResource("UserBehavior.csv");
Path filePath = Path.fromLocalFile(new File(fileUrl.toURI()));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment