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:09:59 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=15310794#comment-15310794 ]
Weiqing Yang commented on SPARK-15707:
--------------------------------------
I am going to send pull request for review.
> 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