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

ISSUE-4558: Add check_json function #4606

Merged
merged 7 commits into from
Mar 30, 2022
Merged

Conversation

kevinw66
Copy link
Contributor

@kevinw66 kevinw66 commented Mar 28, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Add check_json function

Changelog

  • New Feature

Related Issues

Fixes #4558

Test Plan

Unit Tests

Stateless Tests

@vercel
Copy link

vercel bot commented Mar 28, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/databend/databend/z5r7x6CqvS54oosjVgAsS43bcxZC
✅ Preview: https://databend-git-fork-kevinw66-checkjson-databend.vercel.app

@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Mar 28, 2022
@kevinw66 kevinw66 changed the title ISSUE-4458: Add check_json function ISSUE-4558: Add check_json function Mar 28, 2022
@kevinw66
Copy link
Contributor Author

@b41sh I don't know if the testcase for NullColumn is correct or not, please help review it

@BohuTANG BohuTANG requested a review from b41sh March 28, 2022 07:13
@kevinw66
Copy link
Contributor Author

Still has some problem, Please wait

@kevinw66
Copy link
Contributor Author

Still has some problem, Please wait

The console output for null has different case.

mysql> select check_json('123.12');
+----------------------+
| check_json('123.12') |
+----------------------+
| null                 |
+----------------------+
mysql> select check_json(v), v from t1;
+---------------+-----------+
| check_json(v) | v         |
+---------------+-----------+
| NULL          | NULL      |
| NULL          | null      |
| NULL          | true      |
| NULL          | 123       |
| NULL          | "abc"     |
| NULL          | [1,2,3]   |
| NULL          | {"a":"b"} |
+---------------+-----------+

@b41sh
Copy link
Member

b41sh commented Mar 28, 2022

Still has some problem, Please wait

The console output for null has different case.

mysql> select check_json('123.12');
+----------------------+
| check_json('123.12') |
+----------------------+
| null                 |
+----------------------+
mysql> select check_json(v), v from t1;
+---------------+-----------+
| check_json(v) | v         |
+---------------+-----------+
| NULL          | NULL      |
| NULL          | null      |
| NULL          | true      |
| NULL          | 123       |
| NULL          | "abc"     |
| NULL          | [1,2,3]   |
| NULL          | {"a":"b"} |
+---------------+-----------+

@kevinw66 select check_json('123.12'); return null is because you check is_nullable() and return a no nullable column, so we can't get a NULL value. Modify function return_type to always return nullable column.

common/functions/tests/it/scalars/mod.rs Outdated Show resolved Hide resolved
@b41sh
Copy link
Member

b41sh commented Mar 29, 2022

/LGTM

@BohuTANG BohuTANG merged commit d1ce6e8 into databendlabs:main Mar 30, 2022
@kevinw66 kevinw66 deleted the check_json branch March 30, 2022 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Semi-structured data function check_json
4 participants