Skip to content

[INFRA] Document test base class hierarchy in AGENTS.md#55619

Draft
zhengruifeng wants to merge 1 commit intoapache:masterfrom
zhengruifeng:spark-dev-5
Draft

[INFRA] Document test base class hierarchy in AGENTS.md#55619
zhengruifeng wants to merge 1 commit intoapache:masterfrom
zhengruifeng:spark-dev-5

Conversation

@zhengruifeng
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add a Test Base Classes section to AGENTS.md that describes the layered Scala test base hierarchy and when to pick each one:

SparkFunSuite                                                           (core)
  <- PlanTest = SparkFunSuite + PlanTestBase                            (sql/catalyst)
  <- QueryTest = SparkFunSuite + QueryTestBase + PlanTest               (sql/core)
    <- SharedSparkSession = QueryTest + SharedSparkSessionBase          (sql/core)

The new section covers:

  • A decision table mapping test scope (plain JVM, Catalyst plans, DataFrame helpers, full SQL with session) to the right base.
  • That helper traits like ParquetTest, OrcTest, FileBasedDataSourceTest, DDLCommandTestUtils already extend QueryTest but do not provide a SparkSession, so they are typically combined with SharedSparkSession.
  • Common redundant-mixin patterns observed in the repo (e.g. extends QueryTest with SharedSparkSession, extends QueryTest with ParquetTest) and which combinations are NOT redundant.
  • A linearization gotcha: the first item in the extends clause must transitively extend SparkFunSuite (an abstract class). Pure helper traits like *ErrorsBase do not carry that chain, so putting one first breaks compilation.

CLAUDE.md is a symlink to AGENTS.md, so this change is picked up by both AI agent toolchains.

Why are the changes needed?

Picking the wrong test base class or stacking redundant mixins is a common mistake when adding new Scala test suites. The information is currently spread across the source of SparkFunSuite, PlanTest, QueryTest, and SharedSparkSession, with no single place that summarizes when to use which or what combinations are redundant. Documenting it in AGENTS.md gives both contributors and AI coding agents a quick reference.

Does this PR introduce any user-facing change?

No. Documentation-only change to a developer/agent guide file.

How was this patch tested?

N/A. Documentation-only change; no code or tests are affected.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude opus-4-7

Add a "Test Base Classes" section to AGENTS.md describing the layered
SparkFunSuite -> PlanTest -> QueryTest -> SharedSparkSession hierarchy,
when to pick each base, common redundant-mixin patterns to avoid, and
the linearization gotcha when the first item in an `extends` clause is
a pure trait without the SparkFunSuite class chain.

Generated-by: Claude opus-4-7
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