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


##########
common/workflow-core/src/main/scala/org/apache/texera/service/util/BigObjectOutputStream.scala:
##########
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+package org.apache.texera.service.util
+
+import com.typesafe.scalalogging.LazyLogging
+import org.apache.amber.core.tuple.BigObject
+
+import java.io.{IOException, OutputStream, PipedInputStream, PipedOutputStream}
+import java.util.concurrent.atomic.AtomicReference
+import scala.concurrent.{Await, ExecutionContext, Future}
+import scala.concurrent.duration.Duration
+
+/**
+  * OutputStream for streaming BigObject data to S3.
+  *
+  * Data is uploaded in the background using multipart upload as you write.
+  * Call close() to complete the upload and ensure all data is persisted.
+  *
+  * Usage:
+  * {{{
+  *   val bigObject = new BigObject(executor)

Review Comment:
   Echo the previous comment, can the usage be:
   ```
   val bigObject = new BigObject(executor.executionId, executor.operatorId)
   ```
   instead of passing the whole executor?



##########
common/workflow-core/src/main/scala/org/apache/texera/service/util/BigObjectManager.scala:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+package org.apache.texera.service.util
+
+import com.typesafe.scalalogging.LazyLogging
+import org.apache.amber.core.executor.OperatorExecutor
+import org.apache.amber.core.tuple.BigObject
+import org.apache.texera.dao.SqlServer
+import org.apache.texera.dao.jooq.generated.Tables.BIG_OBJECT
+
+import java.util.UUID
+import scala.jdk.CollectionConverters._
+
+/**
+  * Manages the lifecycle of BigObjects stored in S3.
+  *
+  * Handles creation, tracking, and cleanup of large objects that exceed
+  * normal tuple size limits. Objects are automatically cleaned up when
+  * their associated workflow execution completes.
+  */
+object BigObjectManager extends LazyLogging {
+  private val DEFAULT_BUCKET = "texera-big-objects"
+  private lazy val db = SqlServer.getInstance().createDSLContext()
+
+  /**
+    * Creates a new BigObject reference and registers it for tracking.
+    * The actual data upload happens separately via BigObjectOutputStream.
+    *
+    * @param executor The operator executor providing execution context
+    * @return S3 URI string for the new BigObject (format: s3://bucket/key)
+    * @throws RuntimeException if database registration fails
+    */
+  def create(executor: OperatorExecutor): String = {

Review Comment:
   since only executor.executionId and executor.operatorId is used, can you 
change the parameter of this function to be `(executionId: Int, operatorId: 
Int)`.
   
   Since we are managing results at port level, should the port id also be 
included here ? Maybe @Xiao-zhen-Liu can chime in on this.



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