Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-screen
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
byit-screen
Commits
91204328
Commit
91204328
authored
Jul 11, 2019
by
lichaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结构更改
parent
37951b90
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
Test1.java
byit-screen-computer/src/test/java/com/byit/Test1.java
+7
-8
BuildOutputTupleMapFunction.java
.../test/java/com/byit/test/BuildOutputTupleMapFunction.java
+1
-0
RandomFibonacciSource.java
...er/src/test/java/com/byit/test/RandomFibonacciSource.java
+1
-2
No files found.
byit-screen-computer/src/test/java/com/byit/Test1.java
View file @
91204328
...
@@ -17,21 +17,20 @@ public class Test1 {
...
@@ -17,21 +17,20 @@ public class Test1 {
DataStream
<
Tuple2
<
Integer
,
Integer
>>
inputStream
=
env
.
addSource
(
new
RandomFibonacciSource
());
DataStream
<
Tuple2
<
Integer
,
Integer
>>
inputStream
=
env
.
addSource
(
new
RandomFibonacciSource
());
IterativeStream
<
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>>
iterativeStream
=
IterativeStream
<
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>>
iterativeStream
=
inputStream
.
map
(
new
TupleTransformMapFunction
()).
iterate
(
5000
);
inputStream
.
map
(
new
TupleTransformMapFunction
()).
iterate
(
5000
0
);
//2->5 last:0
DataStream
<
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>>
fibonacciStream
=
DataStream
<
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>>
fibonacciStream
=
iterativeStream
.
map
(
new
FibonacciCalcStepFunction
());
iterativeStream
.
map
(
new
FibonacciCalcStepFunction
());
//斐波那契额Step,算法
SplitStream
<
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>>
branchedStream
=
SplitStream
<
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>>
branchedStream
=
fibonacciStream
.
split
(
new
FibonacciOverflowSelector
());
fibonacciStream
.
split
(
new
FibonacciOverflowSelector
());
//限制条件
iterativeStream
.
closeWith
(
branchedStream
.
select
(
"ITERATE_FLAG"
));
iterativeStream
.
closeWith
(
branchedStream
.
select
(
"ITERATE_FLAG"
));
//下次递归数据total
/*
DataStream<Tuple3<Integer, Integer, Integer>> outputStream = branchedStream
DataStream
<
Tuple3
<
Integer
,
Integer
,
Integer
>>
outputStream
=
branchedStream
.select("OUTPUT_FLAG").map(new BuildOutputTupleMapFunction());
.
select
(
"OUTPUT_FLAG"
).
map
(
new
BuildOutputTupleMapFunction
());
//本次输出
outputStream.print();*/
outputStream
.
print
();
inputStream
.
print
();
env
.
execute
(
"Streaming Iteration Example"
);
env
.
execute
(
"Streaming Iteration Example"
);
}
}
...
...
byit-screen-computer/src/test/java/com/byit/test/BuildOutputTupleMapFunction.java
View file @
91204328
...
@@ -9,6 +9,7 @@ public class BuildOutputTupleMapFunction extends RichMapFunction<
...
@@ -9,6 +9,7 @@ public class BuildOutputTupleMapFunction extends RichMapFunction<
Tuple3
<
Integer
,
Integer
,
Integer
>>
{
Tuple3
<
Integer
,
Integer
,
Integer
>>
{
@Override
@Override
public
Tuple3
<
Integer
,
Integer
,
Integer
>
map
(
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>
inputTuple
)
throws
Exception
{
public
Tuple3
<
Integer
,
Integer
,
Integer
>
map
(
Tuple5
<
Integer
,
Integer
,
Integer
,
Integer
,
Integer
>
inputTuple
)
throws
Exception
{
System
.
out
.
println
(
"output:"
+
inputTuple
.
f0
+
","
+
inputTuple
.
f1
+
","
+
inputTuple
.
f4
);
return
new
Tuple3
<
Integer
,
Integer
,
Integer
>(
return
new
Tuple3
<
Integer
,
Integer
,
Integer
>(
inputTuple
.
f0
,
inputTuple
.
f0
,
inputTuple
.
f1
,
inputTuple
.
f1
,
...
...
byit-screen-computer/src/test/java/com/byit/test/RandomFibonacciSource.java
View file @
91204328
...
@@ -16,8 +16,7 @@ public class RandomFibonacciSource implements SourceFunction<Tuple2<Integer, Int
...
@@ -16,8 +16,7 @@ public class RandomFibonacciSource implements SourceFunction<Tuple2<Integer, Int
int
first
=
random
.
nextInt
(
MAX_RANDOM_VALUE
/
2
-
1
)
+
1
;
int
first
=
random
.
nextInt
(
MAX_RANDOM_VALUE
/
2
-
1
)
+
1
;
int
second
=
random
.
nextInt
(
MAX_RANDOM_VALUE
/
2
-
1
)
+
1
;
int
second
=
random
.
nextInt
(
MAX_RANDOM_VALUE
/
2
-
1
)
+
1
;
if
(
first
>
second
)
continue
;
System
.
out
.
println
(
"s:"
+
counter
+
":"
+
first
+
","
+
second
);
System
.
out
.
println
(
"0->2:"
+
first
+
","
+
second
);
ctx
.
collect
(
new
Tuple2
<
Integer
,
Integer
>(
first
,
second
));
ctx
.
collect
(
new
Tuple2
<
Integer
,
Integer
>(
first
,
second
));
counter
++;
counter
++;
Thread
.
sleep
(
50
);
Thread
.
sleep
(
50
);
...
...
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