[fix](Nereids) scan should output all invisiable column (#23003)

This commit is contained in:
morrySnow
2023-08-16 18:07:59 +08:00
committed by GitHub
parent b815cf327a
commit 0594acfcf1
3 changed files with 3 additions and 13 deletions

View File

@ -20,7 +20,6 @@ package org.apache.doris.nereids.trees.plans.logical;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Table;
import org.apache.doris.common.util.Util;
import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.rules.rewrite.mv.AbstractSelectMaterializedIndexRule;
@ -33,20 +32,17 @@ import org.apache.doris.nereids.trees.plans.RelationId;
import org.apache.doris.nereids.trees.plans.algebra.OlapScan;
import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
import org.apache.doris.nereids.util.Utils;
import org.apache.doris.qe.ConnectContext;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Logical OlapScan.
@ -290,13 +286,7 @@ public class LogicalOlapScan extends LogicalCatalogRelation implements OlapScan
if (selectedIndexId != ((OlapTable) table).getBaseIndexId()) {
return getOutputByIndex(selectedIndexId);
}
List<Column> otherColumns = new ArrayList<>();
if (!Util.showHiddenColumns() && getTable().hasDeleteSign()
&& !ConnectContext.get().getSessionVariable()
.skipDeleteSign()) {
otherColumns.add(getTable().getDeleteSignColumn());
}
return Stream.concat(table.getBaseSchema().stream(), otherColumns.stream())
return table.getBaseSchema(true).stream()
.map(col -> {
if (cacheSlotWithSlotName.containsKey(col.getName())) {
return cacheSlotWithSlotName.get(col.getName());

View File

@ -93,7 +93,7 @@ class BindRelationTest extends TestWithFeService implements GeneratedPlanPattern
OlapTable externalOlapTable = new OlapTable(1, tableName, externalTableColumns, KeysType.DUP_KEYS,
new PartitionInfo(), new RandomDistributionInfo(10)) {
@Override
public List<Column> getBaseSchema() {
public List<Column> getBaseSchema(boolean full) {
return externalTableColumns;
}

View File

@ -106,7 +106,7 @@ class PruneOlapScanTabletTest implements MemoPatternMatchSupported {
olapTable.getPartitionIds();
result = ImmutableList.of(1L);
olapTable.getBaseSchema();
olapTable.getBaseSchema(true);
result = columns;
olapTable.getName();