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

expression: rewrite builtin function: CONVERT #4417

Merged
merged 9 commits into from Sep 8, 2017

Conversation

Projects
None yet
5 participants
@zz-jason
Member

zz-jason commented Sep 4, 2017

to #4080

@zz-jason zz-jason referenced this pull request Sep 4, 2017

Closed

rewrite builtin functions #4080

150 of 150 tasks complete
@@ -799,49 +799,38 @@ func (c *convertFunctionClass) getFunction(ctx context.Context, args []Expressio
if err := c.verifyArgs(args); err != nil {
return nil, errors.Trace(err)
}
sig := &builtinConvertSig{newBaseBuiltinFunc(args, ctx)}
bf := newBaseBuiltinFuncWithTp(args, ctx, tpString, tpString, tpString)

This comment has been minimized.

@XuHuaiyu

XuHuaiyu Sep 5, 2017

Contributor

we always set charset and collate to utf8 in convert?

mysql> select convert("123" using binary);
Field   1:  `convert("123" using binary)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     3
Max_length: 3
Decimals:   31
Flags:      BINARY


+-----------------------------+
| convert("123" using binary) |
+-----------------------------+
| 123                         |
+-----------------------------+
1 row in set (0.00 sec)
@XuHuaiyu

XuHuaiyu Sep 5, 2017

Contributor

we always set charset and collate to utf8 in convert?

mysql> select convert("123" using binary);
Field   1:  `convert("123" using binary)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     3
Max_length: 3
Decimals:   31
Flags:      BINARY


+-----------------------------+
| convert("123" using binary) |
+-----------------------------+
| 123                         |
+-----------------------------+
1 row in set (0.00 sec)

This comment has been minimized.

@zz-jason
@zz-jason

This comment has been minimized.

@XuHuaiyu

XuHuaiyu Sep 6, 2017

Contributor

I can't get what you mean?

@XuHuaiyu

XuHuaiyu Sep 6, 2017

Contributor

I can't get what you mean?

This comment has been minimized.

@zz-jason

zz-jason Sep 6, 2017

Member

Currently, the behavior of function CONVERT in TiDB is different from MySQL:

  1. As #4436 states: charset parameter should be a constant. In getFunction() we should set the charset and flag using the constant charset parameter.
  2. Charsets supported by TiDB may not supported in MySQL, like "866"
@zz-jason

zz-jason Sep 6, 2017

Member

Currently, the behavior of function CONVERT in TiDB is different from MySQL:

  1. As #4436 states: charset parameter should be a constant. In getFunction() we should set the charset and flag using the constant charset parameter.
  2. Charsets supported by TiDB may not supported in MySQL, like "866"

This comment has been minimized.

@breeswish

breeswish Sep 8, 2017

Member

Is convert to binary supported?

@breeswish

breeswish Sep 8, 2017

Member

Is convert to binary supported?

This comment has been minimized.

@zz-jason

zz-jason Sep 8, 2017

Member

not, it's another issue: Charsets supported by MySQL may not supported in TiDB, like "binary"

@zz-jason

zz-jason Sep 8, 2017

Member

not, it's another issue: Charsets supported by MySQL may not supported in TiDB, like "binary"

This comment has been minimized.

@breeswish
@breeswish

This comment has been minimized.

@breeswish

breeswish Sep 8, 2017

Member

I think a TODO is needed here since after supporting binary charset, we also need to add a binary flag here.

@breeswish

breeswish Sep 8, 2017

Member

I think a TODO is needed here since after supporting binary charset, we also need to add a binary flag here.

This comment has been minimized.

@breeswish

breeswish Sep 8, 2017

Member

Rest LGTM

@breeswish

breeswish Sep 8, 2017

Member

Rest LGTM

This comment has been minimized.

@zz-jason

zz-jason Sep 8, 2017

Member

added, PTAL

@zz-jason

zz-jason Sep 8, 2017

Member

added, PTAL

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason
Member

zz-jason commented Sep 7, 2017

@XuHuaiyu PTAL

@zz-jason zz-jason added the status/LGT1 label Sep 7, 2017

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason

zz-jason Sep 7, 2017

Member

/run-all-test

Member

zz-jason commented Sep 7, 2017

/run-all-test

zz-jason added some commits Sep 8, 2017

@breeswish breeswish added status/LGT2 and removed status/LGT1 labels Sep 8, 2017

@hanfei1991 hanfei1991 merged commit ebfcd7d into master Sep 8, 2017

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@hanfei1991 hanfei1991 deleted the zz-jason/expression/string/convert branch Sep 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment