Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwenchi committed Mar 6, 2025
1 parent 9fbc726 commit f8ab162
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public void init(Analyzer analyzer) throws UserException {
// For Nereids
@Override
public void init() throws UserException {
if (columns == null && desc.getTable() != null) {
columns = desc.getTable().getColumns();
}
computeColumnsFilter();
initBackendPolicy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ private void setColumnPositionMapping()
}
SlotDescriptor slotDesc = desc.getSlot(slot.getSlotId());
String colName = slotDesc.getColumn().getName();
int idx = tbl.getBaseColumnIdxByName(colName); // TODO mmc 改成从成员变量里的schema获取,也就不需要获取table了?除非是为了打印log
int idx = -1; // TODO mmc 改成从成员变量里的schema获取,也就不需要获取table了?除非是为了打印log
for (int i = 0; i < columns.size(); i++) {
if (columns.get(i).getName().equals(colName)) {
idx = i;
break;
}
}
if (idx == -1) {
throw new UserException("Column " + colName + " not found in table " + tbl.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected void setDefaultValueExprs(TableIf tbl,
TExpr tExpr = new TExpr();
tExpr.setNodes(Lists.newArrayList());

for (Column column : tbl.getBaseSchema()) { // TODO mmc 使用schema变量,别再去get了
for (Column column : columns) { // TODO mmc 使用schema变量,别再去get了
Expr expr;
if (column.getDefaultValue() != null) {
if (column.getDefaultValueExprDef() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public abstract class ScanNode extends PlanNode implements SplitGenerator {
protected final List<SortNode> topnFilterSortNodes = Lists.newArrayList();

protected TableSnapshot tableSnapshot;
protected List<Column> columns;

// Save the id of backends which this scan node will be executed on.
// This is also important for local shuffle logic.
Expand All @@ -124,6 +125,9 @@ public ScanNode(PlanNodeId id, TupleDescriptor desc, String planNodeName, Statis
@Override
public void init(Analyzer analyzer) throws UserException {
super.init(analyzer);
if (desc.getTable() != null) {
columns = desc.getTable().getBaseSchema();
}
this.analyzer = analyzer;
// materialize conjuncts in where
analyzer.materializeSlots(conjuncts);
Expand Down Expand Up @@ -233,7 +237,7 @@ public void computeColumnsFilter() {
// for load scan node, table is null
// partitionsInfo maybe null for other scan node, eg: ExternalScanNode...
if (desc.getTable() != null) {
computeColumnsFilter(desc.getTable().getBaseSchema(), partitionsInfo);
computeColumnsFilter(columns, partitionsInfo);
}
}

Expand Down

0 comments on commit f8ab162

Please sign in to comment.