davidm-db commented on code in PR #49445:
URL: https://github.com/apache/spark/pull/49445#discussion_r1918845297


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala:
##########
@@ -251,9 +251,19 @@ trait ColumnResolutionHelper extends Logging with 
DataTypeErrorsBase {
     }
   }
 
+  /**
+   * Look up variable by nameParts. If in SQL Script, first check local 
variables,
+   * if not found fall back to session variables,
+   * unless in EXECUTE IMMEDIATE or specified otherwise by 
sessionVariablesOnlyOpt.
+   * @param nameParts NameParts of the variable.
+   * @param sessionVariablesOnlyOpt If None - include local variables unless 
in EXECUTE IMMEDIATE.
+   *                                If Some(false) - include local variables.
+   *                                If Some(true) - exclude local variables.
+   * @return Reference to the variable.
+   */
   def lookupVariable(
       nameParts: Seq[String],
-      sessionVariablesOnly: Boolean = false): Option[VariableReference] = {
+      sessionVariablesOnlyOpt: Option[Boolean] = None): 
Option[VariableReference] = {

Review Comment:
   Yup, my first thought as well. It's not pure use of Option, rather 
quick/hacky way to have 3 states.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to