godfreyhe commented on a change in pull request #17436: URL: https://github.com/apache/flink/pull/17436#discussion_r732541865
########## File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExpressionReducer.scala ########## @@ -254,6 +233,59 @@ class ExpressionReducer( targetType, true) } + + /** + * skip the expressions that can't be reduced now + * and validate the expressions + */ + private def skipAndValidateExprs( + rexBuilder: RexBuilder, + constExprs: java.util.List[RexNode], + pythonUDFExprs: ListBuffer[RexNode]): List[RexNode] ={ + constExprs.asScala.map(e => (e.getType.getSqlTypeName, e)).flatMap { + + // Skip expressions that contain python functions because it's quite expensive to + // call Python UDFs during optimization phase. They will be optimized during the runtime. + case (_, e) if containsPythonCall(e) => + pythonUDFExprs += e + None + + // we don't support object literals yet, we skip those constant expressions + case (SqlTypeName.ANY, _) | + (SqlTypeName.OTHER, _) | + (SqlTypeName.ROW, _) | + (SqlTypeName.STRUCTURED, _) | + (SqlTypeName.ARRAY, _) | + (SqlTypeName.MAP, _) | + (SqlTypeName.MULTISET, _) => None + + case (_, call: RexCall) => { + // Exclude some JSON functions which behave differently + // when called as an argument of another call of one of these functions. + if (nonReducibleJsonFunctions.contains(call.getOperator)) { + None Review comment: should add `return`, otherwise it will return `Some(call)` -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org