inner-1374-bug:fix for explain doesn't work (#3024)

Signed-off-by: dcy <dcy10000@gmail.com>
This commit is contained in:
Rico
2021-12-22 16:51:55 +08:00
committed by GitHub
parent 10b236b7a6
commit fc28a28425
4 changed files with 3 additions and 5 deletions
@@ -312,7 +312,7 @@ public class JoinChooser {
}
continue traversal;
}
throw new MySQLOutPutException(ErrorCode.ER_OPTIMIZER, "", "can't create plan with wrong hint. please check near the node '" + nextHintNode.getName() + "'");
throw new MySQLOutPutException(ErrorCode.ER_OPTIMIZER, "", "can't create plan with this hint. please check near the node '" + nextHintNode.getName() + "'");
}
if (hintIt.hasNext()) {
@@ -58,7 +58,7 @@ public final class MyOptimizer {
node = FilterJoinColumnPusher.optimize(node);
if (SystemConfig.getInstance().isUseNewJoinOptimizer()) {
if (SystemConfig.getInstance().isUseNewJoinOptimizer() || !hintPlanInfo.isEmpty()) {
node = JoinProcessor.optimize(node, hintPlanInfo);
} else {
node = JoinERProcessor.optimize(node);
@@ -19,7 +19,6 @@ import com.actiontech.dble.config.model.sharding.table.ChildTableConfig;
import com.actiontech.dble.config.model.sharding.table.ShardingTableConfig;
import com.actiontech.dble.net.mysql.*;
import com.actiontech.dble.plan.node.PlanNode;
import com.actiontech.dble.plan.optimizer.HintPlanInfo;
import com.actiontech.dble.plan.optimizer.MyOptimizer;
import com.actiontech.dble.plan.util.ComplexQueryPlanUtil;
import com.actiontech.dble.plan.util.PlanUtil;
@@ -91,7 +90,7 @@ public final class ExplainHandler {
node.setSql(rrs.getStatement());
node.setUpFields();
PlanUtil.checkTablesPrivilege(service, node, ast);
node = MyOptimizer.optimize(node, new HintPlanInfo());
node = MyOptimizer.optimize(node, rrs.getHintPlanInfo());
if (!PlanUtil.containsSubQuery(node) && !visitor.isContainSchema()) {
node.setAst(ast);
@@ -44,7 +44,6 @@ public class JoinUseHintTest extends BaseSqlHintTest {
@Before
public void setUp() {
systemConfig.setUseNewJoinOptimizer(true);
}