RE: Scala: How to match a java object????

2015-08-19 Thread Saif.A.Ellafi
: Re: Scala: How to match a java object Hi Saif, Would this work? import scala.collection.JavaConversions._ new java.math.BigDecimal(5) match { case x: java.math.BigDecimal = x.doubleValue } It gives me on the scala console. res9: Double = 5.0 Assuming you had a stream of BigDecimals

RE: Scala: How to match a java object????

2015-08-19 Thread Saif.A.Ellafi
: Re: Scala: How to match a java object Saif: In your example below, the error was due to there is no automatic conversion from Int to BigDecimal. Cheers On Aug 19, 2015, at 6:40 AM, saif.a.ell...@wellsfargo.commailto:saif.a.ell...@wellsfargo.com saif.a.ell

Re: Scala: How to match a java object????

2015-08-19 Thread Ted Yu
will try and see how it works for my Seq[Any] and see. Thanks for the work arounds. Saif From: Sujit Pal [mailto:sujitatgt...@gmail.com] Sent: Tuesday, August 18, 2015 6:25 PM To: Ellafi, Saif A. Cc: wrbri...@gmail.com; user Subject: Re: Scala: How to match a java object Hi Saif

RE: Scala: How to match a java object????

2015-08-18 Thread Saif.A.Ellafi
From: William Briggs [mailto:wrbri...@gmail.com] Sent: Tuesday, August 18, 2015 4:46 PM To: Ellafi, Saif A.; user@spark.apache.org Subject: Re: Scala: How to match a java object Could you share your pattern matching expression that is failing? On Tue, Aug 18, 2015, 3:38 PM saif.a.ell

Re: Scala: How to match a java object????

2015-08-18 Thread Marcelo Vanzin
On Tue, Aug 18, 2015 at 12:59 PM, saif.a.ell...@wellsfargo.com wrote: 5 match { case java.math.BigDecimal = 2 } 5 match { case _: java.math.BigDecimal = 2 } -- Marcelo - To unsubscribe, e-mail:

Re: Scala: How to match a java object????

2015-08-18 Thread Marcelo Vanzin
the typed pattern example. -Original Message- From: Marcelo Vanzin [mailto:van...@cloudera.com] Sent: Tuesday, August 18, 2015 5:15 PM To: Ellafi, Saif A. Cc: wrbri...@gmail.com; user@spark.apache.org Subject: Re: Scala: How to match a java object On Tue, Aug 18, 2015 at 12:59 PM

Re: Scala: How to match a java object????

2015-08-18 Thread William Briggs
Could you share your pattern matching expression that is failing? On Tue, Aug 18, 2015, 3:38 PM saif.a.ell...@wellsfargo.com wrote: Hi all, I am trying to run a spark job, in which I receive *java.math.BigDecimal* objects, instead of the scala equivalents, and I am trying to convert them

RE: Scala: How to match a java object????

2015-08-18 Thread Saif.A.Ellafi
Hi, Can you please elaborate? I am confused :-) Saif -Original Message- From: Marcelo Vanzin [mailto:van...@cloudera.com] Sent: Tuesday, August 18, 2015 5:15 PM To: Ellafi, Saif A. Cc: wrbri...@gmail.com; user@spark.apache.org Subject: Re: Scala: How to match a java object On Tue

Re: Scala: How to match a java object????

2015-08-18 Thread Sujit Pal
] *Sent:* Tuesday, August 18, 2015 4:46 PM *To:* Ellafi, Saif A.; user@spark.apache.org *Subject:* Re: Scala: How to match a java object Could you share your pattern matching expression that is failing? On Tue, Aug 18, 2015, 3:38 PM saif.a.ell...@wellsfargo.com wrote: Hi all, I