[ https://issues.apache.org/jira/browse/SPARK-51396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated SPARK-51396: ----------------------------------- Labels: pull-request-available (was: ) > Avoid exceptions for control flow in RuntimeConfig.getOption > ------------------------------------------------------------ > > Key: SPARK-51396 > URL: https://issues.apache.org/jira/browse/SPARK-51396 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 4.0.0 > Reporter: Josh Rosen > Assignee: Josh Rosen > Priority: Major > Labels: pull-request-available > > RuntimeConfig.getOption is defined as > > {code:java} > /** @inheritdoc */ > def getOption(key: String): Option[String] = { > try Option(get(key)) catch { > case _: NoSuchElementException => None > } > } {code} > which is bad because it uses exceptions for control flow. > > This can be a performance problem in case `getOption` is called in a hot path. > It's usually not a good idea to perform configuration lookups at a high rate > (e.g. in a hot loop). But occasionally there's code which _will_ do that and > a small fix to not use exceptions here can help mitigate the perf. impact of > such uses. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org