Skip to content

Commit

Permalink
Bump frameless version up
Browse files Browse the repository at this point in the history
  • Loading branch information
pomadchin committed Nov 10, 2021
1 parent bb43a93 commit cc826cd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ lazy val datasource = project
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
sttpCatsCe2,
stac4s,
framelessRefined excludeAll ExclusionRule(organization = "com.github.mpilquist"),
geotrellis("s3").value excludeAll ExclusionRule(organization = "com.github.mpilquist"),
spark("core").value % Provided,
spark("mllib").value % Provided,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import com.azavea.stac4s._
import com.azavea.stac4s.types.ItemDatetime
import eu.timepit.refined.api.{RefType, Validate}
import frameless.{Injection, SQLTimestamp, TypedEncoder, TypedExpressionEncoder}
import frameless.refined
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.jts.JTSTypes

import java.time.Instant
import scala.reflect.ClassTag

/** STAC API Dataframe relies on the Frameless Expressions derivation. */
trait StacSerializers {
Expand Down Expand Up @@ -42,9 +44,12 @@ trait StacSerializers {
implicit val itemDatetimeCatalystType: Injection[ItemDatetimeCatalystType, String] = Injection(_.repr, ItemDatetimeCatalystType.fromString)
implicit val itemDatetimeInjection: Injection[ItemDatetime, ItemDatetimeCatalyst] = Injection(ItemDatetimeCatalyst.fromItemDatetime, ItemDatetimeCatalyst.toDatetime)

/** Refined types support, https://github.com/typelevel/frameless/issues/257#issuecomment-914392485 */
implicit def refinedInjection[F[_, _], T, P](implicit refType: RefType[F], validate: Validate[T, P]): Injection[F[T, P], T] =
Injection(refType.unwrap, value => refType.refine[P](value).valueOr(errMsg => throw new IllegalArgumentException(s"Value $value does not satisfy refinement predicate: $errMsg")))
/** Refined types support, proxies to avoid frameless.refined import in the client code */
implicit def refinedInjection[F[_, _]: RefType, T, R: Validate[T, *]]: Injection[F[T, R], T] =
refined.refinedInjection

implicit def refinedEncoder[F[_, _]: RefType, T: TypedEncoder, R: Validate[T, *]](implicit ct: ClassTag[F[T, R]]): TypedEncoder[F[T, R]] =
refined.refinedEncoder

/** Set would be stored as Array */
implicit def setInjection[T]: Injection[Set[T], List[T]] = Injection(_.toList, _.toSet)
Expand Down
3 changes: 2 additions & 1 deletion project/RFDependenciesPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ object RFDependenciesPlugin extends AutoPlugin {
val `scala-logging` = "com.typesafe.scala-logging" %% "scala-logging" % "3.8.0"
val stac4s = "com.azavea.stac4s" %% "client" % "0.7.2"
val sttpCatsCe2 = "com.softwaremill.sttp.client3" %% "async-http-client-backend-cats-ce2" % "3.3.15"
val frameless = "org.typelevel" %% "frameless-dataset" % "0.10.1"
val frameless = "org.typelevel" %% "frameless-dataset-spark31" % "0.11.1"
val framelessRefined = "org.typelevel" %% "frameless-refined-spark31" % "0.11.1"
}
import autoImport._

Expand Down

0 comments on commit cc826cd

Please sign in to comment.