[CALCITE-6641] Compiling programs with ASOF joins can report obscure errors#4015
[CALCITE-6641] Compiling programs with ASOF joins can report obscure errors#4015mihaibudiu merged 1 commit intoapache:mainfrom
Conversation
caicancai
left a comment
There was a problem hiding this comment.
I don't really understand this part, but the code looks good
| @Override public @Nullable SqlNode visit(final SqlCall call) { | ||
| SqlKind kind = call.getKind(); | ||
| if (kind != SqlKind.AND && kind != SqlKind.EQUALS) { | ||
| if (kind != SqlKind.AND && kind != SqlKind.EQUALS && kind != SqlKind.CAST) { |
There was a problem hiding this comment.
It would be nice if you could explain why SqlKind cannot be equal to these types
There was a problem hiding this comment.
The JavaDoc says "shuttle which determines whether an expression is a simple conjunction of equalities". AND is conjunction, and EQUALS is equalities. CAST is only allowed when applied to field names.
| SqlKind kind = call.getKind(); | ||
| if (kind != SqlKind.AND && kind != SqlKind.EQUALS) { | ||
| if (kind != SqlKind.AND && kind != SqlKind.EQUALS && kind != SqlKind.CAST) { | ||
| illegal = true; |
There was a problem hiding this comment.
I check the checkAnd(call) and this method, Maybe we can exit directly when we find the illegal value is true.
There was a problem hiding this comment.
Some minor advice:
- SqlValidatorImpl#validateJoin(Line#3784). There is an extra
{}behind the ASOF. - ConjunctionOfEqualities#checkAnd method's java comment. Before
ChildrenThere is an extra space.
There was a problem hiding this comment.
the extra {} are actually useful, they create a local scope, and the variables in the local scope do not interfere with variables from the rest of the function. It also prevents accidental updates to other variables that may be in scope. If also helps with the debugger too: such variables go out of scope when the inner scope {} terminates, so in large functions with lots of variables it makes the debugging experience better. I use this trick a lot when I have to write very large functions.
…errors Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
|



No description provided.