Cherry-picked from #51472 Co-authored-by: Pxl <xl@selectdb.com>
This commit is contained in:
committed by
GitHub
parent
1ee58b216b
commit
c9623c32f0
@ -2753,9 +2753,9 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
|
||||
if (sortExpr instanceof SlotRef) {
|
||||
SlotRef slotRef = (SlotRef) sortExpr;
|
||||
if (sortColumn.equals(slotRef.getColumn())) {
|
||||
// ORDER BY DESC NULLS FIRST can not be optimized to only read file tail,
|
||||
// since NULLS is at file head but data is at tail
|
||||
if (sortColumn.isAllowNull() && nullsFirsts.get(i) && !isAscOrders.get(i)) {
|
||||
// [ORDER BY DESC NULLS FIRST] or [ORDER BY ASC NULLS LAST] can not be optimized
|
||||
// to only read file tail, since NULLS is at file head but data is at tail
|
||||
if (sortColumn.isAllowNull() && nullsFirsts.get(i) != isAscOrders.get(i)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1235,9 +1235,9 @@ public class OlapScanNode extends ScanNode {
|
||||
if (sortExpr instanceof SlotRef) {
|
||||
SlotRef slotRef = (SlotRef) sortExpr;
|
||||
if (tableKey.equals(slotRef.getColumn())) {
|
||||
// ORDER BY DESC NULLS FIRST can not be optimized to only read file tail,
|
||||
// since NULLS is at file head but data is at tail
|
||||
if (tableKey.isAllowNull() && nullsFirsts.get(i) && !isAscOrders.get(i)) {
|
||||
// [ORDER BY DESC NULLS FIRST] or [ORDER BY ASC NULLS LAST] can not be optimized
|
||||
// to only read file tail, since NULLS is at file head but data is at tail
|
||||
if (tableKey.isAllowNull() && (nullsFirsts.get(i) != isAscOrders.get(i))) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user