mengw15 commented on code in PR #9049:
URL: https://github.com/apache/texera/pull/9049#discussion_r4498473842


##########
amber/src/main/scala/org/apache/texera/web/service/ExecutionResultService.scala:
##########
@@ -92,11 +93,26 @@ object ExecutionResultService {
     pojo.setWorkflowExecutionId(executionId.id.toInt)
     pojo.setGlobalPortId(evt.globalPortId.serializeAsString)
     pojo.setResultUri(evt.uri.toString)
+    pojo.setOutputMode(toOutputModeEnum(evt.mode).orNull)
     new OperatorPortExecutionsDao(
       SqlServer.getInstance().createDSLContext().configuration()
     ).insert(pojo)
   }
 
+  /**
+    * The stored form of a port's output mode. Recorded with the URI so that a 
finished
+    * execution's results can be listed without the engine's physical plan 
(#8994).
+    * output_mode_enum in sql/texera_ddl.sql mirrors OutputMode; a mode 
missing from this
+    * match is stored as no mode rather than failing the insert.
+    */
+  private[service] def toOutputModeEnum(mode: OutputMode): 
Option[OutputModeEnum] =
+    mode match {
+      case OutputMode.SET_SNAPSHOT    => Some(OutputModeEnum.SET_SNAPSHOT)
+      case OutputMode.SET_DELTA       => Some(OutputModeEnum.SET_DELTA)
+      case OutputMode.SINGLE_SNAPSHOT => Some(OutputModeEnum.SINGLE_SNAPSHOT)
+      case _                          => None

Review Comment:
   It only covered `Unrecognized`, which a declared port can't have. Done in 
828c52d2740c76272cc8f82357cf41d06ad38dbc: it returns the enum and throws on 
`Unrecognized`, as `convertWebResultUpdate` does. The test now walks 
`OutputMode.values`, so a mode missing from the match fails in CI instead of at 
runtime; this replaces the catch-all.



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