Commit Graph

418 Commits

Author SHA1 Message Date
fa37762c53 executor: tiny refactor, remove physicalTableID from the three reader (#9511) 2019-03-01 10:36:09 +08:00
9259785455 executor: support window function rank and dense_rank (#9500) 2019-02-28 14:44:08 +08:00
8b84b94c96 *: fix union scan for partitioned table (#8871) 2019-02-28 13:43:45 +08:00
45f9d6a00f statistics: compute and store column order correlation with handle (#9315) 2019-02-27 11:32:00 +08:00
a59a5f41e1 planner, executor: support range framed window functions (#9450) 2019-02-27 10:07:28 +08:00
2f3842a8da executor, planner: refine merge join compare methods to avoid some rare cases (#9390) 2019-02-25 14:19:26 +08:00
042e4100b9 executor: support row framed window functions (#9358) 2019-02-21 15:30:25 +08:00
40fa006cac *: collect coprocessor runtime stats for explain analyze (#9057) 2019-02-19 16:22:00 +08:00
365264cd21 ddl: add restore deleted table (#7937) 2019-01-16 15:37:33 +08:00
3835bef7ae executor: support window func for aggregate without frame clause (#8899) 2019-01-15 15:23:17 +08:00
dca815c1c5 expression: return error when doing ResolveIndices (#8929) 2019-01-15 14:34:06 +08:00
8b4c998815 executor: separate RadixHashJoinExec from HashJoinExec (#8979) 2019-01-10 20:11:43 +08:00
e0b30fe9ba planner,executor: support show create database if not exists syntax (#8926)
<!--
Thank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.
-->

### What problem does this PR solve? <!--add issue link with summary if exists-->

https://github.com/pingcap/parser/issues/147
https://github.com/pingcap/parser/pull/148

MySQL compatibility: `show create database if not exists` syntax

See: https://dev.mysql.com/doc/refman/5.7/en/show-create-database.html

MySQL

```
MariaDB [(none)]> show create database b2;
+----------+----------------------------------------------------------------+
| Database | Create Database                                                |
+----------+----------------------------------------------------------------+
| b2       | CREATE DATABASE `b2` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+----------------------------------------------------------------+
1 row in set (0.002 sec)

MariaDB [(none)]> show create database if not exists b2;
+----------+-----------------------------------------------------------------------------------------+
| Database | Create Database                                                                         |
+----------+-----------------------------------------------------------------------------------------+
| b2       | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `b2` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+-----------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
```

TiDB
```
MySQL [b1]> show create batabase b2;
ERROR 1105 (HY000): line 1 column 20 near " b2" (total length 23)
MySQL [b1]> show create database b2;
+----------+-----------------------------------------------------------------+
| Database | Create Database                                                 |
+----------+-----------------------------------------------------------------+
| b2       | CREATE DATABASE `b2` /* !40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.000 sec)

MySQL [b1]> show create database if not exists b2;
ERROR 1105 (HY000): line 1 column 23 near " not exists b2" (total length 37)
```

### What is changed and how it works?

Insert `/*!32312 IF NOT EXISTS*/` before shema name when statement contains `if not exists`

### Check List <!--REMOVE the items that are not applicable-->

Tests <!-- At least one of them must be included. -->

 - Unit test

Code changes

Side effects

Related changes

 - Need to cherry-pick to the release branch

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/pingcap/tidb/8926)
<!-- Reviewable:end -->
2019-01-04 13:31:05 +08:00
243120c473 planner, executor: add post-process after physical plan optimization and move buildProjBelowAgg from executor to planner (#8828) 2019-01-03 16:26:59 +08:00
71088815e7 executor: refine HashAgg.Close when unparallelExec (#8810) 2018-12-27 17:14:04 +08:00
3040788655 *: make errcheck work again (#8795) 2018-12-25 17:16:52 +08:00
98b96cc769 executor: speedup unit tests by spliting them into separate suites (#8618) 2018-12-24 21:37:12 +08:00
a7907ede7a *: remove fail field from TxnState (#8712)
Originally, `fail` is added to simplify error handling, avoiding large changes on
the Txn() interface API. But it turns out that `fail` becomes the root of many bugs.
So this commit remove the `fail` and make an API refactory.
2018-12-20 16:36:12 +08:00
df55d3815d executor,planner: fix 'show master status' output (#8737) 2018-12-18 22:13:14 +08:00
49b0cd3369 executor: set projection concurrency build bellow aggregate (#8601) 2018-12-06 20:31:43 +08:00
c137cada68 *: change golang.org/x/net/context to standard context (#8579) 2018-12-05 13:54:00 +08:00
322795439d *: record cop scan rows in explain analyze (#8423) 2018-11-28 15:43:59 +08:00
6fb260f8a6 *: redesign trace statement with json output (#8357) 2018-11-21 13:50:18 +08:00
b4746797fc *: clone AggDesc before modifying its Mode in AggDesc.Split (#8328) 2018-11-16 15:53:22 +08:00
3742a0d602 *: Txn() function signature refactor and remove ActivePendingTxn() (#8327)
* change Txn() function signature to Txn(active bool)
* ActivePendingTxn() is not used any more because Txn() does the work
* change executor builder getStartTS() uint64 to getStartTS() (uint64, error)
2018-11-16 11:10:39 +08:00
0c3e9c1652 session,executor: run statement without transaction (#8260)
`set @@autocommit = 0`
`select 1` // This statement should not make the session enter a transaction,
because it never need Txn().
Make txn lazy initialize
2018-11-14 20:10:58 +08:00
f3a9745e2c executor: support for "admin show next_row_id" (#8242) 2018-11-09 22:08:42 +08:00
761365b31c *: avoid using columnEvaluator for the Projectin build by buildProjtion4Union (#8142) 2018-11-02 17:28:09 +08:00
32b1dbd8d5 *: rename "github.com/pkg/errors" to "github.com/pingcap/errors" (#8136)
We import "github.com/pkg/errors" in the code, and actually put
the "github.com/pingcap/errors" there in the vendor path.
That's a dirty hack, and prevent the introduce of Go module.
2018-11-01 16:09:07 +08:00
d606b0d55f executor: fix wrong result when index join on union scan. (#8031)
Do not modify Plan of dataReaderBuilder directly, because it would
impact next batch of outer rows, as well as other concurrent inner
workers. Instead, build a local child builder to store the child plan.
2018-10-25 11:38:35 +08:00
89dda9d9a8 *: move parser to a separate repository (#8036) 2018-10-25 11:12:10 +08:00
d8b52b82a8 executor: improve wide table insert & update performance (#7935) 2018-10-23 18:07:54 +08:00
458c0d1c27 executor: refine explain analyze (#7888) 2018-10-16 20:02:43 +08:00
d21f294393 *: make explain support explain anaylze (#7827) 2018-10-12 20:01:19 +08:00
5efcacbff8 plan,executor: support IndexJoin over UnionScan (#7877) 2018-10-12 19:18:42 +08:00
d7a59ec5a3 executor: remove some useless code and avoid some redundancy check (#7639) 2018-10-12 12:56:02 +08:00
f6f03db6dd expression: fix warning/error info of group_concat() (#7799) 2018-10-11 17:01:47 +08:00
f3a9390d18 executor: refine the precision for avg (#7860) 2018-10-11 14:51:56 +08:00
05b37de16e *: use chunk grow for simple executor (#7540) 2018-09-27 09:07:51 +08:00
081920da93 planner,executor: support admin show slow command (#7785) 2018-09-26 19:28:53 +08:00
e79bd946ed *: change package name from plan to planner (#7760) 2018-09-25 11:16:39 +08:00
29441950a3 *: write system timezone into mysql.tidb in bootstrap stage. (#7638) 2018-09-14 22:15:00 +08:00
cb03f2bec1 move from juju/errors to pkg/errors (#7151) 2018-09-12 15:42:20 +08:00
b2bfd8f91a executor: support load data with ignore lines (#7576) 2018-09-06 22:58:06 +08:00
e7afbb2713 *: make analyze buckets number configurable (#7619) 2018-09-06 17:16:23 +08:00
3d891d9c26 executor: fix update join result when join table order changed (#7571) 2018-09-03 14:12:35 +08:00
341dc1009c *: tidb tracing prototype (#7016) 2018-08-31 05:25:16 +08:00
bc97e2d616 plan, util/admin: fix admin check table error when a column of index is virtual generated (#6817) 2018-08-28 12:42:55 +08:00
4836aa33c3 executor: support new aggregate framework for HashAggExec (#7268) 2018-08-21 15:17:25 +08:00
d4e08853e4 executor,statistics: make query feedback work for partitioned table (#7394) 2018-08-21 11:43:48 +08:00