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

#39 Updating spark-sql version and testing references #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ organization := "org.zalando"

scalaVersion := "2.11.8"

libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.0.1" % Provided
libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.3" % Provided
Copy link
Contributor

Choose a reason for hiding this comment

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

this is outdated in the new master. That's my fault for replying so late, sorry again.

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.5.10"
dependencyOverrides ++= Set("com.fasterxml.jackson.core" % "jackson-databind" % "2.6.5")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,57 @@ class SchemaConverterTest extends FunSuite with Matchers with BeforeAndAfter {
}
}

test("Reference of multiple types should fail with strict typing") {
assertThrows[IllegalArgumentException] {
val schema = SchemaConverter.enableStrictTyping().convertContent(
"""
{
"definitions": {
"address": {
"type": ["object", "array"],
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" }
}
}
},
"type": "object",
"properties": {
"billing_address": { "$ref": "#/definitions/address" }
}
}
"""
)
}
}

test("Reference of multiple types should default to typing when disable strict typing") {
val schema = SchemaConverter.disableStrictTyping().convertContent(
"""
{
"definitions": {
"address": {
"type": ["object", "array"],
"properties": {
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" }
}
}
},
"type": "object",
"properties": {
"billing_address": { "$ref": "#/definitions/address" }
}
}
"""
)

val expected = StructType(
Seq(StructField("billing_address", StringType, nullable = false))
)

assert(schema === expected)
}
}