-
Notifications
You must be signed in to change notification settings - Fork 1
#305 Get-Ancestors-Server Functionality #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
bbba4ae
Added the getAncestors Database functionality.
ABLL526 becd6f2
Added the getAncestors Server functionality.
ABLL526 e479ea3
Added the getAncestors Database functionality.
ABLL526 8694a4f
Added the getAncestors Database functionality.
ABLL526 d968718
Added the getAncestors Database functionality.
ABLL526 a4a4fb1
Added the getAncestors Server functionality.
ABLL526 ebe5d5c
Added the getAncestors Server functionality.
ABLL526 a3c7dcf
Merge remote-tracking branch 'origin/305-Get-Ancestors-Server' into 3…
ABLL526 a5c556c
Added the getAncestors Database functionality.
ABLL526 8961762
Changes made:
ABLL526 f83460a
Changes made:
ABLL526 c99a34a
Merge branch 'master' into 305-Get-Ancestors-Database
ABLL526 9c3256f
Merge branch 'master' into 305-Get-Ancestors-Database
ABLL526 20aa4ad
Changes Made:
ABLL526 4dcaa86
Changes Made:
ABLL526 07392f5
Merge branch '305-Get-Ancestors-Database' into 305-Get-Ancestors-Server
ABLL526 036e870
Changes Made:
ABLL526 66d08cd
Delete database/src/main/postgres/runs/V0.3.0.2__alter_checkpoints.ddl
ABLL526 c68223f
Delete database/src/main/postgres/runs/V0.3.0.3__get_partitioning_anc…
ABLL526 84fb314
Delete database/src/test/scala/za/co/absa/atum/database/runs/GetParti…
ABLL526 e8bd369
Added the getPartitioningAncestors Server functionality.
ABLL526 e88b8d8
Fixes in the getPartitioningAncestors Server functionality.
ABLL526 982b615
Merge branch 'master' into 305-Get-Ancestors-Server
ABLL526 39e2b77
Fixes in the getPartitioningAncestors Server functionality.
ABLL526 1b2b37a
Merge branch 'master' into 305-Get-Ancestors-Server
ABLL526 83ec8b5
Fixes in the getPartitioningAncestors Server functionality.
ABLL526 b80ff9a
- Amended the JacocoSetup.scala to exclude the file:
ABLL526 aeab677
- Amended the JacocoSetup.scala to exclude the file:
ABLL526 ac89fa7
- Amended the JacocoSetup.scala to exclude the file:
ABLL526 b9092e3
- Amended the JacocoSetup.scala to exclude the file:
ABLL526 fb7634a
- Amended the JacocoSetup.scala to exclude the file:
ABLL526 93f049c
- Amended the JacocoSetup.scala to exclude the file:
ABLL526 54615fc
Merge branch 'master' into 305-Get-Ancestors-Server
ABLL526 1dc9121
- Amended the code to be correct with the refactor.
ABLL526 e51582c
Delete scripts/ATUM-Services_DEV_env.postman_environment.json
ABLL526 2019d5d
- Amended the JacocoSetup.scala to ensure Correct Report generation.
ABLL526 026fd34
Merge remote-tracking branch 'origin/305-Get-Ancestors-Server' into 3…
ABLL526 1317a4b
Revert "Delete scripts/ATUM-Services_DEV_env.postman_environment.json"
ABLL526 96ffbfe
Delete scripts/ATUM-Services_DEV_env.postman_environment.json
ABLL526 f5694cc
Merge branch 'master' into 305-Get-Ancestors-Server
ABLL526 9e4e339
Update JacocoSetup.scala
ABLL526 3215280
Merge branch 'master' into 305-Get-Ancestors-Server
benedeki 05ab12f
Merge branch 'master' into 305-Get-Ancestors-Server
lsulak 72c1e0b
- Amended the `JacocoSetup.scala` excludes to include the following:
ABLL526 e03f21f
Merge remote-tracking branch 'origin/305-Get-Ancestors-Server' into 3…
ABLL526 f465628
- Amended the `JacocoSetup.scala` excludes to include the following:
ABLL526 9caf3b1
Merge branch 'master' into 305-Get-Ancestors-Server
ABLL526 28e8571
- Edits to the server portion since merging with master.
ABLL526 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...n/scala/za/co/absa/atum/server/api/database/runs/functions/GetPartitioningAncestors.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright 2021 ABSA Group Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package za.co.absa.atum.server.api.database.runs.functions | ||
|
|
||
| import doobie.implicits.toSqlInterpolator | ||
| import io.circe.Json | ||
| import za.co.absa.atum.server.api.database.PostgresDatabaseProvider | ||
| import za.co.absa.atum.server.api.database.runs.Runs | ||
| import za.co.absa.atum.server.api.database.runs.functions.GetPartitioningAncestors._ | ||
| import za.co.absa.atum.server.model.PartitioningResult | ||
| import za.co.absa.db.fadb.DBSchema | ||
| import za.co.absa.db.fadb.doobie.DoobieEngine | ||
| import za.co.absa.db.fadb.doobie.DoobieFunction.DoobieMultipleResultFunctionWithAggStatus | ||
| import za.co.absa.db.fadb.status.aggregation.implementations.ByFirstErrorStatusAggregator | ||
| import za.co.absa.db.fadb.status.handling.implementations.StandardStatusHandling | ||
| import zio.{Task, URLayer, ZIO, ZLayer} | ||
| import za.co.absa.db.fadb.doobie.postgres.circe.implicits.jsonbGet | ||
|
|
||
| class GetPartitioningAncestors(implicit schema: DBSchema, dbEngine: DoobieEngine[Task]) | ||
| extends DoobieMultipleResultFunctionWithAggStatus[GetPartitioningAncestorsArgs, Option[ | ||
| GetPartitioningAncestorsResult | ||
| ], Task](args => | ||
| Seq( | ||
| fr"${args.partitioningId}", | ||
| fr"${args.limit}", | ||
| fr"${args.offset}" | ||
| ) | ||
| ) | ||
| with StandardStatusHandling | ||
| with ByFirstErrorStatusAggregator { | ||
|
|
||
| override def fieldsToSelect: Seq[String] = super.fieldsToSelect ++ Seq("ancestor_id", "partitioning", "author", "has_more") | ||
| } | ||
|
|
||
| object GetPartitioningAncestors { | ||
| case class GetPartitioningAncestorsArgs(partitioningId: Long, limit: Option[Int], offset: Option[Long]) | ||
| case class GetPartitioningAncestorsResult(id: Long, partitioningJson: Json, author: String, hasMore: Boolean) | ||
| extends PartitioningResult(id, partitioningJson, author) | ||
|
|
||
| val layer: URLayer[PostgresDatabaseProvider, GetPartitioningAncestors] = ZLayer { | ||
| for { | ||
| dbProvider <- ZIO.service[PostgresDatabaseProvider] | ||
| } yield new GetPartitioningAncestors()(Runs, dbProvider.dbEngine) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
server/src/main/scala/za/co/absa/atum/server/implicits/SeqImplicits.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2021 ABSA Group Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package za.co.absa.atum.server.implicits | ||
|
|
||
| import io.circe.DecodingFailure | ||
|
|
||
| object SeqImplicits { | ||
| implicit class SeqEnhancements[T](val seq: Seq[T]) extends AnyVal { | ||
|
|
||
| def seqDecode[R](decodingFnc: T => Either[DecodingFailure, R]): Either[DecodingFailure, Seq[R]] = { | ||
| seq.foldLeft(Right(List.empty[R]): Either[DecodingFailure, List[R]]) { (acc, item) => | ||
| for { | ||
| decodedList <- acc | ||
| decodedItem <- decodingFnc(item) | ||
| } yield decodedItem :: decodedList | ||
| }.map(_.reverse) | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree abstracting the seq processing is useful, the main bit (conversion from database results into desired type) wasn't addressed at all and is still duplicated in GetPartitioningAncestors and GetFlowPartitioninigs. Please give this another go and try to address the duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw it's not really doing simple decoding - try to use more descriptive names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @salamonpavel I think I managed to do this. Please check. I have also tried to rename the functions, please let me know if you are happy with those or should it be named differently.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose the following
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @salamonpavel this helps greatly. I have made the changes as suggested. It looks much cleaner now.
Please check and confirm. If you are happy please approve.