[fix](sort)order by constant expr bug (#13613)

Issue Number: close (#13350)
This commit is contained in:
starocean999
2022-10-25 16:43:18 +08:00
committed by GitHub
parent b85c78ee00
commit e103531e69
2 changed files with 17 additions and 0 deletions

View File

@ -1406,7 +1406,15 @@ public class SelectStmt extends QueryStmt {
}
if (orderByElements != null) {
for (OrderByElement orderByElem : orderByElements) {
// we must make sure the expr is analyzed before rewrite
try {
orderByElem.getExpr().analyze(analyzer);
} catch (AnalysisException ex) {
//ignore any exception
}
orderByElem.setExpr(rewriter.rewrite(orderByElem.getExpr(), analyzer));
// after rewrite, need reset the analyze status for later re-analyze
orderByElem.getExpr().reset();
}
}
}