diff options
author | Nick Evans <me@nicolasevans.org> | 2015-10-27 01:29:06 -0700 |
---|---|---|
committer | Tathagata Das <tathagata.das1565@gmail.com> | 2015-10-27 01:29:06 -0700 |
commit | 8f888eea1aef5a28916ec406a99fc19648681ecf (patch) | |
tree | 1d145476595a953aa22a8f1204626c25d1aeb715 /streaming | |
parent | feb8d6a44fbfc31a880aaaac0cfcaadc91786073 (diff) | |
download | spark-8f888eea1aef5a28916ec406a99fc19648681ecf.tar.gz spark-8f888eea1aef5a28916ec406a99fc19648681ecf.tar.bz2 spark-8f888eea1aef5a28916ec406a99fc19648681ecf.zip |
[SPARK-11270][STREAMING] Add improved equality testing for TopicAndPartition 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.
Diffstat (limited to 'streaming')
0 files changed, 0 insertions, 0 deletions