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

plan,executor: calculate generated columns in CRUD. #3951

Merged
merged 69 commits into from Aug 23, 2017

Conversation

@hicqu
Contributor

hicqu commented Jul 31, 2017

Now we support:

  • Fetch back stored/virtual generated columns from table in TableScan/DoubleReader;
  • Insert/Load/Update stored/virtual generated columns if need in Update;
@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Jul 31, 2017

Member

CI failed.

Member

shenli commented Jul 31, 2017

CI failed.

hicqu added some commits Jul 31, 2017

@CLAassistant

This comment has been minimized.

Show comment
Hide comment
@CLAassistant

CLAassistant Jul 31, 2017

CLA assistant check
All committers have signed the CLA.

CLAassistant commented Jul 31, 2017

CLA assistant check
All committers have signed the CLA.

err int
}{
// Can't insert these records, because generated columns are not null.
{`insert into test_gc_read_1(a, b) values (1, null)`, mysql.ErrBadNull},

This comment has been minimized.

@tiancaiamao

tiancaiamao Aug 1, 2017

Contributor

what happens if I insert a, b and c that c is not equal to a+b?

@tiancaiamao

tiancaiamao Aug 1, 2017

Contributor

what happens if I insert a, b and c that c is not equal to a+b?

This comment has been minimized.

@hicqu

hicqu Aug 2, 2017

Contributor

you cannot insert generated column explicitly. it will cause fail.

@hicqu

hicqu Aug 2, 2017

Contributor

you cannot insert generated column explicitly. it will cause fail.

This comment has been minimized.

@winkyao

winkyao Aug 3, 2017

Member

so add some test cases like INSERT INTO test_gc_read (a, b, c) VALUES (1,2, 4) ?

@winkyao

winkyao Aug 3, 2017

Member

so add some test cases like INSERT INTO test_gc_read (a, b, c) VALUES (1,2, 4) ?

This comment has been minimized.

@hicqu

hicqu Aug 4, 2017

Contributor

Already added at line 1749, function TestGeneratedColumnWrite.

@hicqu

hicqu Aug 4, 2017

Contributor

Already added at line 1749, function TestGeneratedColumnWrite.

Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/planbuilder.go Outdated

hicqu added some commits Aug 2, 2017

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli
Member

shenli commented Aug 3, 2017

Show outdated Hide outdated executor/builder.go Outdated
err int
}{
// Can't insert these records, because generated columns are not null.
{`insert into test_gc_read_1(a, b) values (1, null)`, mysql.ErrBadNull},

This comment has been minimized.

@winkyao

winkyao Aug 3, 2017

Member

so add some test cases like INSERT INTO test_gc_read (a, b, c) VALUES (1,2, 4) ?

@winkyao

winkyao Aug 3, 2017

Member

so add some test cases like INSERT INTO test_gc_read (a, b, c) VALUES (1,2, 4) ?

Show outdated Hide outdated executor/distsql.go Outdated
Show outdated Hide outdated executor/distsql.go Outdated
@@ -1797,6 +1797,95 @@ func (s *testSuite) TestGeneratedColumnWrite(c *C) {
}
}
// TestGeneratedColumnRead tests select generated columns from table.
// They should be calculated from their generation expressions.
func (s *testSuite) TestGeneratedColumnRead(c *C) {

This comment has been minimized.

@zz-jason

zz-jason Aug 3, 2017

Member

add some test in tidb-test

@zz-jason

zz-jason Aug 3, 2017

Member

add some test in tidb-test

Show outdated Hide outdated executor/builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
@XuHuaiyu
create table t (a int, b int as (cast(1 as unsigned)));

can not execute successfully.

Show outdated Hide outdated executor/distsql.go Outdated
Show outdated Hide outdated plan/planbuilder.go Outdated

hicqu added some commits Aug 4, 2017

hicqu added some commits Aug 14, 2017

@hicqu

This comment has been minimized.

Show comment
Hide comment
@hicqu

hicqu Aug 14, 2017

Contributor

@hanfei1991 , PTAL again, thanks!

Contributor

hicqu commented Aug 14, 2017

@hanfei1991 , PTAL again, thanks!

hicqu added some commits Aug 14, 2017

Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
@hicqu

This comment has been minimized.

Show comment
Hide comment
@hicqu

hicqu Aug 15, 2017

Contributor

@hanfei1991 , PTAL again, thanks!!!!

Contributor

hicqu commented Aug 15, 2017

@hanfei1991 , PTAL again, thanks!!!!

Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/logical_plan_builder.go Outdated
Show outdated Hide outdated plan/planbuilder.go Outdated

hicqu added some commits Aug 17, 2017

@hicqu

This comment has been minimized.

Show comment
Hide comment
@hicqu

hicqu Aug 18, 2017

Contributor

@hanfei1991 , PTAL again, thanks.

Contributor

hicqu commented Aug 18, 2017

@hanfei1991 , PTAL again, thanks.

Show outdated Hide outdated executor/executor_test.go Outdated
@hanfei1991

@hicqu Have we considered update exec ?

Show outdated Hide outdated executor/write.go Outdated
Show outdated Hide outdated executor/write.go Outdated

hicqu and others added some commits Aug 23, 2017

@hanfei1991

LGTM

@hicqu hicqu merged commit 881d768 into master Aug 23, 2017

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
ci/circleci Your tests passed on CircleCI!
Details
license/cla Contributor License Agreement is signed.
Details

@hicqu hicqu deleted the qupeng/generated-column-full branch Aug 23, 2017

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Aug 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment