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

Remove several implicits for TraversableOnce to Fields #1659

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

johnynek
Copy link
Collaborator

addresses #1657

Note, .isDefined on fields is actually what you might expect:

scala> import com.twitter.scalding.Dsl._
import com.twitter.scalding.Dsl._

scala> List().isDefined
res0: Boolean = false

scala> List(1).isDefined
res1: Boolean = true

scala> List(1, 2).isDefined
res2: Boolean = true

where you get in trouble is when the container type cannot be converted to a field (which is common). Then you get a runtime error in that case. So, the risk is less than I thought for this case: either a "correct" result or a runtime exception.

Note, we can't remove the implicit for List (as we see above) because List extends Product. It is pretty crazy that Product has an implicit in scalding jobs... We could get rid of that probably without breaking too many people by adding 22 implicits converting each of the tuples to Fields without using Product. Maybe that is the way to go.

@piyushnarang
Copy link
Collaborator

+1, changes look good to me. We have ~20 or so failing targets due to these implicits (some fairly simple to fix, some will likely require us to create an internal trait / object that exposes these implicits to avoid calling fields / intFields a bunch of times in a given job).
Would make our internal migration to 0.17.0 simpler if we pulled this in for the next release as there's a bunch of other things to be fixed / handled in it. So if you're not affected by it, would prefer merging this after we cut the rel.

@johnynek
Copy link
Collaborator Author

johnynek commented Apr 5, 2017

we can wait.

@johnynek
Copy link
Collaborator Author

So, @fwbrasil had the idea that we should port these implicits to use a macro so we could fail at compile time if we can't do the conversion, that will probably work for 99% of the Twitter fields API uses and allow us to remove all unsafe implitics.

@ianoc
Copy link
Collaborator

ianoc commented Oct 4, 2017

Should we re-visit this now since 0.17 is out?

@piyushnarang
Copy link
Collaborator

@ianoc yeah we released 0.17.x at Twitter a few months back. I'll let @fwbrasil / @pankajroark / @ttim chime in if they have any reservations about the fields api breakages.

@johnynek
Copy link
Collaborator Author

johnynek commented Oct 5, 2017 via email

@pankajroark
Copy link
Contributor

Let me start a sandbox for this. I'll let someone else in the team evaluate the results, perhaps @fwbrasil

@pankajroark
Copy link
Contributor

Actually something seems broken in my set up, I'm unable to publish to internal maven. I'll let someone else in the team run the sandbox tomorrow.

@johnynek
Copy link
Collaborator Author

johnynek commented Oct 5, 2017 via email

@ianoc-stripe
Copy link
Contributor

Is this still valid? if so if the cascading 3 big breaking change is coming might be nice to bundle this in if it doesn't break tw

@johnynek
Copy link
Collaborator Author

@fwbrasil what do you think? Could you see about fixing the 20 targets that are using this to import your own private implicit in those targets? I'd really love to remove having an implicit on every collection that has similar methods (isDefined) as scala has.

@fwbrasil
Copy link
Contributor

@johnynek I think it's reasonable. Can we have a deprecated object in Scalding that has the implicits so we just need to import them?

@johnynek
Copy link
Collaborator Author

that means we have to publish for you to fix.

you could try now to see what the errors are, build with this branch, and then just fix it currently so merging won't cause you problems later. Of course, that won't help you spot future regressions, but I guess most new code is the typed API that does not use this.

@fwbrasil
Copy link
Contributor

I think it's fine if we fix this while updating the scalding version

@johnynek
Copy link
Collaborator Author

@fwbrasil I added DeprecatedFieldConversions and I exercise it in the tests:

https://github.com/twitter/scalding/pull/1659/files#diff-2b5cd65002aa3a695acf20a452296452R22

What do you think can we merge this?

@CLAassistant
Copy link

CLAassistant commented Nov 16, 2019

CLA assistant check
All committers have signed the CLA.

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.

7 participants