Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kafka Source #24

Merged
merged 15 commits into from
Jan 12, 2016
Merged

Kafka Source #24

merged 15 commits into from
Jan 12, 2016

Conversation

tdas
Copy link
Collaborator

@tdas tdas commented Jan 7, 2016

No description provided.

@tdas tdas changed the title Kafka Source [WIP] Kafka Source Jan 7, 2016
@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/17/
Test FAILed.

}
}

test("basic receiving") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe try this test case:

  (1 to 50).foreach  { i =>
    test(s"basic receiving #$i") {
      val topic = s"topic$i"
      testUtils.createTopic(topic)

      val kafkaSource = KafkaSource(Set(topic), kafkaParams)
      val mapped =
        kafkaSource
          .toDS()
          .map(kv => new String(kv._2).toInt + 1)

      testStream(mapped)(
        AddKafkaData(kafkaSource, topic, 1, 2, 3),
        CheckAnswer(2, 3, 4),
        StopStream,
        DropBatches(1),
        StartStream,
        CheckAnswer(2, 3, 4),
        StopStream,
        AddKafkaData(kafkaSource, topic, 4, 5, 6),
        StartStream,
        CheckAnswer(2, 3, 4, 5, 6, 7),
        AddKafkaData(kafkaSource, topic, 7),
        CheckAnswer(2, 3, 4, 5, 6, 7, 8))
    }
  }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I am going to add more tests! That's why WIP. Going to add multi-topic tests, etc.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, I just tried that specific test and it uncovered several concurrency issues.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/27/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/28/
Test PASSed.

case 1 => nonZeroSigns.head // if there are only (0s and 1s) or (0s and -1s)
case _ => // there are both 1s and -1s
throw new IllegalArgumentException(
s"Invalid comparison between non-linear histories: $this <=> $other")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marmbrus This is a bug here. Basically, [0, 0] < [0, 1] is correct, but the earlier code would give exception as signs = [0, -1]

@tdas
Copy link
Collaborator Author

tdas commented Jan 9, 2016

I want to add the randomized testing as well, but I dont want this to get blocked by that. Please start reviewing this.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/33/
Test FAILed.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/34/
Test FAILed.

@tdas
Copy link
Collaborator Author

tdas commented Jan 11, 2016

@marmbrus Ping for review.

Also Jenkins does not seem to be testing this. What do I do to force it?

@tdas
Copy link
Collaborator Author

tdas commented Jan 11, 2016

Jenkins, test this please.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/38/
Test PASSed.

import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.execution.streaming.{Batch, Offset, Source, StreamingRelation}
import org.apache.spark.sql.types.StructType
import org.apache.spark.sql.{DataFrame, Dataset, SQLContext}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spark/Kafka ordering are inconsistent with the file above.

object CompositeOffset {
/**
* Returns a [[CompositeOffset]] with a variable sequence of offsets.
* `nulls` in the sequence are converted to `None`s. */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap the trailing */

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/40/
Test PASSed.

case _ =>
throw new IllegalArgumentException(s"Cannot compare $this <=> $other")
}

override def ==(other: Offset): Boolean = Try(compareTo(other) == 0).getOrElse(false)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be equals as well. Note that means we need to override hashcode too.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/41/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/42/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/43/
Test PASSed.

@@ -33,5 +35,17 @@ trait Offset extends Serializable {
def <(other: Offset): Boolean = compareTo(other) < 0
def <=(other: Offset): Boolean = compareTo(other) <= 0
def >=(other: Offset): Boolean = compareTo(other) >= 0
def ==(other: Offset): Boolean = compareTo(other) == 0

override def equals(other: Any): Boolean = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that its valid to override equals without also overriding hashCode

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/44/
Test PASSed.

@tdas tdas changed the title [WIP] Kafka Source Kafka Source Jan 12, 2016
@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/spark-streaming-df-test/45/
Test PASSed.

marmbrus added a commit that referenced this pull request Jan 12, 2016
@marmbrus marmbrus merged commit d0807b1 into marmbrus:streaming-df Jan 12, 2016
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.

3 participants