Github user dongjoon-hyun commented on a diff in the pull request: https://github.com/apache/spark/pull/20803#discussion_r176316669 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala --- @@ -635,7 +637,8 @@ class SparkSession private( * @since 2.0.0 */ def sql(sqlText: String): DataFrame = { - Dataset.ofRows(self, sessionState.sqlParser.parsePlan(sqlText)) + Dataset.ofRows(self, sessionState.sqlParser.parsePlan(sqlText), + substitutor.substitute(sqlText)) --- End diff -- BTW, in general, the initial SQL texts easily become meaningless when another operations are added. In your example, the following case shows a misleading and wrong SQL statement instead of *real executed SQL plan*. ```scala val df = spark.sql("xxxxx") df.filter(...).collect() // shows sql text "xxxxx" ``` As another example, please try the following. It will show you `select a,b from t1`. ``` scala> spark.sql("select a,b from t1").select("a").show ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org