Index conversion

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Index conversion

Kürşat Kurt

Hi;

 

I have label index DataSet and final DataSet that i want to convert its indexes to labels.

 

ixDS: DataSet[(Long, String)]

(1,Car)

(2,Sports)

(3,Home)

...

 

finalDS:DataSet[(Long, String, Double, String, Double)]

(1,x,1,y,4)

(2,z,3,t,5)

...

 

If i want to convert finalDS’s indexes with join like this:

 

val res=finalDS.join(ixDS).where(0).equalTo(0){(l,r)=> {

        (r._2,l._2)

        }}

res.print();

 

I can not get labed indexes.

If i collect and try to match each DS i could get labels :

 

finalDS.collect().foreach(x=>{

        ixDS.collect().foreach(y=> {

          if (x._1==y._1) System.err.println(">>>>>>>>"+x._2+","+y._2)

        })

      })

 

.. but i think it is the wrong way.

What is the correct way for conversion?