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

planner, executor: support create view on union #12595

Merged
merged 9 commits into from
Oct 24, 2019

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Oct 10, 2019

related PR:
pingcap/parser#572

What problem does this PR solve?

  1. support create view on union
  2. refine the error message to make it more compatible with MySQL

What is changed and how it works?

  1. change go.mod
  2. reset the error to ErrViewInvalid when buildViewFromDatasource raises an error during building the logical plan

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

Release note

[bug-fix] Support create view on a union statement. Creating view on a union statement will cause a syntax error before.

@codecov
Copy link

codecov bot commented Oct 10, 2019

Codecov Report

Merging #12595 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #12595   +/-   ##
===========================================
  Coverage   80.0849%   80.0849%           
===========================================
  Files           465        465           
  Lines        107597     107597           
===========================================
  Hits          86169      86169           
  Misses        14976      14976           
  Partials       6452       6452

@XuHuaiyu XuHuaiyu changed the title executor: add some test for create view on union planner, executor: support create view on union Oct 10, 2019
@XuHuaiyu XuHuaiyu added sig/execution SIG execution type/bugfix This PR fixes a bug. and removed status/WIP labels Oct 10, 2019
_, err = tk.Exec("select * from v")
c.Assert(terror.ErrorEqual(err, plannercore.ErrViewInvalid), IsTrue)
tk.MustExec("alter table t1 add column a int")
tk.MustQuery("select * from v").Sort().Check(testkit.Rows("1 1", "3 1", "<nil> 1", "<nil> 2"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test case is wrong.
It should be tk.MustQuery("select * from v").Sort().Check(testkit.Rows("1 1", "1 3", "<nil> 1", "<nil> 2"))
The result is different from MySQL.

mysql> select * from v;
+------+------+
| a    | b    |
+------+------+
| NULL |    2 |
| NULL |    1 |
|    1 |    1 |
|    1 |    3 |
+------+------+
4 rows in set (0.00 sec)

tidb> select * from v;
+---+---+
| a | b |
+---+---+
| NULL | 2 |
| 3 | 1 |
| NULL | 1 |
| 1 | 1 |
+---+---+
4 rows in set (0.00 sec)

@XuHuaiyu
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Maybe it's not correct to change go.sum.

@XuHuaiyu
Copy link
Contributor Author

@SunRunAway CI failed before I run go mod tidy.

@XuHuaiyu XuHuaiyu added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 24, 2019
Copy link
Contributor

@wshwsh12 wshwsh12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wshwsh12 wshwsh12 added status/LGT2 Indicates that a PR has LGTM 2. status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 24, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 24, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Oct 24, 2019

@XuHuaiyu merge failed.

@XuHuaiyu
Copy link
Contributor Author

/run-all-tests

@zyxbest
Copy link
Contributor

zyxbest commented Oct 24, 2019

/rebuild

@zyxbest
Copy link
Contributor

zyxbest commented Oct 24, 2019

/run-all-tests

@XuHuaiyu XuHuaiyu merged commit 2e6a2ee into pingcap:master Oct 24, 2019
@XuHuaiyu XuHuaiyu deleted the view_on_union branch October 24, 2019 03:30
lfkdsk added a commit to JustProject/tidb that referenced this pull request Oct 26, 2019
…ect/tidb into feature-add-udf-support

* 'feature-add-udf-support' of https://github.com/JustProject/tidb: (26 commits)
  *: fix bug that the kill command doesn't work when the killed session is waiting for the pessimistic lock (pingcap#12852)
  executor: fix the projection upon the indexLookUp in indexLookUpJoin can't get result. (pingcap#12889)
  planner, executor: support create view on union (pingcap#12595)
  planner/cascades: introduce TransformationID in cascades planner (pingcap#12879)
  executor: fix data race in test (pingcap#12910)
  executor: reuse chunk row for insert on duplicate update (pingcap#12847)
  ddl: speed up tests (pingcap#12888)
  executor: speed up test (pingcap#12896)
  expression: implement vectorized evaluation for `builtinSecondSig` (pingcap#12886)
  expression: implement vectorized evaluation for `builtinJSONObjectSig` (pingcap#12663)
  expression: speed up builtinRepeatSig by using MergeNulls (pingcap#12674)
  expression: speed up unit tests under the expression package (pingcap#12887)
  store,kv: snapshot doesn't cache the non-exists kv entries lead to poor 'insert ignore' performance (pingcap#12872)
  executor: fix data race in `GetDirtyTable()` (pingcap#12767)
  domain: increase TTL to reduce the occurrence of reporting min startTS errors (pingcap#12578)
  executor: split test for speed up (pingcap#12881)
  executor: fix inconsistent of grants privileges with MySQL when executing `grant all on ...` (pingcap#12330)
  expression: implement vectorized evaluation for `builtinJSONUnquoteSig` (pingcap#12841)
  tune grpc connection count between tidb and tikv (pingcap#12884)
  Makefile: change test parallel to 8 (pingcap#12885)
  ...
XuHuaiyu added a commit to XuHuaiyu/tidb that referenced this pull request Oct 28, 2019
XuHuaiyu added a commit to XuHuaiyu/tidb that referenced this pull request Oct 28, 2019
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants