Skip to content

Commit

Permalink
Update scala3-library to 3.4.1 (#75)
Browse files Browse the repository at this point in the history
* Update scala3-library to 3.4.1

* Regenerate GitHub Actions workflow

Executed command: sbt githubWorkflowGenerate

* Fix scala source compatibility

---------

Co-authored-by: Michael Nedokushev <grouzen.hexy@gmail.com>
  • Loading branch information
scala-steward and grouzen authored Dec 26, 2024
1 parent d8d8f23 commit 3b38139
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.20, 2.13.15, 3.3.4]
scala: [2.12.20, 2.13.15, 3.4.1]
java: [temurin@11, temurin@17]
runs-on: ${{ matrix.os }}
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Tabular {

def empty[A: ZSchema](implicit
schemaEncoder: SchemaEncoder[A]
): RIO[Scope with BufferAllocator, VectorSchemaRoot] =
): RIO[Scope & BufferAllocator, VectorSchemaRoot] =
ZIO.fromAutoCloseable(
ZIO.serviceWithZIO[BufferAllocator] { implicit alloc =>
for {
Expand All @@ -31,15 +31,15 @@ object Tabular {

def fromChunk[A: ZSchema: SchemaEncoder](chunk: Chunk[A])(implicit
encoder: VectorSchemaRootEncoder[A]
): RIO[Scope with BufferAllocator, VectorSchemaRoot] =
): RIO[Scope & BufferAllocator, VectorSchemaRoot] =
for {
root <- empty
_ <- encoder.encodeZIO(chunk, root)
} yield root

def fromStream[R, A: ZSchema: SchemaEncoder](stream: ZStream[R, Throwable, A])(implicit
encoder: VectorSchemaRootEncoder[A]
): RIO[R with Scope with BufferAllocator, VectorSchemaRoot] =
): RIO[R & Scope & BufferAllocator, VectorSchemaRoot] =
for {
chunk <- stream.runCollect
root <- fromChunk(chunk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Vector {
new FromChunkPartiallyApplied[V]

final class FromChunkPartiallyApplied[V <: ValueVector](private val dummy: Boolean = true) extends AnyVal {
def apply[A](chunk: Chunk[A])(implicit encoder: ValueVectorEncoder[V, A]): RIO[Scope with BufferAllocator, V] =
def apply[A](chunk: Chunk[A])(implicit encoder: ValueVectorEncoder[V, A]): RIO[Scope & BufferAllocator, V] =
encoder.encodeZIO(chunk)
}

Expand All @@ -22,7 +22,7 @@ object Vector {
final class FromStreamPartiallyApplied[V <: ValueVector](private val dummy: Boolean = true) extends AnyVal {
def apply[R, A](
stream: ZStream[R, Throwable, A]
)(implicit encoder: ValueVectorEncoder[V, A]): RIO[R with Scope with BufferAllocator, V] =
)(implicit encoder: ValueVectorEncoder[V, A]): RIO[R & Scope & BufferAllocator, V] =
for {
chunk <- stream.runCollect
vec <- fromChunk(chunk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object SchemaEncoderDeriver {

override def deriveRecord[A](
record: Schema.Record[A],
fields: => Chunk[Deriver.WrappedF[SchemaEncoder, _]],
fields: => Chunk[Deriver.WrappedF[SchemaEncoder, ?]],
summoned: => Option[SchemaEncoder[A]]
): SchemaEncoder[A] = new SchemaEncoder[A] {

Expand Down Expand Up @@ -46,7 +46,7 @@ object SchemaEncoderDeriver {

override def deriveEnum[A](
`enum`: Schema.Enum[A],
cases: => Chunk[Deriver.WrappedF[SchemaEncoder, _]],
cases: => Chunk[Deriver.WrappedF[SchemaEncoder, ?]],
summoned: => Option[SchemaEncoder[A]]
): SchemaEncoder[A] =
new SchemaEncoder[A] {
Expand Down Expand Up @@ -143,7 +143,7 @@ object SchemaEncoderDeriver {
}

override def deriveSequence[C[_], A](
sequence: Schema.Sequence[C[A], A, _],
sequence: Schema.Sequence[C[A], A, ?],
inner: => SchemaEncoder[A],
summoned: => Option[SchemaEncoder[C[A]]]
): SchemaEncoder[C[A]] = new SchemaEncoder[C[A]] {
Expand All @@ -167,8 +167,8 @@ object SchemaEncoderDeriver {

override def deriveTransformedRecord[A, B](
record: Schema.Record[A],
transform: Schema.Transform[A, B, _],
fields: => Chunk[Deriver.WrappedF[SchemaEncoder, _]],
transform: Schema.Transform[A, B, ?],
fields: => Chunk[Deriver.WrappedF[SchemaEncoder, ?]],
summoned: => Option[SchemaEncoder[B]]
): SchemaEncoder[B] = new SchemaEncoder[B] {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ trait ValueDecoder[+A] {
object ValueDecoder {

private[codec] def decodeStruct[V0 <: ValueVector, A](
fields: Chunk[Schema.Field[A, _]],
decoders: Chunk[ValueDecoder[_]],
fields: Chunk[Schema.Field[A, ?]],
decoders: Chunk[ValueDecoder[?]],
reader: FieldReader,
vec: V0,
idx: Int
): DynamicValue = {
val values = ListMap(fields.zip(decoders).map { case (field, decoder) =>
val value: DynamicValue = decoder.decodeValue(Some(field.name), reader, vec, idx)
val values = ListMap(
fields
.zip(decoders)
.map { case (field, decoder) =>
val value: DynamicValue = decoder.decodeValue(Some(field.name), reader, vec, idx)

field.name.toString -> value
}: _*)
field.name.toString -> value
} *
)

DynamicValue.Record(TypeId.Structural, values)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ object ValueEncoder {

private[codec] def encodeStruct[A](
value: A,
fields: Chunk[Schema.Field[A, _]],
encoders: Chunk[ValueEncoder[_]],
fields: Chunk[Schema.Field[A, ?]],
encoders: Chunk[ValueEncoder[?]],
writer: FieldWriter
)(implicit alloc: BufferAllocator): Unit = {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final case class ValueVectorCodec[V <: ValueVector, A](
def decode(vec: V): Either[Throwable, Chunk[A]] =
decoder.decode(vec)

def encodeZIO(chunk: Chunk[A]): RIO[Scope with BufferAllocator, V] =
def encodeZIO(chunk: Chunk[A]): RIO[Scope & BufferAllocator, V] =
encoder.encodeZIO(chunk)

def encode(chunk: Chunk[A])(implicit alloc: BufferAllocator): Either[Throwable, V] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object ValueVectorDecoderDeriver {

override def deriveRecord[A](
record: Schema.Record[A],
fields: => Chunk[Deriver.WrappedF[ValueVectorDecoder[V1, *], _]],
fields: => Chunk[Deriver.WrappedF[ValueVectorDecoder[V1, *], ?]],
summoned: => Option[ValueVectorDecoder[V1, A]]
): ValueVectorDecoder[V1, A] = new ValueVectorDecoder[V1, A] {

Expand Down Expand Up @@ -80,7 +80,7 @@ object ValueVectorDecoderDeriver {

override def deriveEnum[A](
`enum`: Schema.Enum[A],
cases: => Chunk[Deriver.WrappedF[ValueVectorDecoder[V1, *], _]],
cases: => Chunk[Deriver.WrappedF[ValueVectorDecoder[V1, *], ?]],
summoned: => Option[ValueVectorDecoder[V1, A]]
): ValueVectorDecoder[V1, A] = ???

Expand Down Expand Up @@ -117,7 +117,7 @@ object ValueVectorDecoderDeriver {
}

override def deriveSequence[C[_], A](
sequence: Schema.Sequence[C[A], A, _],
sequence: Schema.Sequence[C[A], A, ?],
inner: => ValueVectorDecoder[V1, A],
summoned: => Option[ValueVectorDecoder[V1, C[A]]]
): ValueVectorDecoder[V1, C[A]] = new ValueVectorDecoder[V1, C[A]] {
Expand Down Expand Up @@ -193,8 +193,8 @@ object ValueVectorDecoderDeriver {

override def deriveTransformedRecord[A, B](
record: Schema.Record[A],
transform: Schema.Transform[A, B, _],
fields: => Chunk[Deriver.WrappedF[ValueVectorDecoder[V1, *], _]],
transform: Schema.Transform[A, B, ?],
fields: => Chunk[Deriver.WrappedF[ValueVectorDecoder[V1, *], ?]],
summoned: => Option[ValueVectorDecoder[V1, B]]
): ValueVectorDecoder[V1, B] = ???

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.util.control.NonFatal

trait ValueVectorEncoder[V <: ValueVector, -A] extends ValueEncoder[A] { self =>

final def encodeZIO(chunk: Chunk[A]): RIO[Scope with BufferAllocator, V] =
final def encodeZIO(chunk: Chunk[A]): RIO[Scope & BufferAllocator, V] =
ZIO.fromAutoCloseable(
ZIO.serviceWithZIO[BufferAllocator] { implicit alloc =>
ZIO.fromEither(encode(chunk))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object ValueVectorEncoderDeriver {

override def deriveRecord[A](
record: Schema.Record[A],
fields: => Chunk[Deriver.WrappedF[ValueVectorEncoder[V1, *], _]],
fields: => Chunk[Deriver.WrappedF[ValueVectorEncoder[V1, *], ?]],
summoned: => Option[ValueVectorEncoder[V1, A]]
): ValueVectorEncoder[V1, A] = new ValueVectorEncoder[V1, A] {

Expand Down Expand Up @@ -56,7 +56,7 @@ object ValueVectorEncoderDeriver {

override def deriveEnum[A](
`enum`: Schema.Enum[A],
cases: => Chunk[Deriver.WrappedF[ValueVectorEncoder[V1, *], _]],
cases: => Chunk[Deriver.WrappedF[ValueVectorEncoder[V1, *], ?]],
summoned: => Option[ValueVectorEncoder[V1, A]]
): ValueVectorEncoder[V1, A] = ???

Expand Down Expand Up @@ -159,7 +159,7 @@ object ValueVectorEncoderDeriver {
}

override def deriveSequence[C[_], A](
sequence: Schema.Sequence[C[A], A, _],
sequence: Schema.Sequence[C[A], A, ?],
inner: => ValueVectorEncoder[V1, A],
summoned: => Option[ValueVectorEncoder[V1, C[A]]]
): ValueVectorEncoder[V1, C[A]] =
Expand Down Expand Up @@ -205,8 +205,8 @@ object ValueVectorEncoderDeriver {

override def deriveTransformedRecord[A, B](
record: Schema.Record[A],
transform: Schema.Transform[A, B, _],
fields: => Chunk[Deriver.WrappedF[ValueVectorEncoder[V1, *], _]],
transform: Schema.Transform[A, B, ?],
fields: => Chunk[Deriver.WrappedF[ValueVectorEncoder[V1, *], ?]],
summoned: => Option[ValueVectorEncoder[V1, B]]
): ValueVectorEncoder[V1, B] = ???

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final case class VectorSchemaRootCodec[A](
def decode(root: VectorSchemaRoot): Either[Throwable, Chunk[A]] =
decoder.decode(root)

def encodeZIO(chunk: Chunk[A], root: VectorSchemaRoot): RIO[Scope with BufferAllocator, VectorSchemaRoot] =
def encodeZIO(chunk: Chunk[A], root: VectorSchemaRoot): RIO[Scope & BufferAllocator, VectorSchemaRoot] =
encoder.encodeZIO(chunk, root)

def encode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object VectorSchemaRootDecoderDeriver {

override def deriveRecord[A](
record: Schema.Record[A],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootDecoder, _]],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootDecoder, ?]],
summoned: => Option[VectorSchemaRootDecoder[A]]
): VectorSchemaRootDecoder[A] = new VectorSchemaRootDecoder[A] {

Expand All @@ -40,7 +40,7 @@ object VectorSchemaRootDecoderDeriver {
val value = decoder.decodeField(reader, vec, idx)

name.toString -> value
}: _*)
} *)

DynamicValue.Record(TypeId.Structural, values).toTypedValue(record) match {
case Right(v) =>
Expand Down Expand Up @@ -69,7 +69,7 @@ object VectorSchemaRootDecoderDeriver {

override def deriveEnum[A](
`enum`: Schema.Enum[A],
cases: => Chunk[Deriver.WrappedF[VectorSchemaRootDecoder, _]],
cases: => Chunk[Deriver.WrappedF[VectorSchemaRootDecoder, ?]],
summoned: => Option[VectorSchemaRootDecoder[A]]
): VectorSchemaRootDecoder[A] = ???

Expand Down Expand Up @@ -105,7 +105,7 @@ object VectorSchemaRootDecoderDeriver {
}

override def deriveSequence[C[_], A](
sequence: Schema.Sequence[C[A], A, _],
sequence: Schema.Sequence[C[A], A, ?],
inner: => VectorSchemaRootDecoder[A],
summoned: => Option[VectorSchemaRootDecoder[C[A]]]
): VectorSchemaRootDecoder[C[A]] = new VectorSchemaRootDecoder[C[A]] {
Expand Down Expand Up @@ -138,8 +138,8 @@ object VectorSchemaRootDecoderDeriver {

override def deriveTransformedRecord[A, B](
record: Schema.Record[A],
transform: Schema.Transform[A, B, _],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootDecoder, _]],
transform: Schema.Transform[A, B, ?],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootDecoder, ?]],
summoned: => Option[VectorSchemaRootDecoder[B]]
): VectorSchemaRootDecoder[B] = ???

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.util.control.NonFatal

trait VectorSchemaRootEncoder[-A] extends ValueEncoder[A] { self =>

final def encodeZIO(chunk: Chunk[A], root: VectorSchemaRoot): RIO[Scope with BufferAllocator, VectorSchemaRoot] =
final def encodeZIO(chunk: Chunk[A], root: VectorSchemaRoot): RIO[Scope & BufferAllocator, VectorSchemaRoot] =
ZIO.fromAutoCloseable(
ZIO.serviceWithZIO[BufferAllocator] { implicit alloc =>
ZIO.fromEither(encode(chunk, root))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ object VectorSchemaRootEncoderDeriver {

override def deriveRecord[A](
record: Schema.Record[A],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootEncoder, _]],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootEncoder, ?]],
summoned: => Option[VectorSchemaRootEncoder[A]]
): VectorSchemaRootEncoder[A] = new VectorSchemaRootEncoder[A] {

private val encoders = fields.map(_.unwrap)

private def encodeField0[A1](
encoder: VectorSchemaRootEncoder[_],
encoder: VectorSchemaRootEncoder[?],
value: A1,
writer: FieldWriter
)(implicit
Expand Down Expand Up @@ -86,7 +86,7 @@ object VectorSchemaRootEncoderDeriver {

override def deriveEnum[A](
`enum`: Schema.Enum[A],
cases: => Chunk[Deriver.WrappedF[VectorSchemaRootEncoder, _]],
cases: => Chunk[Deriver.WrappedF[VectorSchemaRootEncoder, ?]],
summoned: => Option[VectorSchemaRootEncoder[A]]
): VectorSchemaRootEncoder[A] = ???

Expand Down Expand Up @@ -130,7 +130,7 @@ object VectorSchemaRootEncoderDeriver {
}

override def deriveSequence[C[_], A](
sequence: Schema.Sequence[C[A], A, _],
sequence: Schema.Sequence[C[A], A, ?],
inner: => VectorSchemaRootEncoder[A],
summoned: => Option[VectorSchemaRootEncoder[C[A]]]
): VectorSchemaRootEncoder[C[A]] = new VectorSchemaRootEncoder[C[A]] {
Expand Down Expand Up @@ -160,8 +160,8 @@ object VectorSchemaRootEncoderDeriver {

override def deriveTransformedRecord[A, B](
record: Schema.Record[A],
transform: Schema.Transform[A, B, _],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootEncoder, _]],
transform: Schema.Transform[A, B, ?],
fields: => Chunk[Deriver.WrappedF[VectorSchemaRootEncoder, ?]],
summoned: => Option[VectorSchemaRootEncoder[B]]
): VectorSchemaRootEncoder[B] = ???

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import zio.schema.StandardType

package object codec {

def primitiveWriter(st: StandardType[_], vec: FieldVector): FieldWriter =
def primitiveWriter(st: StandardType[?], vec: FieldVector): FieldWriter =
(st, vec) match {
case (StandardType.StringType, vec0: VarCharVector) =>
new VarCharWriterImpl(vec0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package object ipc {
in: InputStream
)(implicit
decoder: VectorSchemaRootDecoder[A]
): ZStream[Scope with BufferAllocator, Throwable, A] =
): ZStream[Scope & BufferAllocator, Throwable, A] =
for {
(reader, root) <- ZStream
.fromZIO(
Expand Down Expand Up @@ -45,7 +45,7 @@ package object ipc {
batchSize: Int = 2048
)(implicit
encoder: VectorSchemaRootEncoder[A]
): ZIO[R with Scope with BufferAllocator, Throwable, ByteArrayOutputStream] = {
): ZIO[R & Scope & BufferAllocator, Throwable, ByteArrayOutputStream] = {
val out = new ByteArrayOutputStream()

for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import zio.test._

object TabularSpec extends ZIOSpecDefault {

override def spec: Spec[TestEnvironment with Scope, Any] =
override def spec: Spec[TestEnvironment & Scope, Any] =
suite("Tabular")(
test("empty") {
ZIO.scoped(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import zio.test._

object VectorSpec extends ZIOSpecDefault {

override def spec: Spec[TestEnvironment with Scope, Any] =
override def spec: Spec[TestEnvironment & Scope, Any] =
suite("Vector")(
test("fromChunk") {
val payload = Chunk(1, 2, 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object CodecSpec extends ZIOSpecDefault {
Derive.derive[VectorSchemaRootDecoder, Summoned0](VectorSchemaRootDecoderDeriver.summoned)
}

override def spec: Spec[TestEnvironment with Scope, Any] =
override def spec: Spec[TestEnvironment & Scope, Any] =
suite("Codec")(
valueVectorDecoderSpec,
valueVectorEncoderSpec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.jdk.CollectionConverters._

object SchemaEncoderSpec extends ZIOSpecDefault {

override def spec: Spec[TestEnvironment with Scope, Any] =
override def spec: Spec[TestEnvironment & Scope, Any] =
suite("SchemaEncoder")(
encodeFlatSpec
)
Expand Down
Loading

0 comments on commit 3b38139

Please sign in to comment.