Re: Multiplication on decimals in a dataframe query

2015-12-03 Thread Philip Dodds
I'll open up a JIRA for it, it appears to work when you use a literal number but not when it is coming from the same dataframe Thanks! P On Thu, Dec 3, 2015 at 1:52 AM, Sahil Sareen wrote: > +1 looks like a bug > > I think referencing trades() twice in multiplication is

Re: Multiplication on decimals in a dataframe query

2015-12-03 Thread Philip Dodds
Opened https://issues.apache.org/jira/browse/SPARK-12128 Thanks P On Thu, Dec 3, 2015 at 8:51 AM, Philip Dodds wrote: > I'll open up a JIRA for it, it appears to work when you use a literal > number but not when it is coming from the same dataframe > > Thanks! > > P >

Re: Multiplication on decimals in a dataframe query

2015-12-03 Thread Philip Dodds
Did a little more digging and it appears it was just the way I constructed the Decimal It works if you do val data = Seq.fill(5) { Trade(Decimal(BigDecimal(5),38,20), Decimal(BigDecimal(5),38,20)) } On Thu, Dec 3, 2015 at 8:58 AM, Philip Dodds wrote: > Opened

Re: Multiplication on decimals in a dataframe query

2015-12-02 Thread Sahil Sareen
+1 looks like a bug I think referencing trades() twice in multiplication is broken, scala> trades.select(trades("quantity")*trades("quantity")).show +-+ |(quantity * quantity)| +-+ | null| | null| scala>

Re: Multiplication on decimals in a dataframe query

2015-12-02 Thread Akhil Das
Not quiet sure whats happening, but its not an issue with multiplication i guess as the following query worked for me: trades.select(trades("price")*9.5).show +-+ |(price * 9.5)| +-+ |199.5| |228.0| |190.0| |199.5| |190.0| |

Multiplication on decimals in a dataframe query

2015-11-29 Thread Philip Dodds
I hit a weird issue when I tried to multiply to decimals in a select (either in scala or as SQL), and Im assuming I must be missing the point. The issue is fairly easy to recreate with something like the following: val sqlContext = new org.apache.spark.sql.SQLContext(sc) import