Skip to content

Conversation

@aihex
Copy link

@aihex aihex commented Apr 24, 2015

  1. predict(predict.toString) has already output prefix “predict” thus it’s duplicated to print ", predict = " again
  2. there are some extra spaces

1. predict(predict.toString) has already output prefix “predict” thus
it’s
duplicate to print ", predict = " again
2. there are some extra spaces
Copy link
Member

Choose a reason for hiding this comment

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

These can use string interpolation. I take your point though it breaks the symmetry a bit and make this toString rely on details of the subclass. How about making the Predict.toString return something more compact like s"$predict ($prob)"?

@aihex
Copy link
Author

aihex commented Apr 24, 2015

Modify Predict.scala and decouple the dependency of Node.scala on Predict.scala.

@srowen
Copy link
Member

srowen commented Apr 24, 2015

I'm OK with this, though while you're at it, why not make these use string interpolation? s"foo = $foo, ..."

@aihex
Copy link
Author

aihex commented Apr 24, 2015

If you're referring to the modification on Predict.scala, I just follow the style of previous code.

@srowen
Copy link
Member

srowen commented Apr 24, 2015

Yes, but that's a hold over from Scala 2.9 and before. I think that while we're modifying these strings they can use the 'modern' style used in new code in the project.

@aihex aihex force-pushed the tree-node-issue-2 branch from 7fa27ae to 426eee7 Compare April 24, 2015 23:13
Modify Predict.scala and decouple the dependency of Node.scala on
Predict.scala
@aihex
Copy link
Author

aihex commented Apr 24, 2015

Okay, sounds better to use a modern style.

@srowen
Copy link
Member

srowen commented Apr 24, 2015

... this still is not using string interpolation everywhere. It's a small thing, but if we're bothering to update these toString methods, go all the way.

Copy link
Member

Choose a reason for hiding this comment

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

I'd put a space before the parenthesis: $predict (prob

Change to string interpolation way
@aihex aihex changed the title [Minor][MLLIB] Fix a formatting bug in toString method in Node [Minor][MLLIB] Format toString method in MLLIB Apr 25, 2015
@aihex aihex changed the title [Minor][MLLIB] Format toString method in MLLIB [Minor][MLLIB] Refactor toString method in MLLIB Apr 25, 2015
@aihex
Copy link
Author

aihex commented Apr 25, 2015

Get your point and change all toString methods in MLLIB.
There are a large number of uses of 'old' way in the statement like logInfo, which makes it hard to change all them in a moment.

@srowen
Copy link
Member

srowen commented Apr 25, 2015

Looks OK, I think Joseph just had one more tiny comment on one toString method, to add a space.

@aihex
Copy link
Author

aihex commented Apr 25, 2015

Good to go.
@jkbradley Thank you.

@srowen
Copy link
Member

srowen commented Apr 25, 2015

ok to test

@jkbradley
Copy link
Member

LGTM pending tests

@SparkQA
Copy link

SparkQA commented Apr 25, 2015

Test build #699 has finished for PR 5687 at commit b6380c6.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.
  • This patch adds the following new dependencies:
    • tachyon-0.6.4.jar
    • tachyon-client-0.6.4.jar
  • This patch removes the following dependencies:
    • tachyon-0.5.0.jar
    • tachyon-client-0.5.0.jar

@srowen
Copy link
Member

srowen commented Apr 25, 2015

@AIHE this fails style checks. I think the lines are too long. Can you fix those up and try ./dev/lint-scala to check it out locally?

@aihex aihex force-pushed the tree-node-issue-2 branch from b6380c6 to 44ba947 Compare April 26, 2015 03:31
@aihex
Copy link
Author

aihex commented Apr 26, 2015

@srowen Sure. Pass the style checking and will do that for PRs in the feature.

@SparkQA
Copy link

SparkQA commented Apr 26, 2015

Test build #710 has finished for PR 5687 at commit 9862b9a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.
  • This patch does not change any dependencies.

@asfgit asfgit closed this in 9a5bbe0 Apr 26, 2015
jeanlyn pushed a commit to jeanlyn/spark that referenced this pull request May 14, 2015
1. predict(predict.toString) has already output prefix “predict” thus it’s duplicated to print ", predict = " again
2. there are some extra spaces

Author: Alain <[email protected]>

Closes apache#5687 from AiHe/tree-node-issue-2 and squashes the following commits:

9862b9a [Alain] Pass scala coding style checking
44ba947 [Alain] Minor][MLLIB] Format toString method in MLLIB
bdc402f [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node
426eee7 [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node.scala
nemccarthy pushed a commit to nemccarthy/spark that referenced this pull request Jun 19, 2015
1. predict(predict.toString) has already output prefix “predict” thus it’s duplicated to print ", predict = " again
2. there are some extra spaces

Author: Alain <[email protected]>

Closes apache#5687 from AiHe/tree-node-issue-2 and squashes the following commits:

9862b9a [Alain] Pass scala coding style checking
44ba947 [Alain] Minor][MLLIB] Format toString method in MLLIB
bdc402f [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node
426eee7 [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node.scala
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