Skip to content

Commit ebca215

Browse files
wangyumcloud-fan
authored andcommitted
[SPARK-49872][CORE] Remove jackson JSON string length limitation : https://github.corp.ebay.com/carmel/ebay-spark/pull/863 (apache#22)
This is a surgical fix extracted from apache#49163 The default jackson string limit introduced in jackson 2.15 can be too small for certain workloads, and this PR removes this limitation to avoid any regression. fix regression Yes, users won't hit this size limitation anymore. apache#49163 tested it. We won't add a test in this PR as generating a super large JSON will make the CI unstable. no Closes apache#52049 from cloud-fan/json. Lead-authored-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 076618a) Signed-off-by: Wenchen Fan <wenchen@databricks.com> Co-authored-by: Wenchen Fan <wenchen@databricks.com> Co-authored-by: Wenchen Fan <cloud0fan@gmail.com>
1 parent 7ee005d commit ebca215

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/main/scala/org/apache/spark/util/JsonProtocol.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import java.util.{Properties, UUID}
2222
import scala.collection.JavaConverters._
2323
import scala.collection.Map
2424

25-
import com.fasterxml.jackson.core.JsonGenerator
25+
import com.fasterxml.jackson.core.{JsonGenerator, StreamReadConstraints}
2626
import com.fasterxml.jackson.databind.JsonNode
2727
import org.json4s.jackson.JsonMethods.compact
2828

@@ -54,6 +54,11 @@ import org.apache.spark.util.Utils.weakIntern
5454
private[spark] object JsonProtocol extends JsonUtils {
5555
// TODO: Remove this file and put JSON serialization into each individual class.
5656

57+
// SPARK-49872: Remove jackson JSON string length limitation.
58+
mapper.getFactory.setStreamReadConstraints(
59+
StreamReadConstraints.builder().maxStringLength(Int.MaxValue).build()
60+
)
61+
5762
/** ------------------------------------------------- *
5863
* JSON serialization methods for SparkListenerEvents |
5964
* -------------------------------------------------- */

0 commit comments

Comments
 (0)