amaliujia commented on a change in pull request #12400:
URL: https://github.com/apache/beam/pull/12400#discussion_r462466818



##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLQueryPlanner.java
##########
@@ -93,6 +95,13 @@ 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 a Calc before merging with other Projec/Filter/Calc. Thus we 
should not add

Review comment:
       Tried to add something about `CalcMergeRule`

##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLQueryPlanner.java
##########
@@ -93,6 +95,13 @@ 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 a Calc before merging with other Projec/Filter/Calc. Thus we 
should not add

Review comment:
       Done.




----------------------------------------------------------------
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]


Reply via email to