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

util/types: support convert year #10

Merged
merged 4 commits into from
Sep 6, 2015
Merged

util/types: support convert year #10

merged 4 commits into from
Sep 6, 2015

Conversation

coocood
Copy link
Member

@coocood coocood commented Sep 6, 2015

Convert support more types

Convert support more types
@@ -138,6 +138,23 @@ func Convert(val interface{}, target *FieldType) (v interface{}, err error) { //
}
// TODO: check Flen
return x, nil
case mysql.TypeYear:
var intVal int64
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

var (
         intVal int64
         err error
)

@siddontang
Copy link
Member

There is no year support in mysql cast function? why to support this?

@coocood
Copy link
Member Author

coocood commented Sep 6, 2015

Convert can be used to replace column.CastValue later.

switch x := val.(type) {
case string:
intVal, err = StrToInt(x)
default:
Copy link
Member

Choose a reason for hiding this comment

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

mysql> insert into t select cast("2015-11-11 11:11:11" as datetime);
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0

I think you should support time type separately. ToInt64 will not work for time type.

switch x := val.(type) {
case string:
intVal, err = StrToInt(x)
case mysql.Time:
Copy link
Member

Choose a reason for hiding this comment

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

mysql.Duration will use current year.

coocood added a commit that referenced this pull request Sep 6, 2015
@coocood coocood merged commit 9f52db0 into master Sep 6, 2015
@coocood coocood deleted the coocood/convert-year branch September 6, 2015 12:13
spongedu pushed a commit to spongedu/tidb that referenced this pull request Oct 17, 2019
ichn-hu pushed a commit to ichn-hu/tidb that referenced this pull request May 10, 2020
* merge master

* fix bug

* fix bug

* fix ut
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
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
xhebox pushed a commit to xhebox/tidb that referenced this pull request Sep 28, 2021
xhebox pushed a commit to xhebox/tidb that referenced this pull request Oct 8, 2021
ti-chi-bot pushed a commit that referenced this pull request Oct 9, 2021
rebelice pushed a commit to rebelice/tidb that referenced this pull request Jan 6, 2022
lichunzhu added a commit to lichunzhu/tidb that referenced this pull request Jan 7, 2022
add fprof to check performance problem
AilinKid added a commit to AilinKid/tidb that referenced this pull request Mar 15, 2022
ywqzzy pushed a commit to ywqzzy/tidb that referenced this pull request Jun 29, 2023
guoshouyan pushed a commit to guoshouyan/tidb that referenced this pull request Mar 5, 2024
Co-authored-by: artem_danilov <artem_danilov@airbnb.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