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: make in more powerful. #4969

Merged
merged 8 commits into from Nov 6, 2017

Conversation

Projects
None yet
4 participants
@winoros
Member

winoros commented Nov 1, 2017

Let in can handle more case, so we can make more expression able to calculate range.
PTAL @XuHuaiyu @zz-jason @hanfei1991

for i := stkLen - lLen; i < stkLen; i++ {
if er.ctxStack[i].GetType().Tp != mysql.TypeNull && er.ctxStack[i].GetType().EvalType() != leftEt {
for _, arg := range args[1:] {
if arg.GetType().Tp != mysql.TypeNull && expression.GetAccurateCmpType(args[0], arg) != leftEt {

This comment has been minimized.

@coocood

coocood Nov 1, 2017

Member

Can we collect all the argument types and merge them to one type, then just cast all the expressions to this type and always use in?

@coocood

coocood Nov 1, 2017

Member

Can we collect all the argument types and merge them to one type, then just cast all the expressions to this type and always use in?

This comment has been minimized.

@winoros

winoros Nov 1, 2017

Member

We can group them to the form x in(type_x_expr) or cast(x to type_a) in(type_a_expr)or....But cannot to convert to one type. e.g. x in ('a', 1.1). x's type is string type. We should compare x and a in string type, x and 1.1 in double type. But we can't compare x and a in double type since this will make result absolutely wrong. And we can't compare x and 1.1 in string type since this don't obey the compare system in MySQL.

@winoros

winoros Nov 1, 2017

Member

We can group them to the form x in(type_x_expr) or cast(x to type_a) in(type_a_expr)or....But cannot to convert to one type. e.g. x in ('a', 1.1). x's type is string type. We should compare x and a in string type, x and 1.1 in double type. But we can't compare x and a in double type since this will make result absolutely wrong. And we can't compare x and 1.1 in string type since this don't obey the compare system in MySQL.

This comment has been minimized.

@coocood

coocood Nov 1, 2017

Member

How about build DNF with different types?
(intValLeft in (intA, intB, intC)) or (floatValLeft in (floatA, floatB))?

@coocood

coocood Nov 1, 2017

Member

How about build DNF with different types?
(intValLeft in (intA, intB, intC)) or (floatValLeft in (floatA, floatB))?

This comment has been minimized.

@winoros

winoros Nov 1, 2017

Member

This is okay.

@winoros

winoros Nov 1, 2017

Member

This is okay.

This comment has been minimized.

@winoros

winoros Nov 2, 2017

Member

But currently this is not very necessary to do this. This case can't push down to tikv, and can't be used to calculate range.

@winoros

winoros Nov 2, 2017

Member

But currently this is not very necessary to do this. This case can't push down to tikv, and can't be used to calculate range.

@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Nov 2, 2017

Member

LGTM

Member

coocood commented Nov 2, 2017

LGTM

@winoros

This comment has been minimized.

Show comment
Hide comment
@winoros
Member

winoros commented Nov 6, 2017

winoros and others added some commits Nov 6, 2017

@winoros

This comment has been minimized.

Show comment
Hide comment
@winoros

winoros Nov 6, 2017

Member

/run-all-tests

Member

winoros commented Nov 6, 2017

/run-all-tests

@winoros

This comment has been minimized.

Show comment
Hide comment
@winoros

winoros Nov 6, 2017

Member

/run-unit-test /run-integration-ddl-test

Member

winoros commented Nov 6, 2017

/run-unit-test /run-integration-ddl-test

@winoros

This comment has been minimized.

Show comment
Hide comment
@winoros

winoros Nov 6, 2017

Member

mysql-test needs to do some change. Don't merge for a while.
UPDATE: Fixed.

Member

winoros commented Nov 6, 2017

mysql-test needs to do some change. Don't merge for a while.
UPDATE: Fixed.

@winoros

This comment has been minimized.

Show comment
Hide comment
@winoros

winoros Nov 6, 2017

Member

/run-common-test tidb-test=pr/396

Member

winoros commented Nov 6, 2017

/run-common-test tidb-test=pr/396

@winoros winoros merged commit 55529a5 into pingcap:master Nov 6, 2017

8 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 73.588%
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
jenkins-ci-tidb/common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@winoros winoros deleted the winoros:in-func branch Nov 6, 2017

winoros added a commit to winoros/tidb that referenced this pull request Nov 13, 2017

winoros added a commit to winoros/tidb that referenced this pull request Nov 13, 2017

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