godfreyhe commented on code in PR #20697: URL: https://github.com/apache/flink/pull/20697#discussion_r961506252
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/calcite/FlinkPlannerImpl.scala: ########## @@ -193,17 +193,22 @@ class FlinkPlannerImpl( private def rel(validatedSqlNode: SqlNode, sqlValidator: FlinkCalciteSqlValidator) = { try { assert(validatedSqlNode != null) - val sqlToRelConverter: SqlToRelConverter = createSqlToRelConverter(sqlValidator) - // check whether this SqlNode tree contains join hints val checkContainJoinHintShuttle = new CheckContainJoinHintShuttle validatedSqlNode.accept(checkContainJoinHintShuttle) - checkContainJoinHintShuttle.containsJoinHint - - // TODO currently, it is a relatively hacked way to tell converter - // that this SqlNode tree contains join hints - if (checkContainJoinHintShuttle.containsJoinHint) { - sqlToRelConverter.containsJoinHint() + val sqlToRelConverter: SqlToRelConverter = if (checkContainJoinHintShuttle.containsJoinHint) { + val converter = createSqlToRelConverter( + sqlValidator, + // disable project merge during sql to rel phase to prevent + // incorrect propagation of join hints into child query block + sqlToRelConverterConfig.addRelBuilderConfigTransform(c => c.withBloat(-1)) + ) + // TODO currently, it is a relatively hacked way to tell converter + // that this SqlNode tree contains join hints + converter.containsJoinHint() + converter + } else { + createSqlToRelConverter(sqlValidator, sqlToRelConverterConfig) Review Comment: In theory, the plan is different with hint or not in streaming jobs, which will affect state compatibility. How about, we disable project merge for all queries ? -- 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