Skip to content

Commit

Permalink
planner: return an error when meeting unexpected operator under Union…
Browse files Browse the repository at this point in the history
…Scan (#53956) (#53971)

ref #53951
  • Loading branch information
ti-chi-bot authored Aug 1, 2024
1 parent 20acb79 commit a8dd684
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1353,9 +1353,14 @@ func (b *executorBuilder) buildUnionScanFromReader(reader exec.Executor, v *plan
us.columns = x.columns
us.table = x.table
us.virtualColumnIndex = buildVirtualColumnIndex(us.Schema(), us.columns)
default:
// The mem table will not be written by sql directly, so we can omit the union scan to avoid err reporting.
case *PointGetExecutor, *BatchPointGetExec, // PointGet and BatchPoint can handle virtual columns and dirty txn data themselves.
*TableDualExec, // If TableDual, the result must be empty, so we can skip UnionScan and use TableDual directly here.
*TableSampleExecutor: // TableSample only supports sampling from disk, don't need to consider in-memory txn data for simplicity.
return originReader
default:
// TODO: consider more operators like Projection.
b.err = errors.NewNoStackErrorf("unexpected operator %T under UnionScan", reader)
return nil
}
return us
}
Expand Down Expand Up @@ -4080,6 +4085,9 @@ func (builder *dataReaderBuilder) buildUnionScanForIndexJoin(ctx context.Context
}

ret := builder.buildUnionScanFromReader(reader, v)
if builder.err != nil {
return nil, builder.err
}
if us, ok := ret.(*UnionScanExec); ok {
err = us.open(ctx)
}
Expand Down

0 comments on commit a8dd684

Please sign in to comment.