[Fix](statistics)Fix analyze min max sql syntax error. #26240

This commit is contained in:
Jibing-Li
2023-11-02 09:22:32 +08:00
committed by GitHub
parent a4e415ab09
commit 80f654ec2a
3 changed files with 13 additions and 13 deletions

View File

@ -242,7 +242,7 @@ public abstract class BaseAnalysisTask {
// Min value is not accurate while sample, so set it to NULL to avoid optimizer generate bad plan.
protected String getMinFunction() {
if (tableSample == null) {
return "MIN(CAST(min AS ${type}))";
return "CAST(MIN(`${colName}`) as ${type}) ";
} else {
return "NULL ";
}
@ -251,7 +251,7 @@ public abstract class BaseAnalysisTask {
// Max value is not accurate while sample, so set it to NULL to avoid optimizer generate bad plan.
protected String getMaxFunction() {
if (tableSample == null) {
return "MAX(CAST(min AS ${type}))";
return "CAST(MAX(`${colName}`) as ${type}) ";
} else {
return "NULL ";
}