agavra commented on PR #9895:
URL: https://github.com/apache/pinot/pull/9895#issuecomment-1335927107
@61yao instead of an optimization rule it should be implemented as a
rewriter. I tested this and it works:
```java
public class RightJoinRewriter extends SqlShuttle {
public SqlNode visit(SqlCall call) {
if (call instanceof SqlJoin) {
SqlJoin join = (SqlJoin) call;
if (join.getJoinType() == JoinType.RIGHT) {
return super.visit(new SqlJoin(
call.getParserPosition(),
join.getRight(),
join.isNaturalNode(),
SqlLiteral.createSymbol(JoinType.LEFT,
join.getJoinTypeNode().getParserPosition()),
join.getLeft(),
join.getConditionTypeNode(),
join.getCondition()));
}
}
return super.visit(call);
}
}
```
And then I modified `CalciteSqlParser#extractSqlNodeAndOptions` to apply
this rewriter:
```java
return new SqlNodeAndOptions(statementNode.accept(new
RightJoinRewriter()), sqlType, options);
```
--
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]