eric-maynard commented on code in PR #46408:
URL: https://github.com/apache/spark/pull/46408#discussion_r1594623260
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala:
##########
@@ -280,13 +280,32 @@ class JacksonParser(
case VALUE_STRING =>
UTF8String.fromString(parser.getText)
- case _ =>
+ case other =>
// Note that it always tries to convert the data as string without
the case of failure.
- val writer = new ByteArrayOutputStream()
- Utils.tryWithResource(factory.createGenerator(writer,
JsonEncoding.UTF8)) {
- generator => generator.copyCurrentStructure(parser)
+ val startLocation = parser.getTokenLocation
+ startLocation.contentReference().getRawContent match {
Review Comment:
I was not able to find such an existing API -- there is
`JacksonParser.getText` but that appears to simply get the current value if
it's a string value.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala:
##########
@@ -280,13 +280,32 @@ class JacksonParser(
case VALUE_STRING =>
UTF8String.fromString(parser.getText)
- case _ =>
+ case other =>
// Note that it always tries to convert the data as string without
the case of failure.
- val writer = new ByteArrayOutputStream()
- Utils.tryWithResource(factory.createGenerator(writer,
JsonEncoding.UTF8)) {
- generator => generator.copyCurrentStructure(parser)
+ val startLocation = parser.getTokenLocation
+ startLocation.contentReference().getRawContent match {
Review Comment:
wrt. multiline JSON, I have added a test to cover this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]