Commit
1630d64cab216f1404bf0940483ec3ecb86732d1
by wenchen[SPARK-31225][SQL][2.4] Override sql method of OuterReference
### What changes were proposed in this pull request?
Per https://github.com/apache/spark/pull/32179#issuecomment-822954063 's request to backport SPARK-31225 to branch 2.4
### Why are the changes needed?
### Does this PR introduce _any_ user-facing change?
### How was this patch tested?
Closes #32256 from yaooqinn/SPARK-31225.
Authored-by: Kent Yao <yao@apache.org>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>