scalding icon indicating copy to clipboard operation
scalding copied to clipboard

scalding macro annotation

Open johnynek opened this issue 7 years ago • 3 comments

This is a vague idea, but we could make a scalding macro annotation, such as:

@scalding
class MyJob(foo: Args) extends Job(args) {

}

Which could do some standard transformation of the code so that a lot of common gotchas are fixed. For instance, we could move any case classes defined inside out of the Job. We could make all val into lazy val which will almost certainly not hurt perf, but may improve serializability. We could move all the constructor code into a method:

class Foo(args: Args) extends Job(args) {
  baz
}
// becomes
class Foo(args: Args) extends Job(args) {
  private[this] def init() = {
    baz
  }
  init()
}

so that we avoid making member fields with any local vals (which might improve serialization). (we would probably have to handle override separately, but that seems tractable since people almost never, and should probably never override anything but config and next in a Job.

There are probably other ideas.

thoughts?

cc @sritchie @ianoc @piyushnarang @isnotinvain

johnynek avatar Mar 28 '17 19:03 johnynek