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

[SEDONA-318] Avoid creating an unnecessary copy of raster data when serializing rasters backed by BufferedImage #906

Merged

Conversation

Kontinuation
Copy link
Member

@Kontinuation Kontinuation commented Jul 17, 2023

Did you read the Contributor Guide?

Is this PR related to a JIRA ticket?

What changes were proposed in this PR?

The current implementation of the GridCoverage2D serializer calls the getData method of the rendered image to obtain serializable raster data. When the rendered image object is a BufferedImage, it will create a hard copy of the underlying raster, which is very time-consuming. This happens when serializing rasters created by RS_MakeEmptyRaster or RS_AddBandFromArray.

This patch adds a fast path for GridCoverage2D objects backed by a BufferedImage. We call getRaster to obtain the serializable raster. This won't make a new copy of the raster data.

How was this patch tested?

Passes existing tests.

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the docs.

@jiayuasu jiayuasu added this to the sedona-1.5.0 milestone Jul 17, 2023
@jiayuasu jiayuasu merged commit af3aac6 into apache:master Jul 17, 2023
29 of 39 checks passed
@Kontinuation Kontinuation deleted the raster-serde-optimize-buffered-image branch August 23, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants