Skip to content
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

Use error message type from spark commons: 2170 #2177

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

TebaleloS
Copy link
Collaborator

Changes

  • Upgraded the spark-common version from 0.4.0 to 0.5.0
  • Removed ErrorMessage case class
  • Removed Mapping case class
  • Removed errorColumnName property
  • Renamed Enceladus ErrorMessage file and the Object to EnceladusErrorMessage
  • Replaced Enceladus ErrorMerssage with spark-common ErrorMessages
  • Closes Use ErrorMessage type from spark-commons #2170

@TebaleloS TebaleloS marked this pull request as ready for review February 24, 2023 16:07
Copy link
Collaborator

@benedeki benedeki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems class ErrorMessageFactory can be safely deleted too.

Does not build 😞 Several files still refer to old classes.

import za.co.absa.enceladus.utils.modules._
import za.co.absa.spark.commons.implicits.StructTypeImplicits.StructTypeEnhancements
import za.co.absa.abris.avro.functions.to_avro
import za.co.absa.abris.config.{AbrisConfig, ToAvroConfig}
import za.co.absa.enceladus.plugins.builtin.errorsender.mq.kafka.KafkaErrorSenderPlugin.{avroKeySchemaRegistryConfig, avroValueSchemaRegistryConfig, registerSchemas}
import za.co.absa.enceladus.utils.error.EnceladusErrorMessage.ErrorCodes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:
Some unused imports.

@@ -28,19 +28,18 @@ import za.co.absa.enceladus.conformance.config.ConformanceConfigParser
import za.co.absa.enceladus.conformance.datasource.PartitioningUtils
import za.co.absa.enceladus.conformance.interpreter.rules._
import za.co.absa.enceladus.conformance.interpreter.rules.custom.CustomConformanceRule
import za.co.absa.enceladus.conformance.interpreter.rules.mapping.{MappingRuleInterpreter, MappingRuleInterpreterBroadcast,
MappingRuleInterpreterGroupExplode}
import za.co.absa.enceladus.conformance.interpreter.rules.mapping.{MappingRuleInterpreter, MappingRuleInterpreterBroadcast, MappingRuleInterpreterGroupExplode}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really minor:
Line is over 140 character long.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about what I should do here, or should I just import everything from maping e.g. za.co.absa.enceladus.conformance.interpreter.rules.mapping._?

Copy link
Collaborator

@lsulak lsulak Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that multi-line imports should work:

import za.co.absa.enceladus.conformance.interpreter.rules.mapping.{
  MappingRuleInterpreter, MappingRuleInterpreterBroadcast, MappingRuleInterpreterGroupExplode
}

that can be one way how to resolve this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it does work, but gives a warning. But I have refactored it now.

@@ -25,6 +25,7 @@ import za.co.absa.enceladus.model.conformanceRule.{ConformanceRule, MappingConfo
import za.co.absa.enceladus.model.{Dataset => ConfDataset}
import za.co.absa.enceladus.utils.error._
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.

Copy link
Collaborator

@lsulak lsulak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes looks good to me, but the code still won't compile because there are some places where it fails on wrong imports, as David said before.

Once it's fixed, I can quickly test it.

import za.co.absa.enceladus.utils.modules._
import za.co.absa.spark.commons.implicits.StructTypeImplicits.StructTypeEnhancements
import za.co.absa.abris.avro.functions.to_avro
import za.co.absa.abris.config.{AbrisConfig, ToAvroConfig}
import za.co.absa.abris.config.{ToAvroConfig}
import za.co.absa.enceladus.plugins.builtin.errorsender.mq.kafka.KafkaErrorSenderPlugin.{avroKeySchemaRegistryConfig, avroValueSchemaRegistryConfig, registerSchemas}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line has 166 chars

@@ -47,6 +47,7 @@ class StandardizationRerunSuite extends FixtureAnyFunSuite with TZNormalizedSpar
private val tmpFilePrefix = "test-input-"
private val tmpFileSuffix = ".csv"


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary empty line

@@ -29,13 +30,13 @@ import za.co.absa.standardization.config.DefaultErrorCodesConfig
* @param rawValues - Sequence of raw values (which are the potential culprits of the error)
* @param mappings - Sequence of Mappings i.e Mapping Table Column -> Equivalent Mapped Dataset column
*/
case class ErrorMessage(errType: String, errCode: String, errMsg: String, errCol: String, rawValues: Seq[String], mappings: Seq[Mapping] = Seq())
case class Mapping(mappingTableColumn: String, mappedDatasetColumn: String)
//case class ErrorMessage(errType: String, errCode: String, errMsg: String, errCol: String, rawValues: Seq[String], mappings: Seq[Mapping] = Seq())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code here and below

@@ -18,8 +18,9 @@ package za.co.absa.enceladus.utils.broadcast
import org.apache.spark.sql.functions._
import org.apache.spark.sql.{DataFrame, Row}
import org.scalatest.wordspec.AnyWordSpec
import za.co.absa.enceladus.utils.error.Mapping
import za.co.absa.enceladus.utils.error.EnceladusErrorMessage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have that file in my local branch.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how's that possible, did you remove it? What git status tells you?

Copy link
Collaborator

@lsulak lsulak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I found some minor issues, most of them just formatting.

  • code reviewed
  • pulled
  • built
  • ran tests

…iltin/errorsender/mq/KafkaErrorSenderPluginImpl.scala

Co-authored-by: Ladislav Sulak <[email protected]>
@sonarcloud
Copy link

sonarcloud bot commented Mar 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@benedeki benedeki added under discussion Requires consideration before a decision is made whether/how to implement work in progress Work on this item is not yet finished (mainly intended for PRs) labels Mar 27, 2023
@benedeki
Copy link
Collaborator

I am sorry, I am afraid this PR become obsolete with ErrorHandling introduction. I suggest closing it, so as the ticket without merging. And deleting the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under discussion Requires consideration before a decision is made whether/how to implement work in progress Work on this item is not yet finished (mainly intended for PRs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use ErrorMessage type from spark-commons
3 participants