You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Mariusz Strzelecki (JIRA)" <ji...@apache.org> on 2016/10/06 05:39:21 UTC

[jira] [Comment Edited] (SPARK-16950) fromOffsets parameter in Kafka's Direct Streams does not work in python3

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

Mariusz Strzelecki edited comment on SPARK-16950 at 10/6/16 5:38 AM:
---------------------------------------------------------------------

Hello Russell,
your code works in my environment. Please ensure you have loaded the 2.0.1 version of {{spark-streaming-kafka-0-8 package}}.
Probably you need to use
{noformat}
./bin/pyspark --jars external/kafka-0-8-assembly/target/spark-streaming-kafka-0-8-assembly_2.11-2.0.1.jar
{noformat}
instead of {{\-\-packages}}, because the newest deployed kafka package is still 2.0.0: https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-kafka-0-8_2.11

Hope that helps!


was (Author: szczeles):
Hello Russel,
your code works in my environment. Please ensure you have loaded the 2.0.1 version of {{spark-streaming-kafka-0-8 package}}.
Probably you need to use
{noformat}
./bin/pyspark --jars external/kafka-0-8-assembly/target/spark-streaming-kafka-0-8-assembly_2.11-2.0.1.jar
{noformat}
instead of {{\-\-packages}}, because the newest deployed kafka package is still 2.0.0: https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-kafka-0-8_2.11

Hope that helps!

> fromOffsets parameter in Kafka's Direct Streams does not work in python3
> ------------------------------------------------------------------------
>
>                 Key: SPARK-16950
>                 URL: https://issues.apache.org/jira/browse/SPARK-16950
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 2.0.0, 2.0.1, 2.1.0
>            Reporter: Mariusz Strzelecki
>             Fix For: 2.0.1, 2.1.0
>
>
> KafkaUtils.createDirectStream does not work in python3 when you set parameter fromOffsets (which is starting offsets of the stream on Kafka). This is because the {{long}} type is removed from python3 and py4j maps numeric variables to {{java.lang.Integer}} or {{java.lang.Long}} depending on number size, which causes ClassCastException for small offsets variables.
> This behaviour was noticed before and tests for this functionality are disabled in python3: https://github.com/apache/spark/blob/89e67d6667d5f8be9c6fb6c120fbcd350ae2950d/python/pyspark/streaming/tests.py#L1061



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org