Skip to content

[spark] Use jackson shaded by Paimon instead of Spark's built-in one#8479

Merged
JingsongLi merged 1 commit into
apache:masterfrom
kerwin-zk:fix-spark-shaded-jackson
Jul 6, 2026
Merged

[spark] Use jackson shaded by Paimon instead of Spark's built-in one#8479
JingsongLi merged 1 commit into
apache:masterfrom
kerwin-zk:fix-spark-shaded-jackson

Conversation

@kerwin-zk

Copy link
Copy Markdown
Contributor

Purpose

Fix the todo left in paimon-spark/pom.xml by #6082:

<!-- todo(fix me): we should use the jackson libraries shaded by Paimon. -->

JsonUtils in paimon-spark-common was the only Scala code still using the unshaded jackson resolved from Spark's runtime (the spotless import-replacement rule that rewrites jackson imports to the shaded ones only applies to Java sources). So the jackson version it ran on was decided entirely by the Spark version (2.15.x for Spark 3.5, 2.18.x for Spark 4.x), which may differ from the version Paimon expects.

This PR:

  • Rewrites PaimonSourceOffset json serde (the only user of JsonUtils) with JsonSerdeUtil.OBJECT_MAPPER_INSTANCE, i.e. the jackson shaded by Paimon. ScalaObjectMapper/DefaultScalaModule cannot be kept because paimon-shade-jackson-2 does not bundle jackson-module-scala; since the offset only has 3 primitive fields, the serde is written manually. The JSON field names and layout stay exactly the same, so streaming checkpoints remain compatible in both directions.
  • Removes JsonUtils.
  • Replaces the todo comment: the com.fasterxml.jackson.core:* exclusion on paimon-format itself is correct (paimon-format already shades jackson into its jar) and is kept.

Tests

Covered by existing PaimonSourceTest, which asserts offset json round-trips through query.lastProgress.sources(0).endOffset.

@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi JingsongLi merged commit a39e3e8 into apache:master Jul 6, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants