Skip to content

Blocking: build hash schema without spark-mllib SchemaUtils - #1418

Merged
Sonal (sonalgoyal) merged 2 commits into
mainfrom
blocking-tree-no-mllib
Oct 19, 2026
Merged

Sonal (sonalgoyal) merged 2 commits into
mainfrom
blocking-tree-no-mllib

Conversation

@sonalgoyal

@sonalgoyal Sonal (sonalgoyal) commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Summary

SparkBlockingTreeUtil.appendHashCol used org.apache.spark.ml.util.SchemaUtils.appendColumn only to append the z_hash column to the input schema before the blocking map. That made blocking depend on spark-mllib, which isn't on a Spark Connect client classpath. Running findTrainingData through a Spark Connect session failed there:

ClassNotFoundException: org.apache.spark.ml.util.SchemaUtils
  at zingg.spark.core.util.SparkBlockingTreeUtil.appendHashCol(SparkBlockingTreeUtil.java:50)
  at zingg.spark.core.util.SparkBlockingTreeUtil.getBlockHashes(SparkBlockingTreeUtil.java:45)

This change appends the column with StructType.add instead.

Changes

  • SparkBlockingTreeUtil.appendHashCol: StructType.add(z_hash, IntegerType, false) instead of SchemaUtils.appendColumn. Drops the org.apache.spark.ml.util.SchemaUtils import. SchemaUtils also rejected an existing z_hash column; that check is not kept.
  • New TestSparkBlockingTreeUtilSchema: z_hash is appended last as a non-nullable integer and the input schema is untouched.

Test plan

  • mvn -Dspark=3.5 clean verify on JDK 11 (same as CI): BUILD SUCCESS. 36 + 309 + 2 + 103 tests, 0 failures, 0 errors (2 skipped, as on main).
  • mvn -Dspark=4.2 clean verify on JDK 17: BUILD SUCCESS, same counts.
  • Existing blocking tests (TestSparkBlockingTreeUtil, TestSparkBlock, executor tests) pass on both profiles.

Note for anyone running the 3.5 tests locally on JDK 17: the Spark session in the test extensions can't start without --add-opens (they're only added in the spark-4.2 profile), and the failure is swallowed, so most spark-core tests fail with a null session. Running on JDK 11 as CI does avoids it.

🤖 Generated with Claude Code

Sonal (sonalgoyal) and others added 2 commits October 19, 2026 00:05
SparkBlockingTreeUtil.appendHashCol used org.apache.spark.ml.util.SchemaUtils
just to append the z_hash column to a schema. That pulls spark-mllib into
blocking, and spark-mllib is not on a Spark Connect client classpath, so
getBlockHashes failed there with ClassNotFoundException.

Use StructType.add with the same duplicate column check SchemaUtils had, so
behaviour on classic Spark is unchanged. Adds a unit test for appendHashCol.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonalgoyal
Sonal (sonalgoyal) merged commit d3cec8e into main Oct 19, 2026
3 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.

1 participant