srielau commented on code in PR #57251:
URL: https://github.com/apache/spark/pull/57251#discussion_r3587599464


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -2533,7 +2536,10 @@ case class AsOfJoin(
     condition: Option[Expression],
     joinType: JoinType,
     orderExpression: Expression,
-    toleranceAssertion: Option[Expression]) extends BinaryNode {
+    toleranceAssertion: Option[Expression],
+    usingColumns: Option[Seq[String]] = None,
+    matchComparison: Option[AsOfMatchCondition] = None)

Review Comment:
   Agreed — switched to plain `Expression` operand fields plus `matchOperator` 
on `AsOfJoin` in d6e12fa09d4. That drops the hand-rolled `mapExpressions` / 
`treePatternBits` overrides and lets `references` / `expressions` see the 
parsed operands. Follow-up analysis PR #57264 is rebased on top.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala:
##########
@@ -8466,6 +8475,8 @@ class SQLConf extends Serializable with Logging with 
SqlApiConf {
 
   def sortMergeAsOfJoinEnabled: Boolean = 
getConf(SORT_MERGE_AS_OF_JOIN_ENABLED)
 
+  def sqlAsOfJoinEnabled: Boolean = getConf(SQL_ASOF_JOIN_ENABLED)

Review Comment:
   Done in d6e12fa09d4: `AstBuilder.withAsOfJoin` now uses 
`conf.sqlAsOfJoinEnabled`.



##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -156,6 +156,30 @@
     ],
     "sqlState" : "42713"
   },
+  "ASOF_JOIN_MATCH_CONDITION_INVALID_EXPRESSION" : {

Review Comment:
   Those conditions are exercised in the stacked analysis PR #57264 
(`ResolveAsOfJoin`, `CheckAnalysis` for `AS_OF_JOIN.SORT_MERGE_REQUIRED`). I 
kept them here so the parser/analysis error surface lands together; happy to 
split if you prefer one condition per PR.



##########
sql/core/src/test/scala/org/apache/spark/sql/AsOfJoinSQLSuite.scala:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql
+
+import org.apache.spark.sql.catalyst.parser.ParseException
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.SharedSparkSession
+
+/**
+ * SQL ASOF JOIN surface tests (parser and feature gating).
+ * Execution semantics and complex MATCH_CONDITION types are covered by
+ * [[AsOfJoinSortMergeSQLSuite]], which requires sort-merge ASOF join.

Review Comment:
   Fixed in d6e12fa09d4 — forward reference is now backticks.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -2564,6 +2584,27 @@ case class AsOfJoin(
 
   final override val nodePatterns: Seq[TreePattern] = Seq(AS_OF_JOIN)
 
+  /**
+   * [[AsOfMatchCondition]] is not an [[Expression]], so the default 
[[mapExpressions]] path does
+   * not rewrite its operand trees. Analysis rules must still reach those 
operands once
+   * [[org.apache.spark.sql.catalyst.analysis.ResolveAsOfJoin]] is introduced.

Review Comment:
   Resolved by removing the forward-reference scaladoc block entirely once the 
operands became plain `Expression` fields (no special `mapExpressions` note 
needed).



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