Skip to content

Instantly share code, notes, and snippets.

View jsw883's full-sized avatar

James Williams jsw883

  • Yale Graduate School
  • New Haven, CT 06511
View GitHub Profile

For anyone who is interested, here's a case study on serialization of scala closures that may or may not have been the result of a lengthy and passionate discussion about what you can and can't serialize and why it's necessary to generate a closure with a generating function if you want to use it in Spark

import java.io.{ByteArrayOutputStream, ObjectOutputStream, NotSerializableException}

object Temp {

  def main(args: Array[String]): Unit = {

    def serialize(value: Any): Array[Byte] = {