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


##########
amber/src/main/scala/org/apache/texera/web/service/ExecutionResultService.scala:
##########
@@ -447,6 +461,11 @@ class ExecutionResultService(
                     globalPortIdOption.get,
                     opStorage.getTotalFileSize
                   )
+                  WorkflowExecutionsResource.updateResultCount(
+                    executionId,
+                    globalPortIdOption.get,
+                    info.tupleCount
+                  )

Review Comment:
   `info.tupleCount` belongs to the operator, not to this port. 
`onResultUpdate` builds the result store keyed by logical operator from every 
result URI, so when an operator has two result ports (`Split`, `If`), whichever 
URI comes last wins. That means this row (port 0) can get the other port's 
count, and its `result_size`, which comes from port 0's own document, then 
disagrees with it. It's also an `Int` (`getCount.toInt`) going into a BIGINT 
column. That matches the existing TODO, but since the description says "per 
result port", it may be worth either covering them or saying so.



##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResource.scala:
##########
@@ -413,6 +413,26 @@ object WorkflowExecutionsResource {
       .execute()
   }
 
+  /**
+    * Updates the row count stored for this port's result in 
operator_port_executions.
+    *
+    * @param eid          Execution ID associated with the result.
+    * @param globalPortId Global port identifier for the operator output.
+    * @param count        Number of rows in the result.
+    */
+  def updateResultCount(
+      eid: ExecutionIdentity,
+      globalPortId: GlobalPortIdentity,
+      count: Long
+  ): Unit = {
+    context
+      .update(OPERATOR_PORT_EXECUTIONS)
+      .set(OPERATOR_PORT_EXECUTIONS.RESULT_COUNT, 
java.lang.Long.valueOf(count))
+      .where(OPERATOR_PORT_EXECUTIONS.WORKFLOW_EXECUTION_ID.eq(eid.id.toInt))
+      
.and(OPERATOR_PORT_EXECUTIONS.GLOBAL_PORT_ID.eq(globalPortId.serializeAsString))
+      .execute()
+  }

Review Comment:
   This and `updateResultSize` update the same row and they run on every 
result-update tick. One method setting both columns would save a round trip per 
operator per tick and keep size and count written together.



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