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

slice bounds out of range #7578

Closed
iakisey opened this issue Sep 1, 2018 · 8 comments · Fixed by #7624
Closed

slice bounds out of range #7578

iakisey opened this issue Sep 1, 2018 · 8 comments · Fixed by #7624
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@iakisey
Copy link

iakisey commented Sep 1, 2018

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    programer

  2. What did you expect to see?
    371535815214_ pic

  3. What did you see instead?
    381535815342_ pic
    391535815362_ pic_hd

  4. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    Release Version: v2.1.0-rc.1-7-g38c939f

@zhexuany
Copy link
Contributor

zhexuany commented Sep 2, 2018

Thanks for your reporting. We will investigate this. @zz-jason PTAL when you have time.

@mccxj
Copy link
Contributor

mccxj commented Sep 2, 2018

mini testcase:

create table t(c enum('a'));
insert into t values('a');
select c,count(1) from t group by c;

dumpTextRow use column info to decode chunk.Row, excepted type is Enum.
But firstrow agg function write it use type String, min(),max() has the same problem.
see AggFuncDesc#typeInfer4MaxMin

release-2.0 works fine. Maybe #6852 affected it.

@iakisey
Copy link
Author

iakisey commented Sep 2, 2018

401535879749_ pic
测过了 是这个版本的问题吧,之前安装过 v2.0.4-1-g06a0bf5 版本 就没问题

411535879906_ pic

@shenli shenli added the type/bug The issue is confirmed as a bug. label Sep 2, 2018
@tiancaiamao tiancaiamao self-assigned this Sep 3, 2018
@tiancaiamao
Copy link
Contributor

Thanks for you kind reply. @mccxj
The bug was actually introduced in #7268, and I'm now reviewing that PR to find what's going on.

@tiancaiamao
Copy link
Contributor

It's around here:
https://github.com/pingcap/tidb/pull/7268/files#diff-2ed8f699513f49aaaf408561a56aa2e7L477

The old code evaluate using type.Datum, and enum type info would be handle properly.
After the change, we'll use chunk.Chunk instead of types.Datum, the eval type is always using string.

When the chunk execution finish, the column data stored in the chunk is string (it should be converted to enum somewhere), but the schema expect the column data to be a enum, so the panic happen.

PTAL @zz-jason

@tiancaiamao tiancaiamao assigned zz-jason and unassigned tiancaiamao Sep 5, 2018
@zz-jason
Copy link
Member

zz-jason commented Sep 5, 2018

In the type infer phase, the result type for function first_row(enum) is inferred to string, and the column type in the schema should also be changed to string.

In a word, the type of the column in the schema should be reset after creating an aggregate function descriptor through the function aggregation.NewAggFuncDesc()

@mccxj
Copy link
Contributor

mccxj commented Sep 11, 2018

@zz-jason duplicate with #7307

@zz-jason
Copy link
Member

@mccxj Got it! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants