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

chore(query): cast variant to other type allow cast JSON null as SQL NULL #17412

Merged
merged 4 commits into from
Feb 8, 2025

Conversation

b41sh
Copy link
Member

@b41sh b41sh commented Feb 5, 2025

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

Summary

cast variant to other type allow cast JSON null as SQL NULL

for example

root@0.0.0.0:48000/default> SELECT parse_json('123')::int64;
┌──────────────────────────┐
│ parse_json('123')::Int64 │
│      Nullable(Int64)     │
├──────────────────────────┤
│                      123 │
└──────────────────────────┘
1 row read in 0.019 sec. Processed 1 row, 1 B (52.63 rows/s, 52 B/s)

root@0.0.0.0:48000/default> SELECT parse_json('null')::int64;
┌───────────────────────────┐
│ parse_json('null')::Int64 │
│      Nullable(Int64)      │
├───────────────────────────┤
│                      NULL │
└───────────────────────────┘
1 row read in 0.019 sec. Processed 1 row, 1 B (52.63 rows/s, 52 B/s)

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions bot added the pr-chore this PR only has small changes that no need to record, like coding styles. label Feb 5, 2025
@b41sh b41sh changed the title chore(query): cast variant to other type allow cast JSON null as SQL … chore(query): cast variant to other type allow cast JSON null as SQL NULL Feb 5, 2025
@b41sh b41sh requested a review from sundy-li February 7, 2025 08:15
@b41sh b41sh marked this pull request as ready for review February 7, 2025 08:15
@sundy-li sundy-li merged commit a8f694f into databendlabs:main Feb 8, 2025
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-chore this PR only has small changes that no need to record, like coding styles.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue while casting to BIGINT
2 participants