-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-26376][SQL] Skip inputs without tokens by JSON datasource #23325
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -66,7 +66,11 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { | |||||||||||||||
|
||||||||||||||||
val dummyOption = new JSONOptions(Map.empty[String, String], "GMT") | ||||||||||||||||
val dummySchema = StructType(Seq.empty) | ||||||||||||||||
val parser = new JacksonParser(dummySchema, dummyOption, allowArrayAsStructs = true) | ||||||||||||||||
val parser = new JacksonParser( | ||||||||||||||||
dummySchema, | ||||||||||||||||
dummyOption, | ||||||||||||||||
allowArrayAsStructs = true, | ||||||||||||||||
skipInputWithoutTokens = true) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we have a test coverage for both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it's handled by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both cases are covered already, for example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for clarifying that, @MaxGekk and @cloud-fan . |
||||||||||||||||
|
||||||||||||||||
Utils.tryWithResource(factory.createParser(writer.toString)) { jsonParser => | ||||||||||||||||
jsonParser.nextToken() | ||||||||||||||||
|
@@ -1114,7 +1118,6 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { | |||||||||||||||
Row(null, null, null), | ||||||||||||||||
Row(null, null, null), | ||||||||||||||||
Row(null, null, null), | ||||||||||||||||
Row(null, null, null), | ||||||||||||||||
Row("str_a_4", "str_b_4", "str_c_4"), | ||||||||||||||||
Row(null, null, null)) | ||||||||||||||||
) | ||||||||||||||||
|
@@ -1136,7 +1139,6 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { | |||||||||||||||
checkAnswer( | ||||||||||||||||
jsonDF.select($"a", $"b", $"c", $"_unparsed"), | ||||||||||||||||
Row(null, null, null, "{") :: | ||||||||||||||||
Row(null, null, null, "") :: | ||||||||||||||||
Row(null, null, null, """{"a":1, b:2}""") :: | ||||||||||||||||
Row(null, null, null, """{"a":{, b:3}""") :: | ||||||||||||||||
Row("str_a_4", "str_b_4", "str_c_4", null) :: | ||||||||||||||||
|
@@ -1151,7 +1153,6 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { | |||||||||||||||
checkAnswer( | ||||||||||||||||
jsonDF.filter($"_unparsed".isNotNull).select($"_unparsed"), | ||||||||||||||||
Row("{") :: | ||||||||||||||||
Row("") :: | ||||||||||||||||
Row("""{"a":1, b:2}""") :: | ||||||||||||||||
Row("""{"a":{, b:3}""") :: | ||||||||||||||||
Row("]") :: Nil | ||||||||||||||||
|
@@ -1173,7 +1174,6 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { | |||||||||||||||
checkAnswer( | ||||||||||||||||
jsonDF.selectExpr("a", "b", "c", "_malformed"), | ||||||||||||||||
Row(null, null, null, "{") :: | ||||||||||||||||
Row(null, null, null, "") :: | ||||||||||||||||
Row(null, null, null, """{"a":1, b:2}""") :: | ||||||||||||||||
Row(null, null, null, """{"a":{, b:3}""") :: | ||||||||||||||||
Row("str_a_4", "str_b_4", "str_c_4", null) :: | ||||||||||||||||
|
@@ -2517,7 +2517,7 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { | |||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
checkCount(2) | ||||||||||||||||
countForMalformedJSON(1, Seq("")) | ||||||||||||||||
countForMalformedJSON(0, Seq("")) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
test("SPARK-25040: empty strings should be disallowed") { | ||||||||||||||||
|
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.
Skipping
seems to be unclear here. Could you elaborate the difference?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.
Do you want to compare JSON datasource and json functions in this note?