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


##########
sql/updates/52.sql:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+\c texera_db
+
+SET search_path TO texera_db;

Review Comment:
   `\\c texera_db` is a psql meta-command and will fail when executed via 
Liquibase/JDBC (as this changeSet is). Remove the `\\c` line and rely on the 
Liquibase connection database configuration; if schema selection is needed, 
keep `SET search_path` (optionally including `public` if required by 
extensions).



##########
amber/src/main/scala/org/apache/texera/web/service/ExecutionResultService.scala:
##########
@@ -92,11 +93,24 @@ object ExecutionResultService {
     pojo.setWorkflowExecutionId(executionId.id.toInt)
     pojo.setGlobalPortId(evt.globalPortId.serializeAsString)
     pojo.setResultUri(evt.uri.toString)
+    pojo.setOutputMode(toOutputModeEnum(evt.mode))
     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).
+    */
+  private[service] def toOutputModeEnum(mode: OutputMode): OutputModeEnum =
+    mode match {
+      case OutputMode.SET_SNAPSHOT    => OutputModeEnum.SET_SNAPSHOT
+      case OutputMode.SET_DELTA       => OutputModeEnum.SET_DELTA
+      case OutputMode.SINGLE_SNAPSHOT => OutputModeEnum.SINGLE_SNAPSHOT
+      case OutputMode.Unrecognized(_) => null
+    }

Review Comment:
   Returning `null` from a Scala helper is easy to misuse later (and can 
surface as NPEs if the method is reused outside DB-writing code). Prefer 
returning `Option[OutputModeEnum]` (e.g., `Some(...)` / `None`) and convert at 
the call site with `.orNull` when setting the jOOQ POJO field.



##########
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 of the corresponding Iceberg document in the 
database.
+    *
+    * @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.
+    */

Review Comment:
   The Scaladoc says this updates an \"Iceberg document\", but the 
implementation updates `OPERATOR_PORT_EXECUTIONS.RESULT_COUNT`. Please reword 
to reflect the actual storage (i.e., it updates the `operator_port_executions` 
row for `(workflow_execution_id, global_port_id)`) to avoid misleading future 
maintenance.



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