You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Weiqing Yang (JIRA)" <ji...@apache.org> on 2016/06/01 18:07:59 UTC

[jira] [Created] (SPARK-15707) Make Code Neat - Use map instead of if check

Weiqing Yang created SPARK-15707:
------------------------------------

             Summary: Make Code Neat - Use map instead of if check
                 Key: SPARK-15707
                 URL: https://issues.apache.org/jira/browse/SPARK-15707
             Project: Spark
          Issue Type: Improvement
          Components: SQL
            Reporter: Weiqing Yang
            Priority: Trivial


In forType function of object RandomDataGenerator, there is a piece of code as following:
--------
if (maybeSqlTypeGenerator.isDefined) {
   val sqlTypeGenerator = maybeSqlTypeGenerator.get
   val generator = () => {
    ….
   }
   Some(generator)
} else {
  None
}
-------
It is better to use maybeSqlTypeGenerator.map instead of ‘if … else …’ above since ‘map’ has ‘if … else …’ inside itself. That will make code neat. 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org