Skip to content

Conversation

@ontarionick
Copy link
Contributor

@jerryshao @tdas

I know this is kind of minor, and I know you all are busy, but this brings this class in line with the OffsetRange class, and makes tests a little more concise.

Instead of doing something like:

assert topic_and_partition_instance._topic == "foo"
assert topic_and_partition_instance._partition == 0

You can do something like:

assert topic_and_partition_instance == TopicAndPartition("foo", 0)

Before:

>>> from pyspark.streaming.kafka import TopicAndPartition
>>> TopicAndPartition("foo", 0) == TopicAndPartition("foo", 0)
False

After:

>>> from pyspark.streaming.kafka import TopicAndPartition
>>> TopicAndPartition("foo", 0) == TopicAndPartition("foo", 0)
True

I couldn't find any tests - am I missing something?

@jerryshao
Copy link
Contributor

LGTM, the test is in pyspark/streaming/tests.py, you can refer to it.

@ontarionick
Copy link
Contributor Author

Tests added!

@tdas
Copy link
Contributor

tdas commented Oct 27, 2015

ok to test

@tdas
Copy link
Contributor

tdas commented Oct 27, 2015

LGTM. Will merge when tests pass.

@SparkQA
Copy link

SparkQA commented Oct 27, 2015

Test build #44391 has finished for PR 9236 at commit 669a7ba.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@tdas
Copy link
Contributor

tdas commented Oct 27, 2015

Could you update the code to fix the python style issues?

On Mon, Oct 26, 2015 at 7:32 PM, UCB AMPLab notifications@github.com
wrote:

Merged build finished. Test FAILed.


Reply to this email directly or view it on GitHub
#9236 (comment).

@ontarionick ontarionick force-pushed the topic_and_partition_equality branch from 669a7ba to 8a3e5a3 Compare October 27, 2015 02:40
@ontarionick
Copy link
Contributor Author

@tdas fixed!

@SparkQA
Copy link

SparkQA commented Oct 27, 2015

Test build #44393 has finished for PR 9236 at commit 8a3e5a3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@asfgit asfgit closed this in 8f888ee Oct 27, 2015
asfgit pushed a commit that referenced this pull request Oct 27, 2015
…rtition from the Kafka Streaming API

jerryshao tdas

I know this is kind of minor, and I know you all are busy, but this brings this class in line with the `OffsetRange` class, and makes tests a little more concise.

Instead of doing something like:
```
assert topic_and_partition_instance._topic == "foo"
assert topic_and_partition_instance._partition == 0
```

You can do something like:
```
assert topic_and_partition_instance == TopicAndPartition("foo", 0)
```

Before:
```
>>> from pyspark.streaming.kafka import TopicAndPartition
>>> TopicAndPartition("foo", 0) == TopicAndPartition("foo", 0)
False
```

After:
```
>>> from pyspark.streaming.kafka import TopicAndPartition
>>> TopicAndPartition("foo", 0) == TopicAndPartition("foo", 0)
True
```

I couldn't find any tests - am I missing something?

Author: Nick Evans <me@nicolasevans.org>

Closes #9236 from manygrams/topic_and_partition_equality.

(cherry picked from commit 8f888ee)
Signed-off-by: Tathagata Das <tathagata.das1565@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants