-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Conversation
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 |
There was a problem hiding this comment.
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
)
There is no year support in mysql cast function? why to support this? |
Convert can be used to replace column.CastValue later. |
switch x := val.(type) { | ||
case string: | ||
intVal, err = StrToInt(x) | ||
default: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
util/types: support convert year
* merge master * fix bug * fix bug * fix ut
* 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 <[email protected]> * address comments * fix * address comments * fix tests * address comments Co-authored-by: xufei <[email protected]> Co-authored-by: xufei <[email protected]> Co-authored-by: 虎 <[email protected]> Co-authored-by: Zhuomin(Charming) Liu <[email protected]>
add concurrency arg
* mysql: Add NO_AUTO_CREATE_USER detection
* mysql: Add NO_AUTO_CREATE_USER detection
* mysql: Add NO_AUTO_CREATE_USER detection
remove debug info
add fprof to check performance problem
fix writer append rows
Co-authored-by: artem_danilov <[email protected]>
Convert support more types