mihaibudiu commented on code in PR #4719:
URL: https://github.com/apache/calcite/pull/4719#discussion_r2673324587
##########
core/src/main/java/org/apache/calcite/sql/SqlDialect.java:
##########
@@ -812,6 +812,11 @@ public RexNode prepareUnparse(RexNode rexNode) {
return rexNode;
}
+ /** Rewrites a boolean literal to 1 or 0. */
Review Comment:
I don't think the JavaDoc should prescribe how the literal should be
rewritten; it may be dialect dependent.
Just document that this is a hook that gives a dialect the opportunity to
rewrite a literal.
##########
core/src/main/java/org/apache/calcite/sql/SqlDialect.java:
##########
@@ -812,6 +812,11 @@ public RexNode prepareUnparse(RexNode rexNode) {
return rexNode;
}
+ /** Rewrites a boolean literal to 1 or 0. */
Review Comment:
The main problem with this approach is that you may want a different rewrite
depending on the context. As the previous PR in this series said, you may want
to rewrite to `1=1` when the context allows it.
So how about providing a boolean flag "expressionAllowed"?
--
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]