kennknowles commented on a change in pull request #14015:
URL: https://github.com/apache/beam/pull/14015#discussion_r578759303



##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLQueryPlanner.java
##########
@@ -160,8 +165,10 @@ static boolean hasOnlyJavaUdfInProjects(RelOptRuleCall x) {
               SqlUserDefinedFunction udf = (SqlUserDefinedFunction) call.op;
               if (udf.function instanceof ZetaSqlScalarFunctionImpl) {
                 ZetaSqlScalarFunctionImpl scalarFunction = 
(ZetaSqlScalarFunctionImpl) udf.function;
-                if (!scalarFunction.functionGroup.equals(
+                if (scalarFunction.functionGroup.equals(
                     SqlAnalyzer.USER_DEFINED_JAVA_SCALAR_FUNCTIONS)) {
+                  udfs.add(i);
+                } else {

Review comment:
       However, it would be a normal approach to low-level code (like the 
`Program` object) to use SSA / A-normal form so that there is no nested 
expression. I just don't know what Calcite guarantees.
   
   That would cause the project to be turned into:
   
   ```
   x = 1 + 1
   y = increment(x)
   ```
   
   Then recursion is not needed.




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