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

[Java]Best practice with Apache/Spark #2015

Open
jayhan94 opened this issue Jan 20, 2025 · 1 comment
Open

[Java]Best practice with Apache/Spark #2015

jayhan94 opened this issue Jan 20, 2025 · 1 comment

Comments

@jayhan94
Copy link

Feature Request

Is there any best practice with apache/spark? Will the community implement such a module?

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@chaokunyang
Copy link
Collaborator

Hi @jayhan94 , we don't have such documents currently. A better fury integration with spark/flink would need to change the source code of serialization module in spark/flink, which is beyond the scope of this project. Maybe in future we can submit several proposal to spark/flink communities.

Currently, if you want to use fury in spark/flink, you can update your driver program to add several chained(narrow dependency in spark) serialization/deserialization operators.

Here is a simple spark rdd example:

val lines = sc.textFile("data.txt")
val structSet = lines.map(s => Json.parse(s, Struct.class))
kvset = structSet.map(s => (s.key, fury.serialize(s)))
kvset.groupByKey().map(t => (t._1, fury.deserialize(t._2.first))).collect.foreach(println)

Flink program will be similiar:

DataStream<Struct> dataStream = xxxstream.map(s -> Json.parse(s, Struct.class));
DataStream<byte[]> byteStream = dataStream.map(s -> json.serialize(s));
byteStream.rebalance().map(bytes -> (Struct)fury.deserialize(bytes));

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

No branches or pull requests

2 participants