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-4092) Stringify map function's type conversion problem is breaking running provided example in documents
Date Sun, 19 Jun 2016 10:10:05 GMT

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

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

GitHub user shahinism opened a pull request:

    https://github.com/apache/flink/pull/2130

    [FLINK-4092] Python API Stringify map function's type conversion is breaking executing
provided example in documents

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shahinism/flink bug/flink-4092-python-api

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2130.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2130
    
----
commit f45362f0401afca716237f00bf9a166c7c861fc4
Author: Shahin <ishahinism@gmail.com>
Date:   2016-06-19T10:03:14Z

    [FLINK-4092] (Python API) Stringify map function's type conversion problem is breaking
running provided example in documents

----


> Stringify map function's type conversion problem is breaking running provided example
in documents
> --------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-4092
>                 URL: https://issues.apache.org/jira/browse/FLINK-4092
>             Project: Flink
>          Issue Type: Bug
>          Components: DataSet API, Python API
>    Affects Versions: 1.0.3
>            Reporter: Shahin Azad
>              Labels: easyfix
>
> This function definition:
> {code:python}
>     def map(self, value):
>         if isinstance(value, (tuple, list)):
>             return "(" + b", ".join([self.map(x) for x in value]) + ")"
>         else:
>             return str(value)
> {code}
> in {{/resources/python/flink/plan/DataSet.py}} will raise an exception since implicit
type conversion between {{String}} to {{Bytes}} is not possible. User will get following error
if he tries to run the wordcount example from the documentation:
> {code}
> File "/tmp/flink-dist-cache-fb3d569b-c811-4065-acef-32267183aa15/f1b0eb6c0a099b22760f7300760e6e80/flink/flink/plan/Da
> taSet.py", line 38, in map
>     return "(" + b", ".join([self.map(x) for x in value]) + ")"
> TypeError: sequence item 0: expected a bytes-like object, str found
>         at org.apache.flink.python.api.streaming.data.PythonStreamer.streamBufferWithoutGroups(PythonStreamer.java:269)
>         at org.apache.flink.python.api.functions.PythonMapPartition.mapPartition(PythonMapPartition.java:54)
>         at org.apache.flink.runtime.operators.MapPartitionDriver.run(MapPartitionDriver.java:98)
>         at org.apache.flink.runtime.operators.BatchTask.run(BatchTask.java:480)
>         at org.apache.flink.runtime.operators.BatchTask.invoke(BatchTask.java:345)
>         at org.apache.flink.runtime.taskmanager.Task.run(Task.java:559)
>         at java.lang.Thread.run(Thread.java:745)
> {code}
> To resolve this issue it's enough to change {{b", "}} to a normal string by removing
Byte conversion notation. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message