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

Update sbt-pgp to 2.3.0 #56

Closed
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add CLI option to use `treeReduce` on Spark

## [0.40.0] - 2024-08-22
### Added
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.1")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.0")
addSbtPlugin("com.github.sbt" % "sbt-site" % "1.7.0")
addSbtPlugin("io.kevinlee" % "sbt-github-pages" % "0.14.0")
addSbtPlugin("nl.gn0s1s" % "sbt-dotenv" % "3.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ private final case class Config(
propertySet: PropertySet = PropertySets.AllProperties,
addDefinitions: Boolean = false,
detectDynamic: Boolean = false,
detectDisjoint: Boolean = false
detectDisjoint: Boolean = false,
treeReduce: Boolean = false,
)

object JsonoidSpark {
Expand Down Expand Up @@ -60,6 +61,10 @@ object JsonoidSpark {
opt[Unit]('j', "detect-disjoint")
.action((x, c) => c.copy(detectDisjoint = true))
.text("detect objects with disjoint keys")

opt[Unit]('t', "tree-reduce")
.action((x, c) => c.copy(treeReduce = true))
.text("use treeReduce for schema reduction")
}

parser.parse(args, Config()) match {
Expand All @@ -71,8 +76,11 @@ object JsonoidSpark {
val jsonRdd = JsonoidRDD.fromStringRDD(
sc.textFile(config.input)
)(p)
var schema: ObjectSchema =
var schema: ObjectSchema = if (config.treeReduce) {
jsonRdd.treeReduceSchemas().asInstanceOf[ObjectSchema]
} else {
jsonRdd.reduceSchemas().asInstanceOf[ObjectSchema]
}

// Skip transformation if we know the required properties don't exist
if (!(config.propertySet === PropertySets.MinProperties)) {
Expand Down
Loading