diff --git a/pkg/sql/colexec/parallel_unordered_synchronizer.go b/pkg/sql/colexec/parallel_unordered_synchronizer.go index c2a07b8f3d92..c89405b011c3 100644 --- a/pkg/sql/colexec/parallel_unordered_synchronizer.go +++ b/pkg/sql/colexec/parallel_unordered_synchronizer.go @@ -23,9 +23,10 @@ import ( "github.com/cockroachdb/errors" ) -// unorderedSynchronizerMsg is a light wrapper over a coldata.Batch sent over a -// channel so that the main goroutine can know which input this message -// originated from. +// unorderedSynchronizerMsg is a light wrapper over a coldata.Batch or metadata +// sent over a channel so that the main goroutine can know which input this +// message originated from. +// Note that either a batch or metadata must be sent, but not both. type unorderedSynchronizerMsg struct { inputIdx int b coldata.Batch @@ -237,6 +238,11 @@ func (s *ParallelUnorderedSynchronizer) init(ctx context.Context) { // In case of a zero-length batch, proceed to drain the input. fallthrough case parallelUnorderedSynchronizerStateDraining: + // Create a new message for metadata. The previous message cannot be + // overwritten since it might still be in the channel. + msg = &unorderedSynchronizerMsg{ + inputIdx: inputIdx, + } if input.MetadataSources != nil { msg.meta = input.MetadataSources.DrainMeta(ctx) } diff --git a/pkg/sql/rowexec/processors_test.go b/pkg/sql/rowexec/processors_test.go index 153c8741ade9..b33407033a69 100644 --- a/pkg/sql/rowexec/processors_test.go +++ b/pkg/sql/rowexec/processors_test.go @@ -852,7 +852,6 @@ func TestUncertaintyErrorIsReturned(t *testing.T) { testutils.RunTrueAndFalse(t, "vectorize", func(t *testing.T, vectorize bool) { vectorizeOpt := "off" if vectorize { - skip.WithIssue(t, 52948) vectorizeOpt = "on" } for _, testCase := range testCases {