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


##########
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:
   why this can be optional ?



##########
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:
   can we avoid that ?



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