[BEAM-1830] KafkaIO : Add withTopic() api that takes single topic.#2364
[BEAM-1830] KafkaIO : Add withTopic() api that takes single topic.#2364rangadi wants to merge 6 commits intoapache:masterfrom
Conversation
Remove need for setting key coder for Writer while writing values only. If we didn't specifiy the key coder, validation succeeded but it failed a check while instantiating Kafka producer.
| @Nullable abstract String getTopic(); | ||
| @Nullable abstract Coder<K> getKeyCoder(); | ||
| @Nullable abstract Coder<V> getValueCoder(); | ||
| abstract boolean getValueOnly(); |
There was a problem hiding this comment.
This and the changes below don't seem to be related to the current commit or PR. Also, all of these changes are missing tests.
There was a problem hiding this comment.
yeah, mentioned about it in the description. This is a bug I noticed when I tried to use the writer.
withTopic() is just a wrapper/builder method. All the existing tests use multiple topics, should I another test with single topic?
Testing sink changes are partially done: The validation code is tested in KafkaIOTest.testValuesSink(). This test didn't fail earlier since we don't use a real KafkaProducer that instantiates the serializers. Let me see if I can manually try to instantiate.
There was a problem hiding this comment.
Either way please split into multiple commits (ideally multiple PRs, since these commits are not logically related)
There was a problem hiding this comment.
Reverted writer fix. Added a test with single topic that uses new API.
|
Refer to this link for build results (access rights to CI server needed): Failed Tests: 1beam_PreCommit_Java_MavenInstall/org.apache.beam:beam-runners-spark: 1--none-- |
|
Refer to this link for build results (access rights to CI server needed): |
|
Thanks Eugene. PTAL. |
|
Refer to this link for build results (access rights to CI server needed): |
|
Kafka writer is fixed in #2369. |
jkff
left a comment
There was a problem hiding this comment.
Thanks, please also squash all commits into one.
| @@ -291,6 +291,31 @@ public void testUnboundedSource() { | |||
| p.run(); | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
Nice. Removed it for the new test.
|
-R: @amitsela as Eugene seems to have this. |
|
@jkff Thanks for the review. It might be better for you to squash while merging. That way PR retains the commit history. |
|
Refer to this link for build results (access rights to CI server needed): Build result: FAILURE[...truncated 2.11 MB...] at java.lang.Thread.run(Thread.java:745)Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution failed. at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:302) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 31 moreCaused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166) at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764) at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711) at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289) ... 33 more2017-03-30T19:54:48.312 [ERROR] 2017-03-30T19:54:48.312 [ERROR] Re-run Maven using the -X switch to enable full debug logging.2017-03-30T19:54:48.312 [ERROR] 2017-03-30T19:54:48.312 [ERROR] For more information about the errors and possible solutions, please read the following articles:2017-03-30T19:54:48.312 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException2017-03-30T19:54:48.312 [ERROR] 2017-03-30T19:54:48.312 [ERROR] After correcting the problems, you can resume the build with the command2017-03-30T19:54:48.312 [ERROR] mvn -rf :beam-sdks-pythonchannel stoppedSetting status of 330c48d to FAILURE with url https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/8960/ and message: 'Build finished. 'Using context: Jenkins: Maven clean install--none-- |
|
retest this please. |
|
Refer to this link for build results (access rights to CI server needed): Failed Tests: 3beam_PreCommit_Java_MavenInstall/org.apache.beam:beam-sdks-java-io-elasticsearch: 3
--none-- |
|
retest this please. |
jkff
left a comment
There was a problem hiding this comment.
Thanks, I'll squash and merge.
|
Refer to this link for build results (access rights to CI server needed): |
Overwhelming majority of KafkaIO readers consume just one topic. It would be nice to have
withTopic(topic)rather than always requiring a list.In addition, I am fixing a small bug I noticed while using
KafkaIO.write().values(). Remove need for setting key coder for Writer while writing values only. If we didn't specifiy the key coder, validation succeeded but it failed a check while instantiating Kafka producer.