maropu commented on a change in pull request #32303:
URL: https://github.com/apache/spark/pull/32303#discussion_r647229290



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -871,7 +871,13 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with 
SQLConfHelper with Logg
   override def visitFromClause(ctx: FromClauseContext): LogicalPlan = 
withOrigin(ctx) {
     val from = ctx.relation.asScala.foldLeft(null: LogicalPlan) { (left, 
relation) =>
       val right = plan(relation.relationPrimary)
-      val join = right.optionalMap(left)(Join(_, _, Inner, None, 
JoinHint.NONE))
+      val join = right.optionalMap(left) { (left, right) =>
+        if (relation.LATERAL != null) {
+          LateralJoin(left, LateralSubquery(right), Inner, None)

Review comment:
       Hints exist for the physical planner and the planner does not tell a 
difference between normal joins and lateral joins (cuz the optimizer rewrites 
lateral join into normal ones), so adding hints for this case makes sense to 
me. In fact, I think users will eventually want to control physical joins types 
for lateral joins, too, to tune user's queries for their workloads. Anyway, 
since this is an improvement, I think it is okay to fix it in follow-up.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to