Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
d4d8c40c
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d4d8c40c
编写于
7月 14, 2014
作者:
G
gyfora
提交者:
Stephan Ewen
8月 18, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[streaming] updated fields partitioning api
上级
5030bec4
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
25 addition
and
61 deletion
+25
-61
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/api/JobGraphBuilder.java
...n/java/eu/stratosphere/streaming/api/JobGraphBuilder.java
+1
-5
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/api/streamcomponent/StreamComponentHelper.java
.../streaming/api/streamcomponent/StreamComponentHelper.java
+3
-6
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/batch/wordcount/BatchWordCountLocal.java
...reaming/examples/batch/wordcount/BatchWordCountLocal.java
+1
-3
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/cellinfo/CellInfoLocal.java
...ratosphere/streaming/examples/cellinfo/CellInfoLocal.java
+5
-8
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/window/wordcount/WindowWordCountLocal.java
...aming/examples/window/wordcount/WindowWordCountLocal.java
+1
-3
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/wordcount/WordCountLocal.java
...tosphere/streaming/examples/wordcount/WordCountLocal.java
+1
-2
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/wordcount/WordCountRemote.java
...osphere/streaming/examples/wordcount/WordCountRemote.java
+1
-2
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/partitioner/FieldsPartitioner.java
...stratosphere/streaming/partitioner/FieldsPartitioner.java
+3
-18
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/faulttolerance/AtLeastOnceBufferTest.java
...phere/streaming/faulttolerance/AtLeastOnceBufferTest.java
+4
-2
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/faulttolerance/ExactlyOnceBufferTest.java
...phere/streaming/faulttolerance/ExactlyOnceBufferTest.java
+4
-2
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/faulttolerance/FaultToleranceUtilTest.java
...here/streaming/faulttolerance/FaultToleranceUtilTest.java
+0
-8
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/partitioner/FieldsPartitionerTest.java
...tosphere/streaming/partitioner/FieldsPartitionerTest.java
+1
-2
未找到文件。
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/api/JobGraphBuilder.java
浏览文件 @
d4d8c40c
...
...
@@ -236,8 +236,7 @@ public class JobGraphBuilder {
* Class of the key Value stored in the record
*/
//TODO: remove unused third parameter
public
void
fieldsConnect
(
String
upStreamComponentName
,
String
downStreamComponentName
,
int
keyPosition
,
Class
<?
extends
Key
>
keyClass
)
{
public
void
fieldsConnect
(
String
upStreamComponentName
,
String
downStreamComponentName
,
int
keyPosition
)
{
AbstractJobVertex
upStreamComponent
=
components
.
get
(
upStreamComponentName
);
AbstractJobVertex
downStreamComponent
=
components
.
get
(
downStreamComponentName
);
...
...
@@ -250,9 +249,6 @@ public class JobGraphBuilder {
config
.
setClass
(
"partitionerClass_"
+
(
upStreamComponent
.
getNumberOfForwardConnections
()
-
1
),
FieldsPartitioner
.
class
);
config
.
setClass
(
"partitionerClassParam_"
+
(
upStreamComponent
.
getNumberOfForwardConnections
()
-
1
),
keyClass
);
config
.
setInteger
(
"partitionerIntParam_"
+
(
upStreamComponent
.
getNumberOfForwardConnections
()
-
1
),
keyPosition
);
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/api/streamcomponent/StreamComponentHelper.java
浏览文件 @
d4d8c40c
...
...
@@ -42,8 +42,6 @@ import eu.stratosphere.streaming.faulttolerance.FailEventListener;
import
eu.stratosphere.streaming.faulttolerance.FaultToleranceUtil
;
import
eu.stratosphere.streaming.partitioner.DefaultPartitioner
;
import
eu.stratosphere.streaming.partitioner.FieldsPartitioner
;
import
eu.stratosphere.types.Key
;
import
eu.stratosphere.types.StringValue
;
public
final
class
StreamComponentHelper
<
T
extends
AbstractInvokable
>
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
StreamComponentHelper
.
class
);
...
...
@@ -171,11 +169,10 @@ public final class StreamComponentHelper<T extends AbstractInvokable> {
if
(
partitioner
.
equals
(
FieldsPartitioner
.
class
))
{
int
keyPosition
=
taskConfiguration
.
getInteger
(
"partitionerIntParam_"
+
nrOutput
,
1
);
Class
<?
extends
Key
>
keyClass
=
taskConfiguration
.
getClass
(
"partitionerClassParam_"
+
nrOutput
,
StringValue
.
class
,
Key
.
class
);
partitioners
.
add
(
partitioner
.
getConstructor
(
int
.
class
,
Class
.
class
).
newInstance
(
keyPosition
,
keyClass
));
partitioners
.
add
(
partitioner
.
getConstructor
(
int
.
class
).
newInstance
(
keyPosition
));
}
else
{
partitioners
.
add
(
partitioner
.
newInstance
());
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/batch/wordcount/BatchWordCountLocal.java
浏览文件 @
d4d8c40c
...
...
@@ -25,7 +25,6 @@ import eu.stratosphere.configuration.Configuration;
import
eu.stratosphere.nephele.jobgraph.JobGraph
;
import
eu.stratosphere.streaming.api.JobGraphBuilder
;
import
eu.stratosphere.streaming.util.LogUtils
;
import
eu.stratosphere.types.StringValue
;
public
class
BatchWordCountLocal
{
...
...
@@ -37,8 +36,7 @@ public class BatchWordCountLocal {
graphBuilder
.
setSink
(
"BatchWordCountSink"
,
BatchWordCountSink
.
class
);
graphBuilder
.
shuffleConnect
(
"BatchWordCountSource"
,
"BatchWordCountSplitter"
);
graphBuilder
.
fieldsConnect
(
"BatchWordCountSplitter"
,
"BatchWordCountCounter"
,
0
,
StringValue
.
class
);
graphBuilder
.
fieldsConnect
(
"BatchWordCountSplitter"
,
"BatchWordCountCounter"
,
0
);
graphBuilder
.
shuffleConnect
(
"BatchWordCountCounter"
,
"BatchWordCountSink"
);
return
graphBuilder
.
getJobGraph
();
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/cellinfo/CellInfoLocal.java
浏览文件 @
d4d8c40c
...
...
@@ -25,7 +25,6 @@ import eu.stratosphere.configuration.Configuration;
import
eu.stratosphere.nephele.jobgraph.JobGraph
;
import
eu.stratosphere.streaming.api.JobGraphBuilder
;
import
eu.stratosphere.streaming.util.LogUtils
;
import
eu.stratosphere.types.IntValue
;
public
class
CellInfoLocal
{
...
...
@@ -36,9 +35,8 @@ public class CellInfoLocal {
graphBuilder
.
setTask
(
"cellTask"
,
CellTask
.
class
,
3
);
graphBuilder
.
setSink
(
"sink"
,
CellSink
.
class
);
graphBuilder
.
fieldsConnect
(
"infoSource"
,
"cellTask"
,
0
,
IntValue
.
class
);
graphBuilder
.
fieldsConnect
(
"querySource"
,
"cellTask"
,
0
,
IntValue
.
class
);
graphBuilder
.
fieldsConnect
(
"infoSource"
,
"cellTask"
,
0
);
graphBuilder
.
fieldsConnect
(
"querySource"
,
"cellTask"
,
0
);
graphBuilder
.
shuffleConnect
(
"cellTask"
,
"sink"
);
return
graphBuilder
.
getJobGraph
();
...
...
@@ -63,8 +61,7 @@ public class CellInfoLocal {
exec
.
start
();
Client
client
=
new
Client
(
new
InetSocketAddress
(
"localhost"
,
6498
),
configuration
);
Client
client
=
new
Client
(
new
InetSocketAddress
(
"localhost"
,
6498
),
configuration
);
client
.
run
(
jG
,
true
);
...
...
@@ -72,8 +69,8 @@ public class CellInfoLocal {
}
else
if
(
args
[
0
].
equals
(
"cluster"
))
{
System
.
out
.
println
(
"Running in Cluster2 mode"
);
Client
client
=
new
Client
(
new
InetSocketAddress
(
"hadoop02.ilab.sztaki.hu"
,
6123
),
configuration
);
Client
client
=
new
Client
(
new
InetSocketAddress
(
"hadoop02.ilab.sztaki.hu"
,
6123
),
configuration
);
client
.
run
(
jG
,
true
);
}
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/window/wordcount/WindowWordCountLocal.java
浏览文件 @
d4d8c40c
...
...
@@ -25,7 +25,6 @@ import eu.stratosphere.configuration.Configuration;
import
eu.stratosphere.nephele.jobgraph.JobGraph
;
import
eu.stratosphere.streaming.api.JobGraphBuilder
;
import
eu.stratosphere.streaming.util.LogUtils
;
import
eu.stratosphere.types.StringValue
;
//TODO: window operator remains unfinished.
public
class
WindowWordCountLocal
{
...
...
@@ -38,8 +37,7 @@ public class WindowWordCountLocal {
graphBuilder
.
setSink
(
"WindowWordCountSink"
,
WindowWordCountSink
.
class
);
graphBuilder
.
broadcastConnect
(
"WindowWordCountSource"
,
"WindowWordCountSplitter"
);
graphBuilder
.
fieldsConnect
(
"WindowWordCountSplitter"
,
"WindowWordCountCounter"
,
0
,
StringValue
.
class
);
graphBuilder
.
fieldsConnect
(
"WindowWordCountSplitter"
,
"WindowWordCountCounter"
,
0
);
graphBuilder
.
broadcastConnect
(
"WindowWordCountCounter"
,
"WindowWordCountSink"
);
return
graphBuilder
.
getJobGraph
();
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/wordcount/WordCountLocal.java
浏览文件 @
d4d8c40c
...
...
@@ -25,7 +25,6 @@ import eu.stratosphere.configuration.Configuration;
import
eu.stratosphere.nephele.jobgraph.JobGraph
;
import
eu.stratosphere.streaming.api.JobGraphBuilder
;
import
eu.stratosphere.streaming.util.LogUtils
;
import
eu.stratosphere.types.StringValue
;
public
class
WordCountLocal
{
...
...
@@ -37,7 +36,7 @@ public class WordCountLocal {
graphBuilder
.
setSink
(
"WordCountSink"
,
WordCountSink
.
class
);
graphBuilder
.
shuffleConnect
(
"WordCountSource"
,
"WordCountSplitter"
);
graphBuilder
.
fieldsConnect
(
"WordCountSplitter"
,
"WordCountCounter"
,
0
,
StringValue
.
class
);
graphBuilder
.
fieldsConnect
(
"WordCountSplitter"
,
"WordCountCounter"
,
0
);
graphBuilder
.
shuffleConnect
(
"WordCountCounter"
,
"WordCountSink"
);
return
graphBuilder
.
getJobGraph
();
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/examples/wordcount/WordCountRemote.java
浏览文件 @
d4d8c40c
...
...
@@ -27,7 +27,6 @@ import eu.stratosphere.core.fs.Path;
import
eu.stratosphere.nephele.jobgraph.JobGraph
;
import
eu.stratosphere.streaming.api.JobGraphBuilder
;
import
eu.stratosphere.streaming.util.LogUtils
;
import
eu.stratosphere.types.StringValue
;
public
class
WordCountRemote
{
...
...
@@ -39,7 +38,7 @@ public class WordCountRemote {
graphBuilder
.
setSink
(
"WordCountSink"
,
WordCountSink
.
class
);
graphBuilder
.
shuffleConnect
(
"WordCountSource"
,
"WordCountSplitter"
);
graphBuilder
.
fieldsConnect
(
"WordCountSplitter"
,
"WordCountCounter"
,
0
,
StringValue
.
class
);
graphBuilder
.
fieldsConnect
(
"WordCountSplitter"
,
"WordCountCounter"
,
0
);
graphBuilder
.
shuffleConnect
(
"WordCountCounter"
,
"WordCountSink"
);
return
graphBuilder
.
getJobGraph
();
...
...
flink-addons/flink-streaming/src/main/java/eu/stratosphere/streaming/partitioner/FieldsPartitioner.java
浏览文件 @
d4d8c40c
...
...
@@ -17,35 +17,20 @@ package eu.stratosphere.streaming.partitioner;
import
eu.stratosphere.nephele.io.ChannelSelector
;
import
eu.stratosphere.streaming.api.streamrecord.StreamRecord
;
import
eu.stratosphere.types.Key
;
//Grouping by a key
public
class
FieldsPartitioner
implements
ChannelSelector
<
StreamRecord
>
{
private
int
keyPosition
;
// private Class<? extends Key> keyClass;
public
FieldsPartitioner
(
int
keyPosition
,
Class
<?
extends
Key
>
keyClass
)
{
public
FieldsPartitioner
(
int
keyPosition
)
{
this
.
keyPosition
=
keyPosition
;
// this.keyClass = keyClass;
}
@Override
public
int
[]
selectChannels
(
StreamRecord
record
,
int
numberOfOutputChannels
)
{
//TODO:fix this
// Key key = null;
// try {
// key = keyClass.newInstance();
// } catch (InstantiationException e) {
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// }
// TODO: consider hash partition the whole record batch.
//
// }
// key = keyClass.cast(record.getField(0, keyPosition));
//TODO:Better hashing?
return
new
int
[]
{
Math
.
abs
(
record
.
getField
(
0
,
keyPosition
).
hashCode
())
%
numberOfOutputChannels
};
}
}
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/faulttolerance/AtLeastOnceBufferTest.java
浏览文件 @
d4d8c40c
...
...
@@ -15,14 +15,16 @@
package
eu.stratosphere.streaming.faulttolerance
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Before
;
import
org.junit.Test
;
import
eu.stratosphere.api.java.tuple.Tuple1
;
import
eu.stratosphere.streaming.api.streamrecord.StreamRecord
;
import
eu.stratosphere.types.StringValue
;
public
class
AtLeastOnceBufferTest
{
...
...
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/faulttolerance/ExactlyOnceBufferTest.java
浏览文件 @
d4d8c40c
...
...
@@ -15,14 +15,16 @@
package
eu.stratosphere.streaming.faulttolerance
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.Before
;
import
org.junit.Test
;
import
eu.stratosphere.api.java.tuple.Tuple1
;
import
eu.stratosphere.streaming.api.streamrecord.StreamRecord
;
import
eu.stratosphere.types.StringValue
;
public
class
ExactlyOnceBufferTest
{
...
...
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/faulttolerance/FaultToleranceUtilTest.java
浏览文件 @
d4d8c40c
...
...
@@ -15,12 +15,6 @@
package
eu.stratosphere.streaming.faulttolerance
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -29,8 +23,6 @@ import org.junit.Test;
import
eu.stratosphere.nephele.io.RecordWriter
;
import
eu.stratosphere.streaming.api.streamrecord.StreamRecord
;
import
eu.stratosphere.streaming.faulttolerance.FaultToleranceUtil
;
import
eu.stratosphere.types.StringValue
;
public
class
FaultToleranceUtilTest
{
...
...
flink-addons/flink-streaming/src/test/java/eu/stratosphere/streaming/partitioner/FieldsPartitionerTest.java
浏览文件 @
d4d8c40c
...
...
@@ -23,7 +23,6 @@ import org.junit.Test;
import
eu.stratosphere.api.java.tuple.Tuple2
;
import
eu.stratosphere.streaming.api.streamrecord.StreamRecord
;
import
eu.stratosphere.types.StringValue
;
public
class
FieldsPartitionerTest
{
...
...
@@ -35,7 +34,7 @@ public class FieldsPartitionerTest {
@Before
public
void
setPartitioner
()
{
fieldsPartitioner
=
new
FieldsPartitioner
(
0
,
StringValue
.
class
);
fieldsPartitioner
=
new
FieldsPartitioner
(
0
);
}
@Test
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录