title: Debug an error in "Statistics.corr" in mlib library
body: <p>I wanted to compare the performance of two correlation methods, Pearson and spearman for big data set.  Therefore, I used mlib library in pyspark.  However, for some cases Pearson correlation gave me nan value where as spearman worked well. To double check that the problem is not in my dataset I run some example manually and Pearson correlation had a value not nan as I got using mlib correlation function.  Therefore, I am seeking for help in order to identify the error here or to give me some hints on how to debug the error in this function   </p>
  
  <p>Following is a simple exapmle for calculating the correltaion between two arrays: </p>
  
  <pre><code>  x=[-18,-18,-18,-17.95,-17.9,-17.95,-18,-18,-18,-18,-17.95,-17.9,-18,-18.1,-18.05,-18,-18,-18,-18.05,-18.1,-18.1,-18.1,-18.05,-18,-18,-18,-18.05,-18.1,-18.1,-18.1]
  
    x=np.asarray(x)
  
    x=sc.parallelize(x)
  
    x.count()
       30
  
    y=[4.10E-07,3.65E-07,3.20E-07,3.20E-07,3.20E-07,3.15E-07,3.10E-07,3.30E-07,3.45E-07,3.60E-07,4.60E-07,5.60E-07,6.35E-07,7.10E-07,6.80E-07,6.50E-07,5.20E-07,3.90E-07,4.15E-07,4.40E-07,5.05E-07,5.70E-07,4.90E-07,4.10E-07,3.50E-07,2.90E-07,2.85E-07,2.80E-07,3.40E-07,4.00E-07]
    y=np.asarray(y)
  
    y=sc.parallelize(y)
  
    y.count()
       30
  
   In [172]: pearson=Statistics.corr(x,y,method='pearson')
   2019-04-16 16:16:41 WARN  PearsonCorrelation:66 - Pearson 
    correlation matrix contains NaN values.
  
   In [173]: pearson
   Out[173]: nan
  
   In [174]: spearman=Statistics.corr(x,y,method='spearman')
  
    In [175]: spearman
    Out[175]: -0.21201144954413315
  </code></pre>
  
  <p>It should be noted that the actual pearson correlation value for the input is -0.1945</p>