Re: Null Value in DecimalType column of DataFrame

2015-09-21 Thread Reynold Xin
+dev list Hi Dirceu, The answer to whether throwing an exception is better or null is better depends on your use case. If you are debugging and want to find bugs with your program, you might prefer throwing an exception. However, if you are running on a large real-world dataset (i.e. data is

Re: Null Value in DecimalType column of DataFrame

2015-09-18 Thread Dirceu Semighini Filho
Hi Yin, I got that part. I just think that instead of returning null, throwing an exception would be better. In the exception message we can explain that the DecimalType used can't fit the number that is been converted due to the precision and scale values used to create it. It would be easier for

Re: Null Value in DecimalType column of DataFrame

2015-09-17 Thread Yin Huai
As I mentioned before, the range of values of DecimalType(10, 10) is [0, 1). If you have a value 10.5 and you want to cast it to DecimalType(10, 10), I do not think there is any better returned value except of null. Looks like DecimalType(10, 10) is not the right type for your use case. You need a

Re: Null Value in DecimalType column of DataFrame

2015-09-14 Thread Yin Huai
btw, move it to user list. On Mon, Sep 14, 2015 at 2:54 PM, Yin Huai wrote: > A scale of 10 means that there are 10 digits at the right of the decimal > point. If you also have precision 10, the range of your data will be [0, 1) > and casting "10.5" to DecimalType(10, 10)