[BEAM-1353] Easy PTransform style guide compliance fixes#1943
[BEAM-1353] Easy PTransform style guide compliance fixes#1943jkff wants to merge 8 commits intoapache:masterfrom
Conversation
|
|
||
| private static class Globally<T> extends PTransform<PCollection<T>, PCollection<T>> { | ||
| /** Implementation of {@link #globally()}. */ | ||
| public static class Globally<T> extends PTransform<PCollection<T>, PCollection<T>> { |
There was a problem hiding this comment.
I may have missed the relevant section in the PTransform style guide -- why is it good to expose the classes if the user need not further configure them?
There was a problem hiding this comment.
In other words, why not "principle of least visibility"?
There was a problem hiding this comment.
I started a thread about this on beam-dev https://lists.apache.org/thread.html/f448eb9f531bec2c0cd70e790dc8d2198d8a1bf9d2b85f94d9ac904a@%3Cdev.beam.apache.org%3E . There indeed is no section about that, but perhaps my arguments in the thread shall be convincing.
There was a problem hiding this comment.
I'm not seeing how this discussion is related to that discussion.
It's more internally-evolvable to return PTransform than to return any concrete class.
And the argument about runner intercepting isn't relevant post-FnApi. No runner can inspect the Java classes specifically, only their standard serialized form.
|
Refer to this link for build results (access rights to CI server needed): Build result: FAILURE[...truncated 4847 lines...]Caused by: org.apache.maven.reporting.MavenReportException: Exit code: 1 - /home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_MavenInstall@2/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java:2046: error: reference not found * {@link org.apache.beam.sdk.io.Write.Bound Write.Bound} to provide Google ^Command line was: /usr/local/asfpackages/java/jdk1.8.0_102/jre/../bin/javadoc @options @packagesRefer to the generated Javadoc files in '/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_MavenInstall@2/runners/google-cloud-dataflow-java/target/apidocs' dir. at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeJavadocCommandLine(AbstractJavadocMojo.java:5163) at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:2075) at org.apache.maven.plugin.javadoc.JavadocJar.execute(JavadocJar.java:188) ... 33 more2017-02-08T01:37:33.474 [ERROR] 2017-02-08T01:37:33.474 [ERROR] Re-run Maven using the -X switch to enable full debug logging.2017-02-08T01:37:33.474 [ERROR] 2017-02-08T01:37:33.474 [ERROR] For more information about the errors and possible solutions, please read the following articles:2017-02-08T01:37:33.474 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException2017-02-08T01:37:33.475 [ERROR] 2017-02-08T01:37:33.475 [ERROR] After correcting the problems, you can resume the build with the command2017-02-08T01:37:33.475 [ERROR] mvn -rf :beam-runners-google-cloud-dataflow-javachannel stoppedSetting status of c37d550 to FAILURE with url https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/7180/ and message: 'Build finished. 'Using context: Jenkins: Maven clean install--none-- |
|
Refer to this link for build results (access rights to CI server needed): |
|
I've revised my changes to the "glorified combine" transforms according to the beam-dev thread. |
|
Changes Unknown when pulling 3e46f94 on jkff:style-guide into ** on apache:master**. |
|
Changes Unknown when pulling 3e46f94 on jkff:style-guide into ** on apache:master**. |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
| @Test | ||
| public void testWriteUnbounded() { | ||
| PCollection<String> unbounded = p.apply(CountingInput.unbounded()) | ||
| .apply(ToString.of()); |
There was a problem hiding this comment.
Are the other violations going to be separate PRs or part of this PR. Should we discuss the method name here or on the list?
There was a problem hiding this comment.
I can just take out this commit from the PR if the rest looks fine. The list or the JIRA thread is probably the best place.
There was a problem hiding this comment.
Moving this discussion to the list.
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
| @Override | ||
| public TimestampedValue<T> addInput(TimestampedValue<T> accumulator, | ||
| TimestampedValue<T> input) { | ||
| TimestampedValue<T> input) { |
There was a problem hiding this comment.
optional style: usually the old indent is preferred
There was a problem hiding this comment.
I usually apply google-java-format on the changed bits but in this case I guess I forgot.
| Coder<TimestampedValue<T>> inputCoder) throws CannotProvideCoderException { | ||
| public Coder<TimestampedValue<T>> getAccumulatorCoder( | ||
| CoderRegistry registry, Coder<TimestampedValue<T>> inputCoder) | ||
| throws CannotProvideCoderException { |
There was a problem hiding this comment.
optional style: usually the throws clause is further indented (I believe)
There was a problem hiding this comment.
I looked at some other instances of a throws on a new line in the codebase, and this style seems more common. It is also what google-java-format produces.
| "inputCoder must be a TimestampedValueCoder, but was %s", inputCoder); | ||
| public Coder<T> getDefaultOutputCoder( | ||
| CoderRegistry registry, Coder<TimestampedValue<T>> inputCoder) | ||
| throws CannotProvideCoderException { |
| */ | ||
| public static class SampleAny<T> extends PTransform<PCollection<T>, PCollection<T>> { | ||
| /** Implementation of {@link #any(long)}; do not use directly. */ | ||
| @VisibleForTesting |
There was a problem hiding this comment.
It looks like this test is Sample-dependent only for convenience. Is it worth changing the test to avoid the need to make this public?
| */ | ||
| public static PTransform<PCollection<?>, PCollection<String>> elements() { | ||
| return new SimpleToString(); | ||
| public static Elements elements() { |
There was a problem hiding this comment.
I'm clearly dumb, because I've asked this question in different flavors a few times, but once more for good measure. Sorry!
The last few commits in this PR left inner transforms generic; why is Elements public? Is it for further customization, or another reason for a difference in visibility?
There was a problem hiding this comment.
No reason. I thought all of the public to private changes were being done in a different PR and all at once.
jkff
left a comment
There was a problem hiding this comment.
Also (github won't let me reply on original comments for some reason):
- Removed the VisibleForTesting thing in Sample.Any
- Made ToString classes back private (forgot to do it last time after the discussion on the thread)
Should be good to go after jenkins is green.
| @Override | ||
| public TimestampedValue<T> addInput(TimestampedValue<T> accumulator, | ||
| TimestampedValue<T> input) { | ||
| TimestampedValue<T> input) { |
There was a problem hiding this comment.
I usually apply google-java-format on the changed bits but in this case I guess I forgot.
| Coder<TimestampedValue<T>> inputCoder) throws CannotProvideCoderException { | ||
| public Coder<TimestampedValue<T>> getAccumulatorCoder( | ||
| CoderRegistry registry, Coder<TimestampedValue<T>> inputCoder) | ||
| throws CannotProvideCoderException { |
There was a problem hiding this comment.
I looked at some other instances of a throws on a new line in the codebase, and this style seems more common. It is also what google-java-format produces.
| "inputCoder must be a TimestampedValueCoder, but was %s", inputCoder); | ||
| public Coder<T> getDefaultOutputCoder( | ||
| CoderRegistry registry, Coder<TimestampedValue<T>> inputCoder) | ||
| throws CannotProvideCoderException { |
|
Thanks Eugene. I will merge when green. |
|
Refer to this link for build results (access rights to CI server needed): Build result: FAILURE[...truncated 1.64 MB...] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_MavenInstall@2/runners/spark/src/test/java/org/apache/beam/runners/spark/translation/streaming/CreateStreamTest.java:[117,71] cannot find symbol symbol: method withoutDefaults() location: class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<java.lang.Integer>,org.apache.beam.sdk.values.PCollection<java.lang.Long>> at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1029) at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:170) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 31 more2017-03-01T00:13:08.632 [ERROR] 2017-03-01T00:13:08.632 [ERROR] Re-run Maven using the -X switch to enable full debug logging.2017-03-01T00:13:08.632 [ERROR] 2017-03-01T00:13:08.632 [ERROR] For more information about the errors and possible solutions, please read the following articles:2017-03-01T00:13:08.632 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException2017-03-01T00:13:08.632 [ERROR] 2017-03-01T00:13:08.632 [ERROR] After correcting the problems, you can resume the build with the command2017-03-01T00:13:08.632 [ERROR] mvn -rf :beam-runners-sparkchannel stoppedSetting status of 70c1864 to FAILURE with url https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/7987/ and message: 'Build finished. 'Using context: Jenkins: Maven clean install--none-- |
|
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-- |
|
retest this please |
|
Refer to this link for build results (access rights to CI server needed): Failed Tests: 1beam_PreCommit_Java_MavenInstall/org.apache.beam:beam-runners-apex: 1--none-- |
|
OK, this failure is pretty clearly a flake, as well as the previous one. |
|
+1 will merge when i get back. Any other committer welcome to preempt me
…On Tue, Feb 28, 2017 at 18:38 Eugene Kirpichov ***@***.***> wrote:
OK, this failure is pretty clearly a flake, as well as the previous one.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1943 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAgITyDEP2rNZgjJL0zLSNQLk9GjG8B_ks5rhNobgaJpZM4L6Q0m>
.
|
This leaves out the more complex / potentially-controversial ones.
R: @dhalperi