fix mysql hints
@@ -330,12 +330,12 @@ impl<W: std::io::Write> InteractiveWorkerBase<W> {
let stmts_hints =
DfParser::parse_sql(query, context.get_current_session().get_type());
- let mut hints = vec![];
+ let hints = match &stmts_hints {
+ Ok((_, h)) => h.clone(),
+ Err(_) => vec![],
+ };
let mut has_result_set = false;
- let interpreter: Result<Arc<dyn Interpreter>>;
- if let Ok((stmts, h)) = stmts_hints {
- hints = h;
- interpreter = if use_planner_v2(&settings, &stmts)? {
+ let interpreter = if use_planner_v2(&settings, &stmts_hints)? {
let mut planner = Planner::new(context.clone());
planner.plan_sql(query).await.and_then(|v| {
has_result_set = has_result_set_by_plan(&v.0);
@@ -348,18 +348,6 @@ impl<W: std::io::Write> InteractiveWorkerBase<W> {
InterpreterFactory::get(context.clone(), v)
})
};
- } else if settings.get_enable_planner_v2()? != 0 {
- // If old parser failed, try new planner
- let mut planner = Planner::new(context.clone());
- interpreter = planner.plan_sql(query).await.and_then(|v| {
- has_result_set = has_result_set_by_plan(&v.0);
- InterpreterFactoryV2::get(context.clone(), &v.0)
- });
- } else {
- return Err(stmts_hints
- .err()
- .ok_or_else(|| ErrorCode::LogicalError("stmts_hints must be error"))?);
- }
let hint = hints
.iter()
