mjakubowski84/parquet4s

Multiple custom TypedSchemaDefs are ambiguous

Jasper-M opened this issue · 2 comments

Using version 2.3.0, on Scala 2.12. Also tested on the latest 2.13 version.

import com.github.mjakubowski84.parquet4s.ParquetSchemaResolver.TypedSchemaDef
import java.time.{Instant, LocalDateTime}
import java.util.UUID

object ParquetImplicits {
  implicit def instantSchemaDef(implicit ldtSchemaDef: TypedSchemaDef[LocalDateTime]): TypedSchemaDef[Instant] = 
      ldtSchemaDef.typed[Instant]
  implicit def uuidSchemaDef(implicit strSchemaDef: TypedSchemaDef[String]): TypedSchemaDef[UUID] = 
      strSchemaDef.typed[UUID]
}

import ParquetImplicits._

case class Foo(id: Int, ts: Instant)

implicitly[TypedSchemaDef[Foo]]

This produces the following error

ambiguous implicit values:
 both method instantSchemaDef in object ParquetImplicits of type (implicit ldtSchemaDef: com.github.mjakubowski84.parquet4s.ParquetSchemaResolver.TypedSchemaDef[java.time.LocalDateTime]): com.github.mjakubowski84.parquet4s.ParquetSchemaResolver.TypedSchemaDef[java.time.Instant]
 and method uuidSchemaDef in object ParquetImplicits of type (implicit strSchemaDef: com.github.mjakubowski84.parquet4s.ParquetSchemaResolver.TypedSchemaDef[String]): com.github.mjakubowski84.parquet4s.ParquetSchemaResolver.TypedSchemaDef[java.util.UUID]
 match expected type com.github.mjakubowski84.parquet4s.SchemaDef

In 1.9.x this worked.

Thanks for reporting. I am looking into it already. It is going to be fixed in upcoming release this week.

@Jasper-M Version 2.4.0 is released - the issue should be fixed.