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

expression: fix panic while call Column.VecEvalInt #13401

Merged
merged 5 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion expression/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (col *Column) Equal(_ sessionctx.Context, expr Expression) bool {
func (col *Column) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error {
if col.RetType.Hybrid() {
it := chunk.NewIterator4Chunk(input)
result.Reset()
result.ResizeInt64(0, false)
for row := it.Begin(); row != it.End(); row = it.Next() {
v, null, err := col.EvalInt(ctx, row)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions expression/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ func (s *testEvaluatorSuite) TestColHybird(c *C) {
c.Assert(v, Equals, result.GetInt64(i))
}

// use a container which has the different field type with bit
result, err = newBuffer(types.ETString, 1024)
c.Assert(err, IsNil)
c.Assert(col.VecEvalInt(ctx, input, result), IsNil)
for row, i := it.Begin(), 0; row != it.End(); row, i = it.Next(), i+1 {
v, _, err := col.EvalInt(ctx, row)
c.Assert(err, IsNil)
c.Assert(v, Equals, result.GetInt64(i))
}

// enum
ft = types.NewFieldType(mysql.TypeEnum)
col.RetType = ft
Expand Down