Skip to content

Commit

Permalink
Use full type name when checking max schema key
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Jan 21, 2025
1 parent fffcbe4 commit 030eabd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ object DataDiscovery {
nonAtomicTypes
.traverse { shreddedType =>
EitherT(Iglu[F].getSchemasWithSameModel(shreddedType.info.getSchemaKey)).map { schemas =>
val maxSchemaKey = maxSchemaKeyPerTableName(shreddedType.info.getName)
val maxSchemaKey = maxSchemaKeyPerTableName(shreddedType.info.getNameFull)
val filtered = schemas.filter(_.self.schemaKey <= shreddedType.info.getSchemaKey).toNel.get
val maxFiltered = schemas.filter(_.self.schemaKey <= maxSchemaKey).toNel.get
val foldMapRedshiftSchemasResult: ShredModel = foldMapRedshiftSchemas(filtered)(shreddedType.info.getSchemaKey)
Expand All @@ -210,7 +210,7 @@ object DataDiscovery {

/** Find the maximum SchemaKey for all table names in a given set of shredded types */
def getMaxSchemaKeyPerTableName(shreddedTypes: List[ShreddedType]): Map[String, SchemaKey] =
shreddedTypes.groupBy(_.info.getName).mapValues(_.maxBy(_.info.version).info.getSchemaKey)
shreddedTypes.groupBy(_.info.getNameFull).mapValues(_.maxBy(_.info.version).info.getSchemaKey)

def logAndRaise[F[_]: MonadThrow: Logging](error: LoaderError): F[Option[WithOrigin]] =
Logging[F].error(error)("A problem occurred in the loading of SQS message") *> MonadThrow[F].raiseError(error)
Expand Down

0 comments on commit 030eabd

Please sign in to comment.