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

Migrate unstable field json repr to a canonical one #594

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Aug 7, 2024

Move away from the arrow_integration_test::{schema_from_json, field_from_json} to the one representation provided via serde directly on the arrow types.

We currently don't use the persisted fields anywhere, but add a migration just in case we may need one.

@gruuya gruuya requested a review from mildbyte August 7, 2024 14:32
@@ -59,6 +59,39 @@ macro_rules! implement_repository {
#[async_trait]
impl Repository for $repo {
async fn setup(&self) {
// TODO remove the entire block a couple of releases past 0.5.7
{
// Migrate the old field JSON format to the canonical one
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tested the migration locally, it successfully converted

{"children":[],"name":"cc_call_center_sk","nullable":true,"type":{"bitWidth":32,"isSigned":true,"name":"int"}}
{"children":[],"name":"cc_call_center_id","nullable":true,"type":{"name":"utf8"}}
{"children":[],"name":"cc_rec_start_date","nullable":true,"type":{"name":"date","unit":"DAY"}}
...
{"children":[],"name":"RefererHash","nullable":false,"type":{"bitWidth":64,"isSigned":true,"name":"int"}}
{"children":[],"name":"URLHash","nullable":false,"type":{"bitWidth":64,"isSigned":true,"name":"int"}}
{"children":[],"name":"CLID","nullable":false,"type":{"bitWidth":32,"isSigned":true,"name":"int"}}

into the following repr

{"name":"cc_call_center_sk","data_type":"Int32","nullable":true,"dict_id":0,"dict_is_ordered":false,"metadata":{}}
{"name":"cc_call_center_id","data_type":"Utf8","nullable":true,"dict_id":0,"dict_is_ordered":false,"metadata":{}}
{"name":"cc_rec_start_date","data_type":"Date32","nullable":true,"dict_id":0,"dict_is_ordered":false,"metadata":{}}
...
{"name":"RefererHash","data_type":"Int64","nullable":false,"dict_id":0,"dict_is_ordered":false,"metadata":{}}
{"name":"URLHash","data_type":"Int64","nullable":false,"dict_id":0,"dict_is_ordered":false,"metadata":{}}
{"name":"CLID","data_type":"Int32","nullable":false,"dict_id":0,"dict_is_ordered":false,"metadata":{}}

@gruuya gruuya merged commit 5a77e9a into main Aug 8, 2024
1 check passed
@gruuya gruuya deleted the serde-schema-field-json branch August 8, 2024 09:31
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.

2 participants