Added cast to real for LN function in Redshift ('numeric' type not supported on compute nodes).