[Opt](exec) enable top opt in string type (#31489)

enable top opt in string type
This commit is contained in:
HappenLee
2024-02-28 17:34:10 +08:00
committed by yiguolei
parent 3ca412efe3
commit 8633a0c0cc
4 changed files with 4 additions and 19 deletions

View File

@ -127,8 +127,7 @@ public class TopNScanOpt extends PlanPostProcessor {
if (!firstKey.isColumnFromTable()) {
return topN;
}
if (firstKey.getDataType().isStringLikeType()
|| firstKey.getDataType().isFloatType()
if (firstKey.getDataType().isFloatType()
|| firstKey.getDataType().isDoubleType()) {
return topN;
}

View File

@ -543,8 +543,7 @@ public class OriginalPlanner extends Planner {
&& sortNode.getLimit() <= ConnectContext.get().getSessionVariable().topnOptLimitThreshold
&& sortNode.getSortInfo().getOrigOrderingExprs().size() > 0) {
Expr firstSortExpr = sortNode.getSortInfo().getOrigOrderingExprs().get(0);
if (firstSortExpr instanceof SlotRef && !firstSortExpr.getType().isStringType()
&& !firstSortExpr.getType().isFloatingPointType()) {
if (firstSortExpr instanceof SlotRef && !firstSortExpr.getType().isFloatingPointType()) {
OlapScanNode scanNode = (OlapScanNode) child;
if (scanNode.isDupKeysOrMergeOnWrite()) {
sortNode.setUseTopnOpt(true);