spotify / scio

A Scala API for Apache Beam and Google Cloud Dataflow.
https://spotify.github.io/scio
Apache License 2.0
2.56k stars 513 forks source link

Importing protobuf Any breaks coder derivation #5410

Closed kellen closed 3 months ago

kellen commented 3 months ago
import com.google.protobuf.Any // if imported, will throw a coder error below
case class A(userId: Int)
object Job {
  def main(cmdlineArgs: Array[String]): Unit = {
    implicitly[com.spotify.scio.coders.Coder[A]]
  }
}

Throws:

[error] Cannot find an implicit Coder instance for type:
[error]
[error]   >> A

Aliasing the import or using the fully resolved class name sidesteps the issue

import com.google.protobuf.{Any => GAny}