carloea2 commented on code in PR #7233:
URL: https://github.com/apache/texera/pull/7233#discussion_r3715709318
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/gaugeChart/GaugeChartOpDesc.scala:
##########
@@ -69,21 +72,26 @@ class GaugeChartOpDesc extends PythonOperatorDescriptor {
OperatorGroupConstants.VISUALIZATION_FINANCIAL_GROUP
)
- private val mapper = new ObjectMapper()
- mapper.registerModule(DefaultScalaModule)
+ /** An unset number reaches the generated code as Python's `None`. */
+ private def numberOrNone(value: Option[Double]): PythonLiteral =
+ value.map(_.toString).getOrElse("None")
- private def serializeSteps(steps: List[GaugeChartSteps]): String = {
- mapper.writeValueAsString(steps)
- }
+ /** The steps whose bounds are both filled in, as a list literal of numbers.
*/
+ private def stepsLiteral: PythonLiteral =
+ steps
Review Comment:
Steps is optional and explicit null input can leave this field null. Calling
flatMap then makes code generation fail with a null pointer error. The old path
treated null as no steps. Please normalize it here, as the Bullet Chart code
already does, and add a null input test.
--
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]