flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-377] [FLINK-671] Generic Interface / PA...
Date Mon, 02 Feb 2015 19:22:20 GMT
Github user rmetzger commented on a diff in the pull request:

    --- Diff: docs/python_programming_guide.md ---
    @@ -0,0 +1,600 @@
    +title: "Python Programming Guide"
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright ownership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +  http://www.apache.org/licenses/LICENSE-2.0
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +* This will be replaced by the TOC
    +<a href="#top"></a>
    +Analysis programs in Flink are regular programs that implement transformations on data
    +(e.g., filtering, mapping, joining, grouping). The data sets are initially created from
    +sources (e.g., by reading files, or from collections). Results are returned via sinks,
which may for
    +example write the data to (distributed) files, or to standard output (for example the
command line
    +terminal). Flink programs run in a variety of contexts, standalone, or embedded in other
    +The execution can happen in a local JVM, or on clusters of many machines.
    +In order to create your own Flink program, we encourage you to start with the
    +[program skeleton](#program-skeleton) and gradually add your own
    +[transformations](#transformations). The remaining sections act as references for additional
    +operations and advanced features.
    +Example Program
    +The following program is a complete, working example of WordCount. You can copy &amp;
paste the code
    +to run it locally.
    +{% highlight python %}
    +from flink.plan.Environment import get_environment
    +from flink.plan.Constants import INT, STRING
    +from flink.functions.GroupReduceFunction import GroupReduceFunction
    +class Adder(GroupReduceFunction):
    +  def reduce(self, iterator, collector):
    +    count, word = iterator.next()
    +    count += sum([x[0] for x in iterator])
    +    collector.collect((count, word))
    +if __name__ == "__main__":
    +  env = get_environment()
    +  data = env.from_elements("Who's there?",
    +   "I think I hear them. Stand, ho! Who's there?")
    +  data \
    +    .flat_map(lambda x: x.lower().split(), (INT, STRING)) \
    +    .group_by(1) \
    +    .reduce_group(Adder(), (INT, STRING), combinable=True) \
    +    .output()
    +  env.execute()
    --- End diff --
    I've copy pasted the program as said in the documentation but it doesn't run.
    Most likely because of the `}` sign here.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message