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

[client-v2] fixed number conversion in reader #1856

Merged
merged 4 commits into from
Oct 29, 2024
Merged

Conversation

chernser
Copy link
Contributor

@chernser chernser commented Oct 8, 2024

Summary

This PR implement conversion between different number types. Today client API (readers) allow to get column value only in the type it is defined in a DB. It is very inconvenient because requires to follow schema very strictly. So this PR relaxes this rule and lets to:

  • read a value of a number column as number with bigger range than it is defined in DB- 'int8' as int, int32 as long.
  • read a value of a number column as number with smaller range than it is defined in DB if actual value fits it - int32 value like 1000 can be read as short but not as byte.

Closes: #1852

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@chernser chernser requested a review from mzitnik October 29, 2024 06:00
@chernser chernser marked this pull request as ready for review October 29, 2024 06:00
Copy link

sonarcloud bot commented Oct 29, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
49.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link
Contributor

@mzitnik mzitnik left a comment

Choose a reason for hiding this comment

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

Can we tell if there any performance impact from this change?

@chernser
Copy link
Contributor Author

@mzitnik I may not tell exact numbers - will try running benchmark tests.

@chernser chernser merged commit 65bc28c into main Oct 29, 2024
58 of 60 checks passed
@chernser chernser deleted the v2_numbers_conversion branch October 29, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[client-v2] No conversion between number types (ex. short to int)
2 participants