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: support Octets for Char/Varchar #184

Merged
merged 5 commits into from
Mar 28, 2024
Merged

Conversation

KKould
Copy link
Member

@KKould KKould commented Mar 27, 2024

What problem does this PR solve?

create table t1(id int primary key, v1 char, v2 char(5 characters), v3 char(5 octets))

insert into t1 values(0, '🖕', '🖕🖕🖕🖕🖕', '🖕');

insert into t1 values(1, null, null, null);

select * from t1;
----
0 🖕 🖕🖕🖕🖕🖕 🖕
1 null null null

Tips: originally, LogicalType::Char/LogicalType::Varchar could get the exact value in the LogicalType::raw_len method, but now only Octet's Char/Varchar is allowed to be returned, because only Octet determines the number of Bytes, while Character only limits the number of characters. In utf8, The minimum number of bytes of 4 characters is 4 and the maximum is 16(undetermined number of bytes)

What is changed and how it works?

Code changes

  • Has Rust code change
  • Has CI related scripts change

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Note for reviewer

@KKould KKould requested a review from crwen March 27, 2024 14:54
@KKould KKould self-assigned this Mar 27, 2024
@KKould KKould added bug Something isn't working enhancement New feature or request labels Mar 27, 2024
src/types/value.rs Outdated Show resolved Hide resolved
@KKould KKould requested a review from crwen March 28, 2024 07:56
@KKould KKould merged commit 126c6c8 into KipData:main Mar 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants