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

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

     [ https://issues.apache.org/jira/browse/SPARK-15707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen updated SPARK-15707:
------------------------------
    Assignee: Weiqing Yang

> 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
>            Assignee: Weiqing Yang
>            Priority: Trivial
>             Fix For: 2.0.0
>
>
> 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