Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner, executor: union type should consider the unspecified #26534

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,12 @@ func (b *PlanBuilder) buildDistinct(child LogicalPlan, length int) (*LogicalAggr

// unionJoinFieldType finds the type which can carry the given types in Union.
func unionJoinFieldType(a, b *types.FieldType) *types.FieldType {
// Skip null check.
if a.Tp == mysql.TypeNull {
return b
} else if b.Tp == mysql.TypeNull {
return a
}
resultTp := types.NewFieldType(types.MergeFieldType(a.Tp, b.Tp))
// This logic will be intelligible when it is associated with the buildProjection4Union logic.
if resultTp.Tp == mysql.TypeNewDecimal {
Expand Down