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

Add support for Avro records #5

Merged
merged 5 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @danielsmith-eu
1 change: 1 addition & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
name: Scala CI - Run Tests

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
Expand Down
19 changes: 6 additions & 13 deletions data-quality-profiler/build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ThisBuild / organization := "uk.gov.ipt.das"
ThisBuild / version := "1.0.0"
ThisBuild / organization := "io.github.6point6"
ThisBuild / version := "1.1.0"

name := "das-data-profiler"
name := "data-quality-profiler-and-rules-engine"

scalaVersion := "2.12.15"

Expand Down Expand Up @@ -63,6 +63,9 @@ libraryDependencies += "com.itextpdf" % "html2pdf" % "4.0.3"
// https://mvnrepository.com/artifact/com.github.spullara.mustache.java/compiler
libraryDependencies += "com.github.spullara.mustache.java" % "compiler" % "0.9.10"

//avro support
libraryDependencies += "org.apache.avro" % "avro" % "1.11.1"


Test / parallelExecution := true

Expand All @@ -81,16 +84,6 @@ addArtifact(artifact in (Compile, assembly), assembly)
/***/


publishTo := Some(s"GitHub Apache Maven Packages" at s"https://maven.pkg.github.com/${System.getenv("GITHUB_REPOSITORY")}")
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
System.getenv("GITHUB_REPOSITORY_OWNER"),
System.getenv("GITHUB_TOKEN")
)
publishMavenStyle := true
isSnapshot := true

// these are all to allow local publishing to overwrite the version
publishConfiguration := publishConfiguration.value.withOverwrite(true)
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true)
Expand Down
35 changes: 35 additions & 0 deletions data-quality-profiler/publish.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ThisBuild / organization := "io.github.6point6"
ThisBuild / organizationName := "6point6"
ThisBuild / organizationHomepage := Some(url("https://6point6.co.uk/"))

ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/6point6/data-quality-profiler-and-rules-engine"),
"scm:[email protected]:6point6/data-quality-profiler-and-rules-engine.git"
)
)
ThisBuild / developers := List(
Developer(
id = "danielsmith-eu",
name = "Dr. Daniel Alexander Smith",
email = "[email protected]",
url = url("http://danielsmith.eu")
)
)

ThisBuild / description := "Data Quality Profiler and Rules Engine."
ThisBuild / licenses := List(
"MIT" -> new URL("https://opensource.org/license/mit/")
)
ThisBuild / homepage := Some(url("https://github.com/6point6/data-quality-profiler-and-rules-engine"))

// Remove all additional repository other than Maven Central from POM
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishTo := {
// For accounts created after Feb 2021:
val nexus = "https://s01.oss.sonatype.org/"
//val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / publishMavenStyle := true
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ object RecordValue {
case v: java.util.LinkedHashMap[String, Any] => ProfilableRecord.fromLinkedHashMap(linkedHashMap = v)
case v: java.math.BigDecimal => DoubleValue(v.doubleValue()) // TODO do better, write tests against this
case v: java.util.ArrayList[_] => ArrayValue(v.asScala.map{ RecordValue.fromAny })
case v: org.apache.avro.util.Utf8 => StringValue(v.toString)
case foo =>
throw new Exception(s"Unknown primtive type of in RecordValue.fromPrimitive: $foo, class: ${foo.getClass}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class ValuesTests extends AnyFunSpec {

}

it("should return a string for a avro record value") {
val testValue = RecordValue.fromAny( new org.apache.avro.util.Utf8("foo"))
assertResult(testValue.asString)("foo")
}

}

}