[Cleanup] Audit and clean up no-op deprecated methods and internal dead code

Aperta
#880 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

Start by checking the listed methods and classes in wayang-core, wayang-basic, and wayang-api-sql, then search for their call sites and tests before removing anything. The issue proposes phased cleanup but leaves the final removal scope and compatibility decisions open; done means obsolete internal usages are migrated, the affected modules pass their tests, and cleaned call sites no longer emit deprecation warnings.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue Description

While auditing the codebase across wayang-core, wayang-basic, wayang-spark, wayang-flink, and wayang-api-sql, several obsolete @Deprecated / @deprecated methods, unused constructor parameters, commented-out stubs, and broken legacy ML classes were identified.

Examples include:

  • Methods documented with @deprecated This method does not do anything, anymore. or @deprecated not needed anymore that have zero callers (e.g., Slot.setCardinalityEstimate, Slot.getCardinalityEstimate returning a hardcoded stub CardinalityEstimate(42, 42, 0.42), and ChannelInitializer.unchecked()).
  • An unused @Deprecated constructor parameter (ExecutionTaskFlow(Collection<ExecutionTask>, Set<Channel>)) whose inputChannels argument is completely ignored and whose internal caller passes an always-empty set from ExecutionTaskFlowCompiler.
  • Internal call sites (SanityChecker, PlanTransformation, integration/unit tests) still calling deprecated PlanTraversal, WayangPlan.addSink, and FunctionDescriptor.setLoadEstimators APIs instead of their recommended replacements.
  • A superseded @Deprecated ML ModelTransform stack (ModelTransformOperator, SparkModelTransformOperator, ModelTransformMapping) wired to SparkMLModel.transform(...), which unconditionally throws UnsupportedOperationException.
  • Missing @Deprecated annotations where only Javadoc @deprecated tags exist, and inconsistent deprecation metadata across modules.

Addressing this in small, focused PRs will:

  1. Remove Dead Code & Stubs: Eliminate misleading dummy implementations (42 cardinality stubs, ignored parameters, commented-out methods).
  2. Eliminate Internal Deprecation Warnings: Migrate internal and test call sites onto modern Wayang APIs without breaking external users.
  3. Align Deprecation Metadata: Make future major-version (2.0) removal candidates explicit and consistent.

