Repository navigation
Add Spark based pipeline module - #299
Merged
Merged
Conversation
- AbstractPipelineApplication[T]: Spark app base, manages session lifecycle - ConfigLoader: cascading config from env (SPARK_AB_*) / props (spark.ab.*) / CLI args - ConfigPrinter: per-field debug report with source attribution + final YAML Args > props > env > defaults precedence. Strict JSON mapper throws on missing required primitives at parse time. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Pi estimation extending AbstractPipelineApplication[SparkPiConfig]. Replaces EdgeCodec sample as the canonical demo. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Switch CLI args to --key=value form; reject malformed input (no --, missing =) instead of silently dropping odd-parity args. - Parse empty array literal [] as an empty array (was [""]). - splitTopLevelCommas: preserve commas inside double quotes and support backslash-escaped commas (\,). - Mask sensitive fields (password/passwd/secret/token/credential) in both the per-field report and the YAML dump. - Wrap System.setProperty in tests with try/finally; add coverage for empty array, escaped commas, and rejected arg forms. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Drop empty/whitespace tokens during array literal parse so trailing commas (e.g. [1,2,3,]) no longer surface as empty elements. - Document splitTopLevelCommas escape semantics (\X yields literal X). - Document SensitivePattern policy and the per-field/YAML scope split in printConfigReport. - Expose ConfigPrinter.isSensitive and maskedTree as private[util] so masking can be unit-tested without stdout capture. - Add ConfigPrinterTest covering name matching, top-level masking, nested masking, and end-to-end stdout masking. - Simplify testRejectArgWithoutEquals to a single-arg case and add testTrailingCommaIgnored. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Collapse testRejectArgWithoutEquals + testRejectArgWithoutDashes into testRejectMalformedArg, with --=value added as a third case. - Collapse testEmptyArray + testTrailingCommaIgnored into testIntArrayParsing, with two more shape cases ([1,2,3] and [ , 1 , 2 ]) included for free. Pipe delimiter is used so commas inside the array literal stay intact. - Other cases (testReplaceBoolean, testReplaceArrayInt, testStringArrayWithEscapedComma, testAllMissing*, testOnlyDefault) stay on @test — heterogeneous types or System.setProperty branches make CsvSource a poor fit. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Each row now states its intent (baseline, trailing comma, dropped tokens, etc.) and a note flags the null-on-empty-cell CsvSource behavior that the guard relies on. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Move log4j-no-stdout.properties from src/main/resources to conf/ so it stops being bundled in the published jar. Pipelines that need it should pass it via spark-submit --files or -Dlog4j.configuration. - ConfigLoader.load now takes printReport (default true), letting unit tests and batch tools opt out of the per-field stdout report. - AbstractPipelineApplication exposes hiveSupport and configureSparkBuilder hooks so subclasses can opt out of Hive or attach extra Spark config without rebuilding main(). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
When configureSparkBuilder is overridden, hiveSupport is silently ignored unless the override delegates to super. Make that contract explicit in KDoc and show the canonical super-delegation pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- AbstractPipelineApplication: drop the unused hiveSupport / configureSparkBuilder extension points and inline enableHiveSupport(). The indirection had no callers and obscured the simple default. - ConfigLoader: extract ConfigSource trait with EnvSource, PropsSource, and ArgsSource. load() now composes them via Seq(env, props, args).reduce(_ ++ _) so precedence (low -> high) is visible at the call site and adding a new source is local. - ConfigPrinter: take Seq[(name, map)] instead of fixed env/props/args arguments, so new sources flow into the per-field trace and origin resolution without a signature change. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Pipelines opt in to whatever they need (Hive, shuffle partitions, etc.) by overriding `configure(builder: SparkSession.Builder)`. Default is a no-op so applications that don't need Hive (e.g. SparkPiDemo) don't pay for the metastore connection. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Move ConfigSource trait and Env/Props/Args implementations into their own file; ConfigLoader now only owns merge + JSON parsing. - AbstractPipelineApplication: keep main at the top of the class, define the abstract `run` and overridable `configure` at the bottom, and mark both as `protected` so they read as subclass extension points rather than public API. - SparkPiDemo: align with parent visibility via `protected override`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`run` and `configure` are subclass extension points but the protected modifier added clutter without changing how callers (only `main` in the same class) use them. Match the surrounding style and let subclasses override without restating visibility. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Group the trait and its companion at the top of the file, leaving the three implementations (Env, Props, Args) below. Reads in declaration order without jumping past the implementations to find `camelize`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Reduce the PR surface so masking can land in a focused follow-up. - Remove SensitivePattern, Mask, isSensitive, maskValue, maskedTree and maskInPlace from ConfigPrinter; the per-field report and YAML dump now show raw values. - Delete ConfigPrinterTest, which existed solely for masking coverage (name matching, top-level/nested masking, stdout masking). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
em3s
force-pushed
the
feature/pipeline-module
branch
from
May 6, 2026 03:02
8fa3ff1 to
c2a3790
Compare
1 task done
Now that #300 enabled the Spotless Scala step on main, run spotlessApply across the pipeline module so its sources land on the shared baseline. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
em3s
marked this pull request as ready for review
May 6, 2026 04:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
pipeline/Gradle module: Spark application base, cascading config loader, and a per-field debug printer. Establishes the framework foundation; concrete pipelines follow in subsequent PRs.Builds on #300 (Spotless for Scala) so
.scalasources land already on the formatting baseline. Secret masking inConfigPrinteris intentionally deferred to a follow-up to keep this PR focused.Closes #
Changes
AbstractPipelineApplication[T]— Spark app base; owns theSparkSessionlifecycle. Subclasses overriderunand optionallyconfigure(builder)(e.g.enableHiveSupport()).ConfigSource—EnvSource(SPARK_AB_*),PropsSource(spark.ab.*),ArgsSource(args)(--key=value); composed in low → high precedence order.ConfigLoader.load[T]— merges sources and parses intoTwith strict primitive handling (missing required primitive throws).ConfigPrinter.printConfigReport— per-field source attribution + final YAML dump.SparkPiDemo— framework smoke example (Pi estimation).ConfigLoaderTest— defaults, source overrides, array literal parsing, strict failure cases.How to Test
AI Assistance