Skip to content

fix(operator): convert booleans to Python-compatible values in BubbleChart/ContourPlot/TernaryPlot#4238

Open
xuang7 wants to merge 9 commits intoapache:mainfrom
xuang7:fix/bubble-chart-boolean-python-conversion
Open

fix(operator): convert booleans to Python-compatible values in BubbleChart/ContourPlot/TernaryPlot#4238
xuang7 wants to merge 9 commits intoapache:mainfrom
xuang7:fix/bubble-chart-boolean-python-conversion

Conversation

@xuang7
Copy link
Contributor

@xuang7 xuang7 commented Feb 25, 2026

What changes were proposed in this PR?

This PR fixes a bug in BubbleChartOpDesc, ContourPlotOpDesc, and TernaryPlotOpDesc where boolean fields were interpolated into the Python template without quotes, resulting in code like if false == 'true'. Since Python does not recognize lowercase false as a valid identifier, this caused a NameError: name 'false' is not defined. The fix wraps the variables in quotes (if '$enableColor' == 'true'), reverting to the string comparison approach used before the Python template was introduced, so the generated Python performs a string-to-string comparison.

Demo:
bubblechart

Any related issues, documentation, discussions?

Closes #4257

How was this PR tested?

Manually tested

Was this PR authored or co-authored using generative AI tooling?

No

@carloea2
Copy link
Contributor

I think the best solution is to keep the previous semantics but fixing it.
A simpler solution may be just if $enableColor == 'true': -> if '$enableColor' == 'true':
@xuang7

@xuang7 xuang7 changed the title fix: convert BubbleChart boolean field to Python-compatible value fix: convert booleans to Python-compatible values in BubbleChart/ContourPlot/TernaryPlot Mar 2, 2026
@xuang7 xuang7 requested a review from carloea2 March 5, 2026 00:45
@bobbai00 bobbai00 changed the title fix: convert booleans to Python-compatible values in BubbleChart/ContourPlot/TernaryPlot fix(operator): convert booleans to Python-compatible values in BubbleChart/ContourPlot/TernaryPlot Mar 5, 2026
@bobbai00 bobbai00 assigned bobbai00 and xuang7 and unassigned bobbai00 Mar 5, 2026
@bobbai00 bobbai00 requested review from bobbai00 and removed request for carloea2 March 5, 2026 01:20
Copy link
Contributor

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please explain briefly how the current fix solves the problem

@xuang7
Copy link
Contributor Author

xuang7 commented Mar 5, 2026

LGTM. Please explain briefly how the current fix solves the problem

Thanks for the suggestion. I have updated the PR description with a short explanation.

@chenlica
Copy link
Contributor

chenlica commented Mar 5, 2026

@carloea2 Is your suggested change taken care of? If so, we can merge this PR.

@xuang7
Copy link
Contributor Author

xuang7 commented Mar 5, 2026

@carloea2 Is your suggested change taken care of? If so, we can merge this PR.

Yes, I've applied @carloea2 suggested fix.

@carloea2
Copy link
Contributor

carloea2 commented Mar 6, 2026

@chenlica this PR LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BubbleChart/ContourPlot/TernaryPlot fail due to boolean value rendering

4 participants