xuyangzhong commented on code in PR #20697:
URL: https://github.com/apache/flink/pull/20697#discussion_r965884806
##########
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:
If we do this for all queries, many sqls will suffers for this fix. How
about disabling merging project in another issue? I have created one for it.
https://issues.apache.org/jira/browse/FLINK-29221
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]