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

expression: support JSON return type in case expression #8355

Merged
merged 5 commits into from
Nov 21, 2018

Conversation

eurekaka
Copy link
Contributor

@eurekaka eurekaka commented Nov 19, 2018

What problem does this PR solve?

Before this PR:

mysql> SELECT CASE 1 WHEN 1 THEN JSON_ARRAY() ELSE NULL END;
ERROR 2013 (HY000): Lost connection to MySQL server during query

What is changed and how it works?

Return type of case expression is decided by Result field of whenClauses. When the input is json type and null type, case chooses json as its return type, but in caseWhenFunctionClass::getFunction we cannot find a builtinFunc which has json return type. Add this builtinFunc to support json as return type.

Check List

Tests

  • Unit test

Side effects

N/A

Related changes

N/A


This change is Reviewable

@eurekaka eurekaka added type/enhancement The issue or PR belongs to an enhancement. component/expression labels Nov 19, 2018
@eurekaka
Copy link
Contributor Author

/run-all-tests

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

lgtm

@winoros winoros added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 19, 2018
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 19, 2018
@eurekaka
Copy link
Contributor Author

Failing unit-test is not related this PR's code change, and it would be fixed by #8338 which is in review, so wait it to be merged first.

@eurekaka
Copy link
Contributor Author

/run-all-tests

@ngaut
Copy link
Member

ngaut commented Nov 20, 2018

/run-common-test

@eurekaka
Copy link
Contributor Author

/run-sqllogic-test

1 similar comment
@eurekaka
Copy link
Contributor Author

/run-sqllogic-test

@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants