AliRana30 opened a new issue, #880:
URL: https://github.com/apache/wayang/issues/880
### Problem & Motivation
While exploring the codebase, several deprecated methods, no-op
implementations, and commented-out code blocks were identified in
`wayang-core`, `wayang-basic`, and `wayang-api-sql`.
Some of these methods have been annotated with `@deprecated not needed
anymore` or `@deprecated This method does not do anything, anymore` for
multiple release cycles. Others return hardcoded dummy constants (e.g.,
returning arbitrary `CardinalityEstimate(42, 42, 0.42)`) or wrap obsolete type
erasures.
Cleaning up these obsolete internal methods will:
1. **Reduce Technical Debt**: Eliminates dead code paths and reduces
maintenance overhead.
2. **Eliminate Build Warnings**: Reduces compiler `-Xlint:deprecation`
warnings across core modules.
3. **Clarify Developer Intent**: Prevents new contributors from using no-op
or obsolete methods when extending operators or execution plans.
---
### Audit Findings
#### 1. No-Op and Obsolete Methods in `wayang-core`
- **`org.apache.wayang.core.plan.wayangplan.Slot`**:
- `setCardinalityEstimate(CardinalityEstimate)`: Method body is completely
commented out (`// this.cardinalityEstimate = ...`), marked `@deprecated This
method does not do anything, anymore.`
- `getCardinalityEstimate()`: Returns a dummy stub `new
CardinalityEstimate(42, 42, 0.42)`, marked `@deprecated These method does not
do anything, anymore.`
- **`org.apache.wayang.core.plan.executionplan.ChannelInitializer`**:
- `default ChannelInitializer unchecked()`: Deprecated with javadoc
`@deprecated not needed anymore`.
- **`org.apache.wayang.core.plan.wayangplan.WayangPlan`**:
- `WayangPlan(Collection<Operator> sinks)`: Deprecated legacy constructor;
internal code should consistently use the varargs `WayangPlan(Operator...
sinks)`.
- **`org.apache.wayang.core.function.FunctionDescriptor`**:
- Deprecated legacy estimation setters where modern `LoadProfileEstimator`
should be used.
#### 2. Obsolete Classes & Stubs in `wayang-basic`
- **`org.apache.wayang.basic.operators.ModelTransformOperator`**:
- Class is annotated `@Deprecated` since early incubation; should be
checked for remaining usages or scheduled for removal.
- **`org.apache.wayang.basic.operators.ObjectFileSerializationMode`**:
- `@Deprecated` enum superseded by modern serialization properties.
#### 3. Scheduled Removals in `wayang-api-sql`
- **`org.apache.wayang.api.sql.calcite.jdbc.JdbcSchema`**:
- Line 170: `@Deprecated // to be removed before 2.0`
`createDialect(DataSource)` superseded by `createDialect(SqlDialectFactory,
DataSource)`.
---
### Proposed Phased Scope
To prevent any breaking changes to external users while maximizing codebase
hygiene, we propose tackling this in two phases:
#### Phase 1: Internal No-Op & Dead Code Removal (Safe & Non-Breaking)
- Remove internal dead methods that perform no operation (e.g.,
`Slot.setCardinalityEstimate`, `Slot.getCardinalityEstimate()`, and
`ChannelInitializer.unchecked()`).
- Remove commented-out legacy code blocks in `Slot.java`.
- Migrate internal Wayang call sites to the recommended modern alternatives
(e.g., replacing usages of deprecated `WayangPlan` constructors in tests).
#### Phase 2: Deprecation Schedule Alignment
- Add `@Deprecated(since = "...", forRemoval = true)` where appropriate to
give clear notice to downstream users.
- Document candidate removals for the next major milestone.
---
### Verification & Testing
- Run full test suite across affected modules (`wayang-core`,
`wayang-basic`, `wayang-api-sql`).
- Verify no compiler warnings remain for the cleaned call sites.
- Verify Apache Rat checks pass cleanly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]