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

feat(query): add error_or function #14980

Merged
merged 5 commits into from
Mar 17, 2024
Merged

Conversation

sundy-li
Copy link
Member

@sundy-li sundy-li commented Mar 16, 2024

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

Summary

  • add is_error, is_not_error function
🐳 :) select   is_error(from_base64('aj')),   is_not_error(from_base64('ac')), is_error(3);
┌─────────────────────────────────────────────────────────────────────────────┐
│ is_error(from_base64('aj')) │ is_not_error(from_base64('ac')) │ is_error(3) │
│           Boolean           │             Boolean             │   Boolean   │
├─────────────────────────────┼─────────────────────────────────┼─────────────┤
│ true                        │ false                           │ false       │
└─────────────────────────────────────────────────────────────────────────────┘
  • add error_or function which returns the first none-error arg as value or null if all arguments are error.
🐳 :) select error_or( from_base64('aak') ,  from_base64('aaj'),  from_base64('MzQz')  );
┌───────────────────────────────────────────────────────────────────────┐
│ error_or(from_base64('aak'), from_base64('aaj'), from_base64('mzqz')) │
│                            Nullable(Binary)                           │
├───────────────────────────────────────────────────────────────────────┤
│ 333433                                                                │
└───────────────────────────────────────────────────────────────────────┘
1 row read in 0.028 sec.

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-feature this PR introduces a new feature to the codebase label Mar 16, 2024
@sundy-li sundy-li requested review from PsiACE and andylokandy March 16, 2024 14:06
Copy link
Member

@PsiACE PsiACE left a comment

Choose a reason for hiding this comment

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

lgtm

@PsiACE
Copy link
Member

PsiACE commented Mar 16, 2024

I found an unrelated issue, maybe we shouldn't always lowercase everything in the header. from_base64('MzQz') and from_base64('mzqz') are different. Strings should remain as they are.

@BohuTANG BohuTANG merged commit fdacd61 into databendlabs:main Mar 17, 2024
72 checks passed
@BohuTANG
Copy link
Member

BohuTANG commented Mar 17, 2024

@soyeric128 Please update the documentation for new functions introduced in this PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: FROM_BASE64 function fails on invalid Base64 string instead of returning NULL.
3 participants