kz930 opened a new issue, #7232:
URL: https://github.com/apache/texera/issues/7232

   ### What happened?
   
   Dendrogram's **Color Threshold** cannot be set to a number. The field is 
declared as a string and is spliced into the generated Python as a decoded 
string, with no conversion anywhere along the way:
   
   
`common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/dendrogram/DendrogramOpDesc.scala`
   
   ```scala
   val strippedThreshold: EncodableString = threshold.trim
   val isThreshold =
     if (strippedThreshold.nonEmpty) pyb"color_threshold=$strippedThreshold"
     else "color_threshold=None"
   ```
   
   Because the value is an `EncodableString`, the generated code passes a 
Python `str`:
   
   ```python
   fig = ff.create_dendrogram(data, labels=labels, 
color_threshold=self.decode_python_template('MyE='))
   ```
   
   scipy compares `color_threshold` against the linkage distances, so a string 
raises:
   
   | Configured value | What scipy receives | Result |
   | --- | --- | --- |
   | blank | `None` | plots (scipy's own 0.7 × max distance) |
   | `default` | `'default'` | plots — scipy checks this literal explicitly |
   | `3` | `'3'` | `UFuncTypeError` |
   
   The only two values that plot are a blank field and the literal `default`, 
and scipy documents those as equivalent ("If `color_threshold` is None or 
'default' ... the threshold is set to `0.7*max(Z[:,2])`"). So the setting 
currently has no working use: every value that would actually change the 
coloring fails.
   
   **Expected:** a numeric Color Threshold reaches scipy as a number and colors 
the clusters at that distance.
   
   ### How to reproduce?
   
   1. Build a workflow with any source providing two numeric columns and a 
label column, connected to Dendrogram.
   2. Set Value X Column, Value Y Column and Labels.
   3. Type `3` into Color Threshold and run the workflow.
   
   The operator fails with the error below. Clearing the field, or typing 
`default` instead, renders the same chart as each other.
   
   ### Version/Branch
   
   main
   
   ### Commit Hash (Optional)
   
   348fa8844
   
   ### Relevant log output
   
   ```
   UFuncTypeError: ufunc 'greater_equal' did not contain a loop with signature 
matching types (<class 'numpy.dtypes.StrDType'>, <class 
'numpy.dtypes.Float64DType'>) -> None
   ```
   


-- 
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]

Reply via email to