Yicong-Huang commented on code in PR #5966:
URL: https://github.com/apache/texera/pull/5966#discussion_r3494750044


##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/workflow/cache/CacheKeyUtil.scala:
##########
@@ -0,0 +1,201 @@
+/*
+ * 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.amber.core.workflow.cache
+
+import com.fasterxml.jackson.databind.SerializationFeature
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.apache.texera.amber.core.executor.OpExecInitInfo
+import org.apache.texera.amber.core.workflow.{
+  GlobalPortIdentity,
+  PhysicalLink,
+  PhysicalOp,
+  PhysicalPlan
+}
+import org.apache.texera.amber.util.JSONUtils
+
+import java.nio.charset.StandardCharsets
+import java.security.MessageDigest
+
+/**
+  * The cache key of an output port.
+  *
+  * @param json the JSON describing the upstream sub-DAG the key is computed 
from
+  * @param hash SHA-256 hash of `json`; cache lookups match on this hash and 
then
+  *             confirm the match with `json` (see 
[[CacheKeyUtil.isSameComputation]])
+  */
+case class StorageCacheKey(json: String, hash: String)

Review Comment:
   maybe we should use protobuf to define this? python side also needs it later 
right?



##########
common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/WorkflowCoreTypesSpec.scala:
##########
@@ -338,6 +338,31 @@ class WorkflowCoreTypesSpec extends AnyFlatSpec {
     assert(sub.links == Set(link("a", "b")))
   }
 
+  "PhysicalPlan.getTransitiveUpstreamSubPlan" should "include the operator and 
all its transitive upstream, with the links between them" in {
+    val a = physicalOp("a")
+    val b = physicalOp("b")
+    val c = physicalOp("c")
+    val d = physicalOp("d")
+    // a -> b -> c -> d and a -> c; the upstream sub-DAG of c is {a, b, c} (d 
is downstream)

Review Comment:
   can we test 
   1) multiple source, multiple sink
   2) join, and union



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