Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flink
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leona
web
flink
Commits
1d7ea378
Commit
1d7ea378
authored
Oct 28, 2019
by
duanledexianxianxian
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync
parent
7bd5609d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
maven/src/main/java/com/duanledexianxianxian/maven/flink/HotItems.java
...n/java/com/duanledexianxianxian/maven/flink/HotItems.java
+33
-0
No files found.
maven/src/main/java/com/duanledexianxianxian/maven/flink/HotItems.java
0 → 100644
View file @
1d7ea378
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
()));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment