Skip to content

Commit 604414e

Browse files
committed
Add comments.
1 parent e76a675 commit 604414e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sql/core/src/main/scala/org/apache/spark/sql/catalyst/SQLBuilder.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ class SQLBuilder private (
138138
case g: Generate =>
139139
generateToSQL(g)
140140

141+
// This prevents a pattern of `((...) AS gen_subquery_0 LIMIT 1)` which does not work.
142+
// For example, `SELECT * FROM (SELECT id FROM tbl TABLESAMPLE (2 ROWS))` makes this plan.
141143
case Limit(limitExpr, child: SubqueryAlias) =>
142144
s"${toSQL(child)} LIMIT ${limitExpr.sql}"
143145

0 commit comments

Comments
 (0)