You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/09/17 13:41:00 UTC
[jira] [Updated] (SPARK-59617) Reuse a per-evaluator output buffer in JsonExpressionEvalUtils (json_tuple, JSON_TABLE)
[ https://issues.apache.org/jira/browse/SPARK-59617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated SPARK-59617:
-----------------------------------
Labels: pull-request-available (was: )
> Reuse a per-evaluator output buffer in JsonExpressionEvalUtils (json_tuple, JSON_TABLE)
> ---------------------------------------------------------------------------------------
>
> Key: SPARK-59617
> URL: https://issues.apache.org/jira/browse/SPARK-59617
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 4.1.0
> Reporter: David Mollitor
> Priority: Minor
> Labels: pull-request-available
>
> h3. Problem
> {{JsonExpressionEvalUtils}} has several JSON-extraction evaluators. Two already reuse a single instance buffer across rows: {{GetJsonObjectEvaluator}} and {{MultiGetJsonObjectEvaluator}} each hold
> {{@transient private lazy val outputBuffer = new ByteArrayOutputStream()}} and call
> {{outputBuffer.reset()}} before each use. The other two allocate a fresh {{ByteArrayOutputStream}} on every field/element:
> * {{JsonTupleEvaluator.parseRow}} -- a new buffer per extracted field (unbounded per row for a wide {{json_tuple(...)}}).
> * {{JsonTableEvaluator.serializeCurrentValue}} -- a new buffer per call; the hot caller expands a JSON array one element at a time.
> A no-arg {{ByteArrayOutputStream}} starts at the JDK default of 32 bytes and grows by doubling, so allocating (and then GC-ing) a fresh one per field/element is steady allocation churn on the json_tuple / JSON_TABLE evaluation path.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org