suibianwanwank commented on code in PR #3883:
URL: https://github.com/apache/calcite/pull/3883#discussion_r1712390302
##########
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:
I'm guessing that the checks here refer to snowflake's specification, i.e.
"ON clause for ASOF JOIN must contain conjunctions of equality conditions only.
Each side of an equality condition must only refer to either the left table or
the right table. (S.STATE = P.STATE) OR (S.LOCATION = P.LOCATION) is invalid."
We expect that condition needs to satisfy
`l.c1 = r.c1 and l.c2 = r.c2`
But if you just check if sqlcall is equal / and, may a case like the
following would also pass, if the types of c1 and c2 would both be boolean
`(l.c1 and r.c1 ) and (l.c2 and r.c2 )`
--
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]