Yes I get all that too and I think there's a legit question about
whether moving a little further down the slippery slope is worth it
and if so how far. The other catch here is: either you completely
mimic another API (in which case why not just use it directly, which
has its own problems) or you don't, in which case you're introduce yet
another API for the same operations. I personally would prefer not to
go further down the slope, but it's not up to me.

However I do think it's easier than it seems to write the implicits;
it doesn't involve new classes or anything. Yes it's pretty much just
what you wrote. There is a class "Vector" in Spark. This declaration
can be in an object; you don't implement your own class. (Also you can
use "toBreeze" to get Breeze vectors.)

Then if you import these implicit defs it should work pretty
transparently. I haven't tried it. If it works well, then *that*
definition could be an interesting element to add to Spark for just
this purpose.

On Tue, Aug 25, 2015 at 4:57 PM, Kristina Rogale Plazonic
<kpl...@gmail.com> wrote:
> PS:
> is this what you meant by adding simple implicit def? should it be a class
> or object? These are kinds of questions I grapple with and why I'm asking
> for example of a solution
>
>  // this is really a pseudo-code, I know BreezeVector and SparkVector are
> not real class names
>
> class MyVector extends SparkVector {
>
> implicit def toBreeze(v:SparkVector):BreezeVector = BreezeVector(v.toArray)
>
> implicit def fromBreeze( bv:BreezeVector ):SparkVector = Vectors.dense(
> bv.toArray )
>
> }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to