apilloud commented on a change in pull request #12400:
URL: https://github.com/apache/beam/pull/12400#discussion_r465286741
##########
File path:
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLQueryPlanner.java
##########
@@ -93,6 +95,14 @@ public ZetaSQLQueryPlanner(JdbcConnection jdbcConnection,
RuleSet[] ruleSets) {
// requires the JoinCommuteRule, which doesn't work without struct
flattening.
if (rule instanceof JoinCommuteRule) {
continue;
+ } else if (rule instanceof FilterCalcMergeRule || rule instanceof
ProjectCalcMergeRule) {
+ // In order to support Java UDF, we need both BeamZetaSqlCalcRel and
BeamCalcRel. It is
+ // because BeamZetaSqlCalcRel can execute ZetaSQL built-in functions
while BeamCalcRel
+ // can execute UDFs. So during planning, we expect both Filter and
Project are converted
+ // to Calc nodes before merging with other Project/Filter/Calc
nodes. Thus we should not
+ // add FilterCalcMergeRule and ProjectCalcMergeRule. CalcMergeRule
will achieve equivalent
+ // planning result eventually.
Review comment:
Shouldn't we just disable these rules all together (in
`BeamRuleSets.java`) if they are redundant instead of special casing them for
ZetaSQL?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]