dilipbiswal commented on code in PR #55629:
URL: https://github.com/apache/spark/pull/55629#discussion_r3184299232


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -2362,39 +2362,68 @@ class AstBuilder extends DataTypeAstBuilder
         }
       }
 
-      // Resolve the join type and join condition
-      val (joinType, condition) = Option(ctx.joinCriteria) match {
-        case Some(c) if c.USING != null =>
-          if (ctx.LATERAL != null) {
-            throw 
QueryParsingErrors.lateralJoinWithUsingJoinUnsupportedError(ctx)
+      if (ctx.nearestByClause != null) {
+        if (ctx.LATERAL != null) {
+          throw 
QueryParsingErrors.nearestByJoinWithLateralUnsupportedError(ctx)
+        }
+        if (!Seq(Inner, LeftOuter).contains(baseJoinType)) {
+          throw QueryParsingErrors.unsupportedNearestByJoinTypeError(
+            ctx, baseJoinType.sql, NearestByJoinType.supportedDisplay)
+        }
+        val clause = ctx.nearestByClause
+        val approx = clause.APPROX != null
+        val numResults = Option(clause.num).map { n =>
+          // Guard against literals that overflow Long.
+          val value = try n.getText.toLong catch {

Review Comment:
   @dtenedor  No — only NumberFormatException is reachable here. The num token 
comes from the INTEGER_VALUE lexer rule (DIGIT+). wdyt ?



-- 
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: [email protected]

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