mihaibudiu commented on code in PR #3883:
URL: https://github.com/apache/calcite/pull/3883#discussion_r1714727145


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -3774,11 +3780,130 @@ protected void validateJoin(SqlJoin join, 
SqlValidatorScope scope) {
             RESOURCE.crossJoinDisallowsCondition());
       }
       break;
+    case LEFT_ASOF:
+    case ASOF: {
+      // In addition to the standard join checks, the ASOF join requires the
+      // ON conditions to be a conjunction of simple equalities from both 
relations.
+      SqlAsofJoin asof = (SqlAsofJoin) join;
+      SqlNode matchCondition = getMatchCondition(asof);
+      matchCondition = expand(matchCondition, joinScope);
+      join.setOperand(6, matchCondition);
+      validateWhereOrOn(joinScope, matchCondition, "MATCH_CONDITION");
+      ConjunctionOfEqualities conj = new ConjunctionOfEqualities();

Review Comment:
   Unfortunately I can't reuse RelOptUtil because that works on RexNode, and 
here I only have SqlNode objects.
   I will improve the ConjunctionOfEqualities visitor.



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

Reply via email to