[enhancement](index) Nereids support no need to read raw data for index column that only in filter conditions (#20605)
This commit is contained in:
@ -572,50 +572,16 @@ public class OriginalPlanner extends Planner {
|
||||
* column unique id for `A` and `B` will put into outputColumnUniqueIds.
|
||||
*
|
||||
*/
|
||||
// this opt will only work with nereidsPlanner
|
||||
private void pushOutColumnUniqueIdsToOlapScan(PlanFragment rootFragment, Analyzer analyzer) {
|
||||
Set<Integer> outputColumnUniqueIds = new HashSet<>();
|
||||
ArrayList<Expr> outputExprs = rootFragment.getOutputExprs();
|
||||
for (Expr expr : outputExprs) {
|
||||
if (expr instanceof SlotRef) {
|
||||
if (((SlotRef) expr).getColumn() != null) {
|
||||
outputColumnUniqueIds.add(((SlotRef) expr).getColumn().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// add '-1' to avoid the optimization incorrect work with OriginalPlanner,
|
||||
// because in the storage layer will skip this optimization if outputColumnUniqueIds contains '-1',
|
||||
// to ensure the optimization only correct work with nereidsPlanner
|
||||
outputColumnUniqueIds.add(-1);
|
||||
|
||||
for (PlanFragment fragment : fragments) {
|
||||
PlanNode node = fragment.getPlanRoot();
|
||||
PlanNode parent = null;
|
||||
while (node.getChildren().size() != 0) {
|
||||
for (PlanNode childNode : node.getChildren()) {
|
||||
List<SlotId> outputSlotIds = childNode.getOutputSlotIds();
|
||||
if (outputSlotIds != null) {
|
||||
for (SlotId sid : outputSlotIds) {
|
||||
SlotDescriptor slotDesc = analyzer.getSlotDesc(sid);
|
||||
outputColumnUniqueIds.add(slotDesc.getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// OlapScanNode is the last node.
|
||||
// So, just get the two node and check if they are SortNode and OlapScan.
|
||||
parent = node;
|
||||
node = node.getChildren().get(0);
|
||||
}
|
||||
|
||||
if (parent instanceof SortNode) {
|
||||
SortNode sortNode = (SortNode) parent;
|
||||
List<Expr> orderingExprs = sortNode.getSortInfo().getOrigOrderingExprs();
|
||||
if (orderingExprs != null) {
|
||||
for (Expr expr : orderingExprs) {
|
||||
if (expr instanceof SlotRef) {
|
||||
if (((SlotRef) expr).getColumn() != null) {
|
||||
outputColumnUniqueIds.add(((SlotRef) expr).getColumn().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(node instanceof OlapScanNode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user