[SPARK-3418] Code review comments addressed and multiplication further optimized