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

Add Dynamic Type #1454

Merged
merged 9 commits into from
Jan 13, 2025
Merged

Add Dynamic Type #1454

merged 9 commits into from
Jan 13, 2025

Conversation

SpencerTorres
Copy link
Member

@SpencerTorres SpencerTorres commented Dec 20, 2024

Note: There are some server-side bugs that need to be fixed/merged, including a protocol update. However, this PR can still be reviewed as-is.

Summary

Implement Dynamic column type. Partially resolves #1430.

Usage

As for usage, this is the same as clickhouse.Variant, with the addition of an alias type called clickhouse.Dynamic. See Variant PR for more details on how these types work (#1453).

Since the Dynamic type starts as a blank Variant, it is best to append using clickhouse.NewDynamicWithType(value, "ClickHouseTypeName") so the underlying column can be created correctly. If a type isn't specified, a type inference function is used, but this may not always work as intended.

Examples are included in examples folder.

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added

@mshustov mshustov requested a review from jkaflik December 20, 2024 16:34
Copy link
Contributor

@jkaflik jkaflik left a comment

Choose a reason for hiding this comment

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

API is pretty much the same as for Variant. Looks good, but might have the same concerns for type access functions as for Variant. How do you want to proceed with these PRs?

Base automatically changed from variant_type to main January 10, 2025 17:57
lib/column/dynamic.go Dismissed Show resolved Hide resolved
@SpencerTorres
Copy link
Member Author

Included fixes/nits from the Variant PR, including adding tests for std sql. Also added a minimum server version check for the examples since that was causing test failures.

I still expect some server side changes to the Dynamic format in the future, but this should be ready to review/merge as is

@SpencerTorres SpencerTorres mentioned this pull request Jan 10, 2025
1 task
@SpencerTorres SpencerTorres merged commit 75a2e2a into main Jan 13, 2025
12 checks passed
@SpencerTorres SpencerTorres deleted the dynamic_type branch January 13, 2025 15:25
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.

Add support for new JSON type
2 participants