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

Scala implicit ordering fun -- have 2 forms of sketch, defaulting to … #1535

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

Conversation

ianoc
Copy link
Collaborator

@ianoc ianoc commented Mar 5, 2016

…the existing

@johnynek as we were discussing for the sketch method. More of a consideration than hard PR

@@ -119,6 +119,67 @@ object TypedPipe extends Serializable {
override def hash(x: Int): Int = x
}
}
implicit class HigherPriorityTypedPipeMethods[T, K, V](val tp: TypedPipe[T])(implicit ev: TypedPipe[T] <:< TypedPipe[(K, V)],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can only enter an implicit class if you meet all of its criteria

Copy link
Collaborator

Choose a reason for hiding this comment

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

can we drop T entirely here and just do (K, V)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like the tests here pass with that yep

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can put the classes somewhere else, but I think to keep the same sort of source feel/compatibility we need this low priority implicit stuff to fall back to the old one. If we would be happy to make it disappear in the event of no matching signature i think we can just do 2 implicit methods in the object pointing at 2 classes (in sketched.scala) containing the sketch method of the 2 signatures.

@johnynek
Copy link
Collaborator

johnynek commented Mar 5, 2016

looks good to me modulo the naming (I would use names for classes more specific to SketchJoin)

@johnynek
Copy link
Collaborator

johnynek commented Mar 6, 2016

👍 I like this. You can use the OrderedSerialization macros, not have an implicit conversion in scope and do a more efficient join at the same time. Seems like a win.

@johnynek
Copy link
Collaborator

what do you think of this @rubanm @isnotinvain ? I like not having to set up an implicit conversion and the ability to use compiler generated serializers.

.write(TypedText.tsv[(Int, Int, Int)]("output-join"))
}

class BothAvailableSketchMethodsTypedSketchLeftJoinJob(args: Args) extends Job(args) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This job looks unused in the test specs below.

@rubanm
Copy link
Contributor

rubanm commented Mar 29, 2016

@johnynek @ianoc Sorry late to this. Just one unit test comment. LGTM!

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

None yet

5 participants