flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-5976) Refactoring duplicate Tokenizer in flink-test
Date Wed, 08 Mar 2017 01:42:42 GMT

    [ https://issues.apache.org/jira/browse/FLINK-5976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15900542#comment-15900542
] 

ASF GitHub Bot commented on FLINK-5976:
---------------------------------------

Github user liuyuzhong7 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3485#discussion_r104826690
  
    --- Diff: flink-tests/src/test/java/org/apache/flink/test/util/Tokenizer.java ---
    @@ -0,0 +1,17 @@
    +package org.apache.flink.test.util;
    --- End diff --
    
    @zentol fixed.


> Refactoring duplicate Tokenizer in flink-test
> ---------------------------------------------
>
>                 Key: FLINK-5976
>                 URL: https://issues.apache.org/jira/browse/FLINK-5976
>             Project: Flink
>          Issue Type: Improvement
>          Components: Examples
>    Affects Versions: 1.2.0
>            Reporter: liuyuzhong7
>            Priority: Minor
>              Labels: test
>             Fix For: 1.2.0
>
>
> There are some duplicate code like this in flink-test, I think refactor this will be
better. 
> ```
> public final class Tokenizer implements FlatMapFunction<String, Tuple2<String,
Integer>> {
> 	@Override
> 	public void flatMap(String value, Collector<Tuple2<String, Integer>> out)
{
> 		// normalize and split the line
> 		String[] tokens = value.toLowerCase().split("\\W+");
> 		// emit the pairs
> 		for (String token : tokens) {
> 			if (token.length() > 0) {
> 				out.collect(new Tuple2<String, Integer>(token, 1));
> 			}
> 		}
> 	}
> }
> ```



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message