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(arrow): GeoArrow utilities #2744

Merged
merged 6 commits into from
Oct 27, 2023
Merged

feat(arrow): GeoArrow utilities #2744

merged 6 commits into from
Oct 27, 2023

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Oct 26, 2023

This is a repackaging for #2738 so that those utilities fit into the right places/sub-modules in loaders.gl

@ibgreen ibgreen marked this pull request as draft October 26, 2023 18:48
]
};

test.skip('ArrowUtils#parseGeometryFromArrow', async (t) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lixun910 This test case crashes, haven't had time to debug yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Update the serializeArrowType() and deserializeArrowType() functions to fix the issues.

@ibgreen ibgreen marked this pull request as ready for review October 26, 2023 20:13
Signed-off-by: Xun Li <[email protected]>
@@ -71,7 +71,7 @@ export function deserializeArrowMetadata(metadata?: SchemaMetadata): Map<string,
export function serializeArrowField(field: ArrowField): Field {
return {
name: field.name,
type: serializeArrowType(field.type),
type: field.type.toString(),
Copy link
Collaborator

@lixun910 lixun910 Oct 26, 2023

Choose a reason for hiding this comment

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

The test case failed because serializeArrowType(field.type) can't handle the class 'Int', which could be Int8/16/32/64 based on the bitwise and isSigned value.

It seems that the Type class in apache-arrow has toString() to get the stringified arrow field type. I am checking if it compatible with the deserializeArrowType() function.

Update: the DataType toString() is NOT compatible with the deserializeArrowType() function. New cases e.g. Int, Float, List are added in serializeArrowType(field.type).

Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be easier in some places to use arrow.Type.isUint8() etc instead of manually checking the type yourself

Comment on lines +212 to +218
case List:
const listType = arrowType as List;
const listField = listType.valueField;
return {
type: 'list',
children: [serializeArrowField(listField)]
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to add List class type when serialization, e.g. for a polygon field, the field type could be like List<List<FixedSizeList[2]<Float64>>>

@ibgreen ibgreen merged commit 6b24df5 into master Oct 27, 2023
@ibgreen ibgreen deleted the ib/geo-arrow branch October 27, 2023 00:43
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.

3 participants