This is an automated email from the ASF dual-hosted git repository.
Yicong-Huang pushed a commit to branch release/v1.2
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/release/v1.2 by this push:
new e17af26637 fix(BarChart, v1.2): treat an empty categoryColumn as no
category (px.bar color) (#6997)
e17af26637 is described below
commit e17af266379af2101aa2fc0a553706327529c266
Author: Yicong Huang <[email protected]>
AuthorDate: Wed Jul 29 17:23:26 2026 -0400
fix(BarChart, v1.2): treat an empty categoryColumn as no category (px.bar
color) (#6997)
### What changes were proposed in this PR?
Backport of #6807 to `release/v1.2`, cherry-picked from
c24755c98e0d17b07712ee677ee9ddd7d33ccb68. The cherry-pick applied
cleanly.
Follows the Direct Backport Push convention; opened as a PR (rather than
a direct push) per a backport-coverage audit.
### Any related issues, documentation, discussions?
Backport of #6807. Originally linked #6792.
### How was this PR tested?
Release-branch CI runs on this PR. Cherry-pick applied cleanly onto
`release/v1.2`; no manual conflict resolution was needed.
### Was this PR authored or co-authored using generative AI tooling?
Yes — backport prepared with Claude Code (mechanical cherry-pick; the
change itself is #6807 by its original author).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Signed-off-by: Kary Zheng <[email protected]>
Co-authored-by: Kary Zheng <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Copilot Autofix powered by AI
<[email protected]>
---
.../amber/operator/visualization/barChart/BarChartOpDesc.scala | 4 +++-
.../operator/visualization/barChart/BarChartOpDescSpec.scala | 10 ++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDesc.scala
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDesc.scala
index 26ef772153..440437c9c0 100644
---
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDesc.scala
+++
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDesc.scala
@@ -109,7 +109,9 @@ class BarChartOpDesc extends PythonOperatorDescriptor {
isPatternSelected = "True"
var isCategoryColumn = "False"
- if (categoryColumn != "No Selection")
+ // "" is the Scala default ("No Selection" is only JSON metadata); an empty
+ // column must also count as "no category", else px.bar(color="") fails.
+ if (categoryColumn.nonEmpty && categoryColumn != "No Selection")
isCategoryColumn = "True"
val finalCode =
diff --git
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDescSpec.scala
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDescSpec.scala
index 3081b49d77..4c8afb0d36 100644
---
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDescSpec.scala
+++
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/barChart/BarChartOpDescSpec.scala
@@ -110,4 +110,14 @@ class BarChartOpDescSpec extends AnyFlatSpec with
BeforeAndAfter with Matchers {
ex.getMessage should (include("Value column") or include("Fields"))
}
+ "BarChartOpDesc.generatePythonCode" should "treat an unset categoryColumn as
no category (color guarded to None)" in {
+ // An empty categoryColumn (its Scala default) must guard color to None,
not
+ // emit `... if True else None` with an empty column name for
px.bar(color=).
+ opDesc.value = "score"
+ opDesc.fields = "name"
+ val code = opDesc.generatePythonCode()
+ code should include("color=self.decode_python_template('') if False else
None")
+ code should not include "color=self.decode_python_template('') if True
else None"
+ }
+
}