Skip to content

Visualization OpDescs share a duplicate Map(...) statement in getOutputSchemas #4808

@Yicong-Huang

Description

@Yicong-Huang

What happened?

Most visualization operator descriptors under common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/ define getOutputSchemas like this:

override def getOutputSchemas(
    inputSchemas: Map[PortIdentity, Schema]
): Map[PortIdentity, Schema] = {
  val outputSchema = Schema().add("html-content", AttributeType.STRING)
  Map(operatorInfo.outputPorts.head.id -> outputSchema)
  Map(operatorInfo.outputPorts.head.id -> outputSchema)  // ← unreachable duplicate
}

The first Map(...) is computed and discarded; only the second (identical) expression is the actual return value. This is dead code that almost certainly came from a copy-paste, and it appears in 29 files across the visualization package.

How to reproduce?

$ grep -c "Map(operatorInfo.outputPorts.head" \
    common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/**/*.scala \
    | grep ":2"

29 OpDesc files print :2, meaning each one contains two identical Map(...) expressions back-to-back. Files known affected include ImageVisualizerOpDesc, FunnelPlotOpDesc, VolcanoPlotOpDesc, HeatMapOpDesc, BarChartOpDesc, LineChartOpDesc, PieChartOpDesc, BoxViolinPlotOpDesc, WaterfallChartOpDesc, and others. (BulletChartOpDesc does not have the duplicate.)

Version

1.1.0-incubating (Pre-release/Master)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions