Skip to content

Commit

Permalink
fix traslate bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LiBinfeng-01 committed Nov 26, 2024
1 parent f0c9882 commit 4e374d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.doris.nereids.trees.plans.commands;

import org.apache.doris.analysis.Expr;
import org.apache.doris.analysis.SlotRef;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.analyzer.UnboundSlot;
Expand Down Expand Up @@ -69,7 +70,16 @@ public Expr translateToLegacyExpr(ConnectContext ctx, Expression expression) {
CascadesContext cascadesContext = CascadesContext.initContext(ctx.getStatementContext(), plan,
PhysicalProperties.ANY);
PlanTranslatorContext planTranslatorContext = new PlanTranslatorContext(cascadesContext);
return ExpressionTranslator.translate(expression, planTranslatorContext);
ExpressionToExpr translator = new ExpressionToExpr();
return expression.accept(translator, planTranslatorContext);
}

private static class ExpressionToExpr extends ExpressionTranslator {
@Override
public Expr visitUnboundSlot(UnboundSlot unboundSlot, PlanTranslatorContext context) {
String inputCol = unboundSlot.getName();
return new SlotRef(null, inputCol);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public void run(ConnectContext ctx, StmtExecutor executor) throws Exception {
validate(ctx);
CancelExportStmt cancelStmt = null;
if (whereClause instanceof CompoundPredicate) {
cancelStmt = new CancelExportStmt(dbName, legacyWhereClause, label, null, state);
} else {
cancelStmt = new CancelExportStmt(dbName, legacyWhereClause, label,
((org.apache.doris.analysis.CompoundPredicate) legacyWhereClause).getOp(), state);
((org.apache.doris.analysis.CompoundPredicate) legacyWhereClause).getOp(), state);
} else {
cancelStmt = new CancelExportStmt(dbName, legacyWhereClause, label, null, state);
}
ctx.getEnv().getExportMgr().cancelExportJob(cancelStmt);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public void run(ConnectContext ctx, StmtExecutor executor) throws Exception {
validate(ctx);
CancelLoadStmt cancelStmt = null;
if (whereClause instanceof CompoundPredicate) {
cancelStmt = new CancelLoadStmt(dbName, legacyWhereClause, label, null, state);
} else {
cancelStmt = new CancelLoadStmt(dbName, legacyWhereClause, label,
((org.apache.doris.analysis.CompoundPredicate) legacyWhereClause).getOp(), state);
} else {
cancelStmt = new CancelLoadStmt(dbName, legacyWhereClause, label, null, state);
}
try {
ctx.getEnv().getJobManager().cancelLoadJob(cancelStmt);
Expand Down

0 comments on commit 4e374d5

Please sign in to comment.