From d37e541e32fa9eff870cfe7a475eeab65358f4bf Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 29 Jul 2024 14:46:54 +0000 Subject: [PATCH 1/3] Update scalafmt-core to 3.8.3 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index dc2c06c..556713f 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ style = defaultWithAlign maxColumn = 120 -version = 2.7.5 +version = 3.8.3 runner.dialect = "scala213" From 867d1cf479642e3bfccf04d54ff54a226e07626c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 29 Jul 2024 14:47:06 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.8.3 Executed command: scalafmt --non-interactive --- build.sbt | 6 +++--- src/main/scala/io/findify/flinkadt/api/package.scala | 6 +++--- .../flinkadt/api/serializer/CaseClassSerializer.scala | 5 ++--- .../flinkadt/api/serializer/CoproductSerializer.scala | 2 +- .../flinkadt/api/serializer/EitherSerializer.scala | 5 ++--- .../flinkadt/api/serializer/NothingSerializer.scala | 5 ++--- .../api/serializer/ScalaCaseClassSerializer.scala | 7 +++---- .../api/serializer/ScalaCaseObjectSerializer.scala | 10 +++++----- .../flinkadt/api/typeinfo/CaseClassComparator.scala | 3 +-- .../flinkadt/api/typeinfo/CaseClassTypeInfo.scala | 10 +++++----- .../api/typeinfo/CollectionTypeInformation.scala | 2 +- .../findify/flinkadt/api/typeinfo/EitherTypeInfo.scala | 6 +++--- .../flinkadt/api/typeinfo/SimpleTypeInformation.scala | 4 ++-- .../scala/io/findify/flinkadt/SerializerTest.scala | 2 +- src/test/scala/io/findify/flinkadt/TestUtils.scala | 2 +- 15 files changed, 35 insertions(+), 40 deletions(-) diff --git a/build.sbt b/build.sbt index 5e4a550..91028bd 100644 --- a/build.sbt +++ b/build.sbt @@ -6,12 +6,12 @@ lazy val `scala 2.12` = "2.12.15" lazy val `scala 2.13` = "2.13.8" lazy val `scala 3` = "3.1.2" -scalaVersion := `scala 2.13` +scalaVersion := `scala 2.13` crossScalaVersions := Seq(`scala 2.12`, `scala 2.13`, `scala 3`) organization := "io.findify" -licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")) -homepage := Some(url("https://github.com/findify/flink-adt")) +licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")) +homepage := Some(url("https://github.com/findify/flink-adt")) publishMavenStyle := true diff --git a/src/main/scala/io/findify/flinkadt/api/package.scala b/src/main/scala/io/findify/flinkadt/api/package.scala index ed499e1..741200f 100644 --- a/src/main/scala/io/findify/flinkadt/api/package.scala +++ b/src/main/scala/io/findify/flinkadt/api/package.scala @@ -97,9 +97,9 @@ package object api extends LowPrioImplicits { implicit lazy val shortInfo: TypeInformation[Short] = BasicTypeInfo.getInfoFor(classOf[Short]) implicit lazy val bigDecMapper: TypeMapper[scala.BigDecimal, java.math.BigDecimal] = new BigDecMapper() - implicit lazy val bigDecInfo: TypeInformation[BigDecimal] = mappedTypeInfo[scala.BigDecimal, java.math.BigDecimal] - implicit lazy val bigIntMapper: TypeMapper[scala.BigInt, java.math.BigInteger] = new BigIntMapper() - implicit lazy val bigIntInfo: TypeInformation[BigInt] = mappedTypeInfo[scala.BigInt, java.math.BigInteger] + implicit lazy val bigDecInfo: TypeInformation[BigDecimal] = mappedTypeInfo[scala.BigDecimal, java.math.BigDecimal] + implicit lazy val bigIntMapper: TypeMapper[scala.BigInt, java.math.BigInteger] = new BigIntMapper() + implicit lazy val bigIntInfo: TypeInformation[BigInt] = mappedTypeInfo[scala.BigInt, java.math.BigInteger] implicit lazy val unitInfo: TypeInformation[Unit] = new UnitTypeInformation() implicit def mappedTypeInfo[A: ClassTag, B](implicit diff --git a/src/main/scala/io/findify/flinkadt/api/serializer/CaseClassSerializer.scala b/src/main/scala/io/findify/flinkadt/api/serializer/CaseClassSerializer.scala index 85cb4f7..29d0f2a 100644 --- a/src/main/scala/io/findify/flinkadt/api/serializer/CaseClassSerializer.scala +++ b/src/main/scala/io/findify/flinkadt/api/serializer/CaseClassSerializer.scala @@ -23,9 +23,8 @@ import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase import org.apache.flink.core.memory.{DataInputView, DataOutputView} import org.apache.flink.types.NullFieldException -/** Serializer for Case Classes. Creation and access is different from - * our Java Tuples so we have to treat them differently. - * Copied from Flink 1.14. +/** Serializer for Case Classes. Creation and access is different from our Java Tuples so we have to treat them + * differently. Copied from Flink 1.14. */ @Internal @SerialVersionUID(7341356073446263475L) diff --git a/src/main/scala/io/findify/flinkadt/api/serializer/CoproductSerializer.scala b/src/main/scala/io/findify/flinkadt/api/serializer/CoproductSerializer.scala index 06e03a4..d740fab 100644 --- a/src/main/scala/io/findify/flinkadt/api/serializer/CoproductSerializer.scala +++ b/src/main/scala/io/findify/flinkadt/api/serializer/CoproductSerializer.scala @@ -14,7 +14,7 @@ class CoproductSerializer[T](subtypeClasses: Array[Class[_]], subtypeSerializers override def copy(from: T): T = from override def copy(from: T, reuse: T): T = from override def copy(source: DataInputView, target: DataOutputView): Unit = serialize(deserialize(source), target) - override def createInstance(): T = + override def createInstance(): T = // this one may be used for later reuse, but we never reuse coproducts due to their unclear concrete type subtypeSerializers.head.createInstance().asInstanceOf[T] override def getLength: Int = -1 diff --git a/src/main/scala/io/findify/flinkadt/api/serializer/EitherSerializer.scala b/src/main/scala/io/findify/flinkadt/api/serializer/EitherSerializer.scala index 5b3a158..8dc50c4 100644 --- a/src/main/scala/io/findify/flinkadt/api/serializer/EitherSerializer.scala +++ b/src/main/scala/io/findify/flinkadt/api/serializer/EitherSerializer.scala @@ -21,8 +21,7 @@ import org.apache.flink.annotation.Internal import org.apache.flink.api.common.typeutils._ import org.apache.flink.core.memory.{DataInputView, DataOutputView} -/** Serializer for [[Either]]. - * Copied from Flink 1.14. +/** Serializer for [[Either]]. Copied from Flink 1.14. */ @Internal @SerialVersionUID(9219995873023657525L) @@ -101,7 +100,7 @@ class EitherSerializer[A, B]( obj match { case eitherSerializer: EitherSerializer[_, _] => leftSerializer.equals(eitherSerializer.leftSerializer) && - rightSerializer.equals(eitherSerializer.rightSerializer) + rightSerializer.equals(eitherSerializer.rightSerializer) case _ => false } } diff --git a/src/main/scala/io/findify/flinkadt/api/serializer/NothingSerializer.scala b/src/main/scala/io/findify/flinkadt/api/serializer/NothingSerializer.scala index 3dc0bb2..3b38e3c 100644 --- a/src/main/scala/io/findify/flinkadt/api/serializer/NothingSerializer.scala +++ b/src/main/scala/io/findify/flinkadt/api/serializer/NothingSerializer.scala @@ -23,9 +23,8 @@ import org.apache.flink.annotation.Internal import org.apache.flink.api.common.typeutils.{SimpleTypeSerializerSnapshot, TypeSerializer, TypeSerializerSnapshot} import org.apache.flink.core.memory.{DataInputView, DataOutputView} -/** Serializer for cases where no serializer is required but the system still expects one. This - * happens for OptionTypeInfo when None is used, or for Either when one of the type parameters - * is Nothing. +/** Serializer for cases where no serializer is required but the system still expects one. This happens for + * OptionTypeInfo when None is used, or for Either when one of the type parameters is Nothing. */ @Internal class NothingSerializer extends TypeSerializer[Any] { diff --git a/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseClassSerializer.scala b/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseClassSerializer.scala index ae85882..e46f492 100644 --- a/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseClassSerializer.scala +++ b/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseClassSerializer.scala @@ -21,10 +21,9 @@ import org.apache.flink.api.common.typeutils.{TypeSerializer, TypeSerializerSnap import java.io.ObjectInputStream -/** This is a non macro-generated, concrete Scala case class serializer. - * Copied from Flink 1.14 with two changes: - * 1. Does not extend `SelfResolvingTypeSerializer`, since we're breaking compatibility anyway. - * 2. Move `lookupConstructor` to version-specific sources. +/** This is a non macro-generated, concrete Scala case class serializer. Copied from Flink 1.14 with two changes: + * 1. Does not extend `SelfResolvingTypeSerializer`, since we're breaking compatibility anyway. 2. Move + * `lookupConstructor` to version-specific sources. */ @SerialVersionUID(1L) class ScalaCaseClassSerializer[T <: Product]( diff --git a/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseObjectSerializer.scala b/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseObjectSerializer.scala index 2129249..844c2b6 100644 --- a/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseObjectSerializer.scala +++ b/src/main/scala/io/findify/flinkadt/api/serializer/ScalaCaseObjectSerializer.scala @@ -7,12 +7,12 @@ import org.apache.flink.core.memory.{DataInputView, DataOutputView} import org.apache.flink.util.InstantiationUtil class ScalaCaseObjectSerializer[T](clazz: Class[T]) extends TypeSerializerSingleton[T] { - override def isImmutableType: Boolean = true - override def copy(from: T): T = from - override def copy(from: T, reuse: T): T = from + override def isImmutableType: Boolean = true + override def copy(from: T): T = from + override def copy(from: T, reuse: T): T = from override def copy(source: DataInputView, target: DataOutputView): Unit = {} - override def createInstance(): T = clazz.getField("MODULE$").get(null).asInstanceOf[T] - override def getLength: Int = 0 + override def createInstance(): T = clazz.getField("MODULE$").get(null).asInstanceOf[T] + override def getLength: Int = 0 override def serialize(record: T, target: DataOutputView): Unit = {} override def deserialize(source: DataInputView): T = { diff --git a/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassComparator.scala b/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassComparator.scala index 23901d7..dbebb6b 100644 --- a/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassComparator.scala +++ b/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassComparator.scala @@ -24,8 +24,7 @@ import org.apache.flink.api.java.typeutils.runtime.TupleComparatorBase import org.apache.flink.core.memory.MemorySegment import org.apache.flink.types.{KeyFieldOutOfBoundsException, NullKeyFieldException} -/** Comparator for Case Classes. Access is different from - * our Java Tuples so we have to treat them differently. +/** Comparator for Case Classes. Access is different from our Java Tuples so we have to treat them differently. */ @Internal class CaseClassComparator[T <: Product]( diff --git a/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassTypeInfo.scala b/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassTypeInfo.scala index 826da75..9ac8292 100644 --- a/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassTypeInfo.scala +++ b/src/main/scala/io/findify/flinkadt/api/typeinfo/CaseClassTypeInfo.scala @@ -37,8 +37,8 @@ import scala.annotation.{nowarn, tailrec} import scala.collection.JavaConverters._ import scala.collection.mutable.ArrayBuffer -/** TypeInformation for Case Classes. Creation and access is different from - * our Java Tuples so we have to treat them differently. +/** TypeInformation for Case Classes. Creation and access is different from our Java Tuples so we have to treat them + * differently. */ @Public abstract class CaseClassTypeInfo[T <: Product]( @@ -279,9 +279,9 @@ abstract class CaseClassTypeInfo[T <: Product]( obj match { case caseClass: CaseClassTypeInfo[_] => caseClass.canEqual(this) && - super.equals(caseClass) && - typeParamTypeInfos.sameElements(caseClass.typeParamTypeInfos) && - fieldNames.equals(caseClass.fieldNames) + super.equals(caseClass) && + typeParamTypeInfos.sameElements(caseClass.typeParamTypeInfos) && + fieldNames.equals(caseClass.fieldNames) case _ => false } } diff --git a/src/main/scala/io/findify/flinkadt/api/typeinfo/CollectionTypeInformation.scala b/src/main/scala/io/findify/flinkadt/api/typeinfo/CollectionTypeInformation.scala index 3fc8f8d..05d7b33 100644 --- a/src/main/scala/io/findify/flinkadt/api/typeinfo/CollectionTypeInformation.scala +++ b/src/main/scala/io/findify/flinkadt/api/typeinfo/CollectionTypeInformation.scala @@ -7,7 +7,7 @@ import org.apache.flink.api.common.typeutils.TypeSerializer import scala.reflect.{ClassTag, classTag} case class CollectionTypeInformation[T: ClassTag](serializer: TypeSerializer[T]) extends TypeInformation[T] { - val clazz = classTag[T].runtimeClass.asInstanceOf[Class[T]] + val clazz = classTag[T].runtimeClass.asInstanceOf[Class[T]] override def createSerializer(config: ExecutionConfig): TypeSerializer[T] = serializer override def isBasicType: Boolean = false override def isTupleType: Boolean = false diff --git a/src/main/scala/io/findify/flinkadt/api/typeinfo/EitherTypeInfo.scala b/src/main/scala/io/findify/flinkadt/api/typeinfo/EitherTypeInfo.scala index 1803b79..23cfb08 100644 --- a/src/main/scala/io/findify/flinkadt/api/typeinfo/EitherTypeInfo.scala +++ b/src/main/scala/io/findify/flinkadt/api/typeinfo/EitherTypeInfo.scala @@ -73,9 +73,9 @@ class EitherTypeInfo[A, B, T <: Either[A, B]]( obj match { case eitherTypeInfo: EitherTypeInfo[_, _, _] => eitherTypeInfo.canEqual(this) && - clazz.equals(eitherTypeInfo.clazz) && - leftTypeInfo.equals(eitherTypeInfo.leftTypeInfo) && - rightTypeInfo.equals(eitherTypeInfo.rightTypeInfo) + clazz.equals(eitherTypeInfo.clazz) && + leftTypeInfo.equals(eitherTypeInfo.leftTypeInfo) && + rightTypeInfo.equals(eitherTypeInfo.rightTypeInfo) case _ => false } } diff --git a/src/main/scala/io/findify/flinkadt/api/typeinfo/SimpleTypeInformation.scala b/src/main/scala/io/findify/flinkadt/api/typeinfo/SimpleTypeInformation.scala index cf76da5..3e83e9c 100644 --- a/src/main/scala/io/findify/flinkadt/api/typeinfo/SimpleTypeInformation.scala +++ b/src/main/scala/io/findify/flinkadt/api/typeinfo/SimpleTypeInformation.scala @@ -12,6 +12,6 @@ abstract class SimpleTypeInformation[T: ClassTag: TypeSerializer] extends TypeIn override def isTupleType: Boolean = false override def isKeyType: Boolean = false override def getTotalFields: Int = 1 - override def getTypeClass: Class[T] = classTag[T].runtimeClass.asInstanceOf[Class[T]] - override def getArity: Int = 1 + override def getTypeClass: Class[T] = classTag[T].runtimeClass.asInstanceOf[Class[T]] + override def getArity: Int = 1 } diff --git a/src/test/scala/io/findify/flinkadt/SerializerTest.scala b/src/test/scala/io/findify/flinkadt/SerializerTest.scala index a670934..4197aaa 100644 --- a/src/test/scala/io/findify/flinkadt/SerializerTest.scala +++ b/src/test/scala/io/findify/flinkadt/SerializerTest.scala @@ -99,7 +99,7 @@ class SerializerTest extends AnyFlatSpec with Matchers with Inspectors with Test it should "derive recursively" in { // recursive is broken - //val ti = implicitly[TypeInformation[Node]] + // val ti = implicitly[TypeInformation[Node]] } it should "derive list" in { diff --git a/src/test/scala/io/findify/flinkadt/TestUtils.scala b/src/test/scala/io/findify/flinkadt/TestUtils.scala index ffcbe62..f263d0a 100644 --- a/src/test/scala/io/findify/flinkadt/TestUtils.scala +++ b/src/test/scala/io/findify/flinkadt/TestUtils.scala @@ -23,7 +23,7 @@ trait TestUtils extends Matchers with Inspectors { ser.getClass.getClassLoader ) val restoredSerializer = restoredSnapshot.restoreSerializer() - val copy = restoredSerializer.deserialize(new DataInputViewStreamWrapper(new ByteArrayInputStream(out.toByteArray))) + val copy = restoredSerializer.deserialize(new DataInputViewStreamWrapper(new ByteArrayInputStream(out.toByteArray))) in shouldBe copy } From 1133779461d4f412f71474b886cced60440aa86c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 29 Jul 2024 14:47:06 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.8.3' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..020c32c --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Scala Steward: Reformat with scalafmt 3.8.3 +867d1cf479642e3bfccf04d54ff54a226e07626c