Verified Audit Findings
1. Zero-Caller No-Op & Dead Code in wayang-core
  • org.apache.wayang.core.plan.wayangplan.Slot:
    • setCardinalityEstimate(CardinalityEstimate): Body is entirely commented out; marked @deprecated This method does not do anything, anymore. (0 callers).
    • getCardinalityEstimate(): Returns hardcoded dummy new CardinalityEstimate(42, 42, 0.42); marked @deprecated These method does not do anything, anymore. (0 callers), alongside commented-out mark().
  • org.apache.wayang.core.plan.executionplan.ChannelInitializer:
    • default ChannelInitializer unchecked(): Marked Javadoc @deprecated not needed anymore (no @Deprecated annotation, 0 callers).
  • org.apache.wayang.core.optimizer.enumeration.ExecutionTaskFlow & ExecutionTaskFlowCompiler:
    • @Deprecated ExecutionTaskFlow(Collection<ExecutionTask>, Set<Channel>): Completely ignores inputChannels; only called internally by ExecutionTaskFlow.recreateFrom(...), passing ExecutionTaskFlowCompiler.getInputChannels(), whose population is commented out (// this.inputChannels.add(channelCopy)).
2. Internal Callers Still Using Deprecated APIs
  • org.apache.wayang.core.plan.wayangplan.PlanTraversal:
    • @Deprecated PlanTraversal(boolean, boolean) is still called directly in SanityChecker and PlanTransformation instead of PlanTraversal.fanOut(), PlanTraversal.downstream(), and PlanTraversal.upstream().
  • org.apache.wayang.core.plan.wayangplan.WayangPlan:
    • @Deprecated addSink(Operator) is still called across unit/integration tests (ReduceByMappingTest, PlanTransformationTest, SubplanPatternTest, WayangPlans) instead of WayangPlan(Operator...).
  • org.apache.wayang.core.function.FunctionDescriptor:
    • setLoadEstimators(LoadEstimator, LoadEstimator) (Javadoc @deprecated Use #setLoadProfileEstimator(LoadProfileEstimator) instead., missing @Deprecated annotation) is still called in WordCountIT.
3. Broken / Superseded Legacy ML Stack (wayang-basic & wayang-spark)
  • ModelTransformOperator (wayang-basic), SparkModelTransformOperator (wayang-spark), ModelTransformMapping (wayang-spark, registered in spark.mapping.Mappings), and SparkMLModel.transform(JavaRDD):
    • Superseded by PredictOperator / PredictOperators / SparkPredictOperator / PredictMapping.
    • SparkMLModel.transform(...) unconditionally throws UnsupportedOperationException("This method has been deprecated. Please use predict instead."), and no callers or tests remain for ModelTransformOperator.
4. Deprecation Metadata & Scheduled Major-Version Removals
  • Methods with Javadoc @deprecated but missing @Deprecated runtime annotation: ChannelInitializer.unchecked() (if kept), FunctionDescriptor.setLoadEstimators(...), ReduceOperator.createGroupedReduce(...), and org.apache.wayang.flink.mapping.Mappings.BASIC_MAPPINGS.
  • Active/scheduled deprecations to preserve until next major version (2.0) and track clearly:
    • org.apache.wayang.api.sql.calcite.jdbc.JdbcSchema.createDialect(DataSource) (@Deprecated // to be removed before 2.0).
    • ObjectFileSerializationMode.LEGACY_JAVA_SERIALIZATION, ObjectFileSink.useLegacySerialization(), and ObjectFileSource.useLegacySerialization().
    • ExecutionOperator.getLoadProfileEstimatorConfigurationKey() and ExecutionOperator.getSupportedOutputChannels(int) (still widely overridden/used internally; out of scope for immediate removal).

Proposed Phased Scope & PR Sequence

To keep reviews small and safe, I propose splitting this cleanup into two phases with 2 small, independently testable PRs per phase:

Phase 1: Safe Dead Code Removal & Internal Caller Migration (Non-Breaking)
  • PR 1 — Remove zero-caller dead no-ops and commented-out stubs in wayang-core
    • Remove Slot.setCardinalityEstimate(CardinalityEstimate), Slot.getCardinalityEstimate(), and the commented-out mark() block in Slot.java.
    • Remove ChannelInitializer.unchecked().
    • Remove @Deprecated ExecutionTaskFlow(Collection<ExecutionTask>, Set<Channel>), switch ExecutionTaskFlow.recreateFrom(...) to ExecutionTaskFlow(Collection<ExecutionTask>), and remove dead inputChannels / getInputChannels() in ExecutionTaskFlowCompiler.
  • PR 2 — Migrate internal and test callers off deprecated core APIs
    • Update SanityChecker and PlanTransformation to use PlanTraversal.fanOut(), downstream(), and upstream() instead of new PlanTraversal(boolean, boolean).
    • Migrate test callers (ReduceByMappingTest, PlanTransformationTest, SubplanPatternTest, WayangPlans) off WayangPlan.addSink(Operator) to new WayangPlan(Operator...) (keeping addSink in place for PlanTransformation.replace and external compatibility).
    • Migrate WordCountIT off FunctionDescriptor.setLoadEstimators(...) to setLoadProfileEstimator(new NestableLoadProfileEstimator(...)).
Phase 2: Superseded ModelTransform Removal & Deprecation Metadata Alignment
  • PR 3 — Remove broken @Deprecated ModelTransform ML classes (pending maintainer approval)
    • Remove ModelTransformOperator, SparkModelTransformOperator, ModelTransformMapping (and its entry in org.apache.wayang.spark.mapping.Mappings), plus SparkMLModel.transform(JavaRDD) which throws UnsupportedOperationException.
    • Verify PredictOperator / SparkPredictOperator integration and unit tests pass cleanly.
  • PR 4 — Standardize @Deprecated annotations and major-version tracking
    • Add missing @Deprecated annotations matching existing Javadoc @deprecated tags (FunctionDescriptor.setLoadEstimators, ReduceOperator.createGroupedReduce, org.apache.wayang.flink.mapping.Mappings.BASIC_MAPPINGS).
    • Standardize since / forRemoval metadata (e.g., on JdbcSchema.createDialect(DataSource) and ModelTransform* if maintainers prefer deferring PR 3 removal until 2.0).
    • Optionally document a follow-up migration path for ExecutionOperator.getLoadProfileEstimatorConfigurationKey() and getSupportedOutputChannels(int) if desired.
PR Phase Scope Breaking? Depends on
PR 1 Phase 1 Remove zero-caller stubs in Slot, ChannelInitializer, ExecutionTaskFlow/Compiler No (0 callers, no-ops) -
PR 2 Phase 1 Migrate internal & test callers (PlanTraversal, WayangPlan.addSink, FunctionDescriptor.setLoadEstimators) No (keeps signatures) -
PR 3 Phase 2 Remove broken @Deprecated ModelTransform stack & SparkMLModel.transform Minimal (0 callers; throws UnsupportedOperationException) Maintainer sign-off
PR 4 Phase 2 Align missing @Deprecated annotations and forRemoval metadata for 2.0 No PR 1–2

Verification & Testing
  • Run unit and integration tests for wayang-core, wayang-basic, wayang-spark, wayang-flink, wayang-api-sql, and wayang-tests-integration after each PR.
  • Check compiler deprecation warnings (-Xlint:deprecation) before and after PR 2 and PR 4.
  • Run apache-rat:check across all touched modules.

Questions for Maintainers
  1. Are the zero-caller no-op removals in PR 1 (Slot dummy 42 stubs, ChannelInitializer.unchecked(), ExecutionTaskFlow unused parameter) acceptable for 1.1.x / 1.2.x?
  2. Should PR 3 remove the broken ModelTransform classes now, or keep them with forRemoval = true until 2.0?
  3. Would you like @Deprecated(since = ..., forRemoval = true) applied consistently in PR 4 for items slated for 2.0 removal?
Lingua principale
Java
Stelle
284
Fork
143
Merge medio
2g 6h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/wayang

Tutte le issue di apache/wayang

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.