ahmedabu98 commented on code in PR #36073:
URL: https://github.com/apache/beam/pull/36073#discussion_r2337334647
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java:
##########
@@ -34,43 +35,41 @@
@Internal
public class RowJsonUtils {
- //
- private static int defaultBufferLimit;
+ // The maximum string length for the JSON parser, set to 100 MB.
+ public static final int MAX_STRING_LENGTH = 100 * 1024 * 1024;
/**
- * Increase the default jackson-databind stream read constraint.
+ * Creates a thread-safe JsonFactory with custom stream read constraints.
*
- * <p>StreamReadConstraints was introduced in jackson 2.15 causing string >
20MB (5MB in 2.15.0)
- * parsing failure. This has caused regressions in its dependencies include
Beam. Here we
- * overwrite the default buffer size limit to 100 MB, and exposes this
interface for higher limit.
- * If needed, call this method during pipeline run time, e.g. in DoFn.setup.
+ * <p>This method encapsulates the logic to increase the default
jackson-databind stream read
+ * constraint to 100MB. This functionality was introduced in Jackson 2.15
causing string > 20MB
+ * (5MB in <2.15.0) parsing failure. This has caused regressions in its
dependencies including
+ * Beam. Here we create a streamReadConstraints minimum size limit set to
100MB and exposing the
+ * factory to higher limits. If needed, call this method during pipeline run
time, e.g. in
+ * DoFn.setup. This avoids a data race caused by modifying the global
default settings.
*/
- public static void increaseDefaultStreamReadConstraints(int newLimit) {
Review Comment:
Sure sounds good
--
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]