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

types: Improve Convert function #8

Merged
merged 2 commits into from
Sep 6, 2015
Merged

types: Improve Convert function #8

merged 2 commits into from
Sep 6, 2015

Conversation

shenli
Copy link
Member

@shenli shenli commented Sep 6, 2015

Check unsignedflag, charsetbin.
Remove useless code in cast builtin function.

Check unsignedflag, charsetbin
@@ -127,6 +136,10 @@ func Convert(val interface{}, target *FieldType) (v interface{}, err error) { //
if err != nil {
return InvConv(val, tp)
}
// TODO: We should first convert to uint64 then check unsigned flag.
if mysql.HasUnsignedFlag(target.Flag) {
Copy link
Member

Choose a reason for hiding this comment

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

how about negative number?

Copy link
Member Author

Choose a reason for hiding this comment

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

Negative number will be converted to a big uint.

mysql> select cast(-5 as unsigned);
+----------------------+
| cast(-5 as unsigned) |
+----------------------+
| 18446744073709551611 |
+----------------------+
1 row in set (0.00 sec)

mysql>

@siddontang
Copy link
Member

LGTM

@shenli
Copy link
Member Author

shenli commented Sep 6, 2015

PTAL @qiuyesuifeng

shenli added a commit that referenced this pull request Sep 6, 2015
types: Improve Convert function
@shenli shenli merged commit 3030bdb into master Sep 6, 2015
@ngaut ngaut deleted the shenli/dev-cast branch September 6, 2015 13:43
wph95 referenced this pull request in wph95/tidb Oct 6, 2019
windtalker pushed a commit to windtalker/tidb that referenced this pull request May 8, 2020
AilinKid pushed a commit to AilinKid/tidb that referenced this pull request Jun 2, 2020
server: fix SIGSEGV caused by port probing with audit plugin (pingcap#16038)…(pingcap#17291)
ti-srebot pushed a commit that referenced this pull request Jul 27, 2020
* support batch cop for tiflash

* support batch cop

* support join push down to tiflash

* refine

* change pb

* push join

* fix

* add hint

* refine hint

* add ranges

* fix

* fix

* fix push down

* fix index

* enable distsql for join

* add a session var to disable/enable broadcast join

* fix bug

* fix bug

* tiny fix

* enable cast decimal pushdown to tiflash

* fix

* fix bc join bug

* make broadcast plan stable

* refine code

* fix bug

* basic support for multi table broadcast join

* fix bug

* basic cbo for broadcast join

* improve

* fix bug

* remote useless code

* add tests

* pass unit tests

* refine code

* support execute summary info for broadcast join

* fix bug in explain for broadcast join

* format code

* remove un-needed code

* fix make dev

* address comments

* Hanfei/join merge (#7)

* enable exec details for batch cop

* format code

* fix test

* change tidb_opt_broadcast_join to global vars

* Ban cartesian join to be pushed down to TiFlash (#8)

* merge master (#10)

* merge master

* fix bug

* fix bug

* fix ut

* check session var conflict

* Add perfer local hint for broadcast join (#12)

* update

* remove useless code

* remove useless code

* update parser

* add test for prefer local join

* use bcj_local

* update go.mod

* refine planner

* refine comments

* fix make dev

* fix make dev

* update parser

* address comments

* fix make dev

* disable broadcast join when new collation is enabled

* Update planner/core/exhaust_physical_plans.go

Co-authored-by: Zhuomin(Charming) Liu <lzmhhh123@gmail.com>

* address comments

* fix

* address comments

* fix tests

* address comments

Co-authored-by: xufei <xufeixw@mail.ustc.edu.cn>
Co-authored-by: xufei <xufei@pingcap.com>
Co-authored-by: 虎 <ichneumon.hu@foxmail.com>
Co-authored-by: Zhuomin(Charming) Liu <lzmhhh123@gmail.com>
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
* refine codes on verfication after restoring finished

* adjust comment

* correct gramma mistake
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
rebelice pushed a commit to rebelice/tidb that referenced this pull request Jan 6, 2022
knull-cn pushed a commit to knull-cn/tidb that referenced this pull request Feb 24, 2022
resolve dml problem and unique index problem
AilinKid added a commit to AilinKid/tidb that referenced this pull request Mar 14, 2022
JmPotato pushed a commit to JmPotato/tidb that referenced this pull request Dec 5, 2022
Signed-off-by: nolouch <nolouch@gmail.com>
rleungx pushed a commit to rleungx/tidb that referenced this pull request Feb 26, 2024
* init

* audit: init first version of audit log

* audit: support log global rotate

* audit: update log keys

* audit: more common notify implement

* audit: add record id

* audit: rename some names

* audit: default use normal log path

* audit: add server ip info

* audit: do some refine

* audit: Add some log keys

* audit: update some item format

* audit: add stmt demo

* audit: support redact

* audit: fix bug

* audit: update filter

* audit: update filter

* audit: check user

* audit: update

* update

* audit: update

* audit: fix bug

* aduit: update

* audit: update

* update

* update

* audit: add filter unit test

* fmt

* Add tests for `tidb_audit_enabled` and `tidb_audit_log`

* Add tests for `tidb_audit_log_max_size` and `tidb_audit_log_max_lifetime`

* Add tests for `tidb_audit_log_reserved_*`

* TODO: TestAuditLogRedact

* Fininsh `TestAuditLogRedact`

* Update (pingcap#1)

* fix typo (pingcap#2)

* Add `TRANSACTION`

* rename sysvar

* audit_log_create_filter, audit_log_remove_filter

* finish function call and table test

* test privilege

* finish test for sysvar

* TODO: TestConnectionEvenClass

* update

* audit: fix lint for audit log (pingcap#1)

* audit: fix UT failure caused by the change of redact log (pingcap#3)

* audit: use `t.TempDir()` to make test stable (pingcap#4)

* audit: fix test failed for 7.1

* Add `OWNERS` file (pingcap#35)

Co-authored-by: Chao Wang <cclcwangchao@hotmail.com>

* audit: fix panic when logging sometime (pingcap#26) (pingcap#31)

* test: fix unstable test TestAuditLogReservedDays (pingcap#8)

* Format sysvar_test.go

* audit: use `StatementContext` to generate redacted SQL (pingcap#9)

* audit: fix panic when logging sometime (pingcap#26)

* update

* add owner

* Update OWNERS

---------

Co-authored-by: CbcWestwolf <1004626265@qq.com>
Co-authored-by: wuhuizuo <wuhuizuo@126.com>

* audit: fix panic sometimes when `create user` without password (pingcap#37) (pingcap#39)

* This is an automated cherry-pick of pingcap#37

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* fix conflict

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Co-authored-by: 王超 <cclcwangchao@hotmail.com>

* extension/audit: introduce serverless audit log

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* update bazel config

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* support enable audit log when activate

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* add gwconnid to audit log

Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>

* comment unstable test

* update bazel

* add log about activate request

* diff audit log enabled

* audit: fix memory leak for executeSQL (pingcap#44) (pingcap#45)

* This is an automated cherry-pick of pingcap#44

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* Update util.go

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Co-authored-by: 王超 <cclcwangchao@hotmail.com>

* Update extension/serverless/OWNERS

---------

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Wen Jiazhi <jiazhi.wen@pingcap.com>
Co-authored-by: Chao Wang <cclcwangchao@hotmail.com>
Co-authored-by: cbcwestwolf <1004626265@qq.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Co-authored-by: wuhuizuo <wuhuizuo@126.com>
Co-authored-by: zzm <zhouzemin@pingcap.com>
Co-authored-by: Yuqing Bai <baiyuq@gmail.com>
guoshouyan pushed a commit to guoshouyan/tidb that referenced this pull request Mar 5, 2024
Co-authored-by: rishabh_mittal <mittalrishabh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants