-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-4168: [GLib] Use property to keep GArrowDataType passed in garrow_field_new() #3322
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
ARROW-4168: [GLib] Use property to keep GArrowDataType passed in garrow_field_new() #3322
Conversation
kou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Can you check my comments?
c_glib/arrow-glib/column.cpp
Outdated
| auto arrow_field = arrow_column->field(); | ||
| return garrow_field_new_raw(&arrow_field); | ||
| return garrow_field_new_raw(&arrow_field, | ||
| garrow_column_get_data_type(column)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to call g_object_unref() for GArrowDataType * returned by garrow_column_get_data_type(). Because garrow_column_get_data_type() creates a new GArrowDataType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed it.
| * @field: A #GArrowField. | ||
| * | ||
| * Returns: (transfer full): The data type of the field. | ||
| * Returns: (transfer none): The data type of the field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks backward compatibility for C API users (not for GObject Introspection based bindings users).
Normally, it's not desired. But we can accept this for this case because users who use this function may not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
| auto field = garrow_field_new_raw(&arrow_field); | ||
| auto field = garrow_field_new_raw(&arrow_field, | ||
| GARROW_DATA_TYPE(list_data_type)); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse GARROW_DATA_TYPE(list_data_type) result for garrow_data_type_get_raw(GARROW_DATA_TYPE(list_data_type))?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reused GARROW_DATA_TYPE(list_data_type).
kou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
I'll merge this when CI is passed.
This is follow-up of #3197 (review)