-
Notifications
You must be signed in to change notification settings - Fork 655
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-543] Fixes RS_Union_aggr throwing referenceRaster is null error when run on cluster #1364
Conversation
def serializeSampleDimension(sampleDimension: GridSampleDimension): Array[Byte] = { | ||
val bos = new ByteArrayOutputStream() | ||
val oos = new ObjectOutputStream(bos) | ||
oos.writeObject(sampleDimension) | ||
oos.flush() | ||
bos.toByteArray | ||
} | ||
|
||
def deserializeSampleDimension(bytes: Array[Byte]): GridSampleDimension = { | ||
val bis = new ByteArrayInputStream(bytes) | ||
val ois = new ObjectInputStream(bis) | ||
ois.readObject().asInstanceOf[GridSampleDimension] | ||
} |
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 have a GridSampleDimensionSerializer
implemented using Kryo. I recommend using that instead of the Java serializer.
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.
Please don't commit this kind of empty change.
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.
Sorry I missed this
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 is fixed now.
@@ -176,4 +178,19 @@ public static GridCoverage2D deserialize(byte[] bytes) throws IOException, Class | |||
return state.restore(); | |||
} | |||
} | |||
|
|||
public static byte[] serializeGridSampleDimension(GridSampleDimension sampleDimension) { |
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 was already implemented in Sedona. Why implement it again?
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 is as per Kristin's recommendation to implement new serialization/deserialization methods for GridSampleDimension that use kryos.get()
to retrieve Kryo
objects. kryos.get()
avoids repeatedly initializing new Kryo instances.
I should have used the existing GridSampleDimensionSerializer
for read and write into output buffer. This is added now.
…or when run on cluster (#1364) * Init: move class level members to data buffer * move sampleDimension serde to Serde.java * update serde for sampleDimensions * Add checks for index * Undo typo * add custom GridSampleDimensionSerializer
Did you read the Contributor Guide?
Is this PR related to a JIRA ticket?
[SEDONA-XXX] my subject
.What changes were proposed in this PR?
referenceRaster
to data buffer.How was this patch tested?
Did this PR include necessary documentation updates?