[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=15310827#comment-15310827 ] Apache Spark commented on SPARK-15707: -- User 'Sherry302' has created a pull request for this issue: https://github.com/apache/spark/pull/13448 > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[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=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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org