reference [1], but the official document is a little brief, or need to digest the line
p>
(1) CD/home/appleyuchi/bigdat p>
(2) the git clone https://gitee.com/mirrors/apache-flink.git p>
opens the following path :
4. PIP install flake8 p>
(5) Settings – & gt; External Tools
—————————————————————————————————————-
what is this?
—————————————————————————————————————-
, right click Mark Directory as-> Sources Root
—————————————————————————————————————-
python-m PIP install apache-flink(also search for this in pycharm)
—————————————————————————————————————-
run code :
from flink.plan.Environment import get_environment
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))
# 1. 获取一个运行环境
env = get_environment()
print("------------1--------")
# 2. 加载/创建初始数据
data = env.from_elements("Who's there?",
"I think I hear them. Stand, ho! Who's there?")
print("------------2--------")
# 3. 指定对这些数据的操作
# data.flat_map(lambda x, c: [(1, word) for word in x.lower().split()]) \
# .group_by(1) \
# .reduce_group(Adder(), combinable=True) \
# .output()
data.output()
print("------------3--------")
print(data)
# 4. 运行程序
env.execute() # 设置execute(local=True)强制程序在本机运行
—————————————————————————————————————-
finally fails because data.output() cannot output any result
—————————————————————————————————————-
The
command line runs pyflink as
$FLINK_HOME/bin/flink run-py /home/appleyuchi/ desktop/experiment/wordport.py
Reference:
[1]Importing Flink into an IDE
[2]PyCharm builds Spark development environment + the first pyspark program
[3]pycharm not updating with environment variables
Read More:
- NoClassDefFoundError: org/apache/flink/metrics/MetricGroup
- In tensorflow tf.reduce_ Mean function
- download (‘point’) False
- The routine of benewake tfmini-s / tfmimi plus / tfluna / tf02 Pro / tf03 radar on Python
- To customize the aggregate function of Flink (Step-by-Step Tutorial)
- MacOS uninstall clean pychar
- close failed in file object destructor: IOError: [Error 10] No child processes
- Flink 1.1 error: no executorfactory found to execute the application
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- Implement Set using Array.
- org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph
- Tensorflow in function tf.Print Method of outputting intermediate value
- Group by operator of hive execution plan
- Using next (ITER (data. Dataloader()) to report an error stopiteration
- Unable to call numpy in pychar, module notfounderror: no module named ‘numpy’
- Sklearn.datasets.base import error [How to Solve]
- The method of getting shell command output in Python
- Count the frequency of words in English documents
- Hive view execution plan
- Cannot remove : Input/output error