Skip to content

Commit

Permalink
[ut]: fix mergeblock ut
Browse files Browse the repository at this point in the history
  • Loading branch information
gouhongshen committed Nov 16, 2023
1 parent 14a76af commit b6c2a7c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/sql/colexec/mergeblock/mergeblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ func TestMergeBlock(t *testing.T) {
blkInfo3.SetMetaLocation(loc3)

batch1 := &batch.Batch{
Attrs: []string{catalog.BlockMeta_TableIdx_Insert, catalog.BlockMeta_BlockInfo},
Attrs: []string{catalog.BlockMeta_TableIdx_Insert, catalog.BlockMeta_BlockInfo, catalog.ObjectMeta_ObjectStats},
Vecs: []*vector.Vector{
testutil.MakeInt16Vector([]int16{0, 0, 0}, nil),
testutil.MakeTextVector([]string{
string(catalog.EncodeBlockInfo(blkInfo1)),
string(catalog.EncodeBlockInfo(blkInfo2)),
string(catalog.EncodeBlockInfo(blkInfo3))},
nil),
testutil.MakeTextVector([]string{string(objectio.ZeroObjectStats[:])}, nil),
},
Cnt: 1,
}
Expand All @@ -124,14 +125,15 @@ func TestMergeBlock(t *testing.T) {
result := argument1.Tbl.(*mockRelation).result
// check attr names
require.True(t, reflect.DeepEqual(
[]string{catalog.BlockMeta_BlockInfo},
[]string{catalog.BlockMeta_BlockInfo, catalog.ObjectMeta_ObjectStats},
result.Attrs,
))
// check vector
require.Equal(t, 1, len(result.Vecs))
for i, vec := range result.Vecs {
require.Equal(t, 3, vec.Length(), fmt.Sprintf("column number: %d", i))
}
require.Equal(t, 2, len(result.Vecs))
//for i, vec := range result.Vecs {
require.Equal(t, 3, result.Vecs[0].Length(), fmt.Sprintf("column number: %d", 0))
require.Equal(t, 1, result.Vecs[1].Length(), fmt.Sprintf("column number: %d", 1))
//}
}
// Check UniqueTables
//for j := range argument1.Unique_tbls {
Expand Down

0 comments on commit b6c2a7c

Please sign in to comment.