-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance incremental computation support in Texera #2165
Open
zuozhiw
wants to merge
22
commits into
master
Choose a base branch
from
zuozhi-incremental
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
911e8b0
wip
zuozhiw 3276f29
merge
zuozhiw d2eecc5
support workflows without a view result operator
zuozhiw 7b60978
update
zuozhiw e5e89e9
update
zuozhiw c708787
wip
zuozhiw 4c2e670
Merge branch 'master' into zuozhi-remove-sink
zuozhiw 6d876ed
wip
zuozhiw 2089538
complete
zuozhiw 5cc37aa
complete cache
zuozhiw 59e90f9
wip
zuozhiw b4c8116
wip
zuozhiw eb3402b
wip
zuozhiw cc06e00
merge
zuozhiw 8563bd9
clean up
zuozhiw 6ea5dec
fix format
zuozhiw 4bc62ab
format
zuozhiw 9296f7c
add comments
zuozhiw 1dc1246
update
zuozhiw 634d477
format
zuozhiw 50cd751
remove unrelated change
zuozhiw 2fc718d
Merge branch 'master' into zuozhi-incremental
zuozhiw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...in/scala/edu/uci/ics/texera/workflow/common/operators/consolidate/ConsolidateOpDesc.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package edu.uci.ics.texera.workflow.common.operators.consolidate | ||
|
||
import edu.uci.ics.amber.engine.architecture.deploysemantics.layer.OpExecConfig | ||
import edu.uci.ics.texera.workflow.common.ProgressiveUtils | ||
import edu.uci.ics.texera.workflow.common.metadata.{ | ||
InputPort, | ||
OperatorGroupConstants, | ||
OperatorInfo, | ||
OutputPort | ||
} | ||
import edu.uci.ics.texera.workflow.common.operators.OperatorDescriptor | ||
import edu.uci.ics.texera.workflow.common.tuple.schema.{OperatorSchemaInfo, Schema} | ||
|
||
import scala.collection.JavaConverters.asScalaBuffer | ||
import scala.collection.immutable.List | ||
|
||
class ConsolidateOpDesc extends OperatorDescriptor { | ||
override def operatorInfo: OperatorInfo = { | ||
OperatorInfo( | ||
"Consolidate", | ||
"Consolidate retractable inputs, collect all of them and output append-only data", | ||
OperatorGroupConstants.UTILITY_GROUP, | ||
List(InputPort("")), | ||
List(OutputPort("")), | ||
supportRetractableInput = true | ||
) | ||
} | ||
|
||
override def getOutputSchema(schemas: Array[Schema]): Schema = { | ||
val newAttrs = asScalaBuffer(schemas(0).getAttributes) | ||
.filter(attr => attr != ProgressiveUtils.insertRetractFlagAttr) | ||
Schema.newBuilder().add(newAttrs.toArray: _*).build() | ||
} | ||
|
||
override def operatorExecutor(operatorSchemaInfo: OperatorSchemaInfo): OpExecConfig = { | ||
OpExecConfig.manyToOneLayer(operatorIdentifier, _ => new ConsolidateOpExec(operatorSchemaInfo)) | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...in/scala/edu/uci/ics/texera/workflow/common/operators/consolidate/ConsolidateOpExec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package edu.uci.ics.texera.workflow.common.operators.consolidate | ||
|
||
import edu.uci.ics.amber.engine.architecture.worker.PauseManager | ||
import edu.uci.ics.amber.engine.common.InputExhausted | ||
import edu.uci.ics.amber.engine.common.rpc.AsyncRPCClient | ||
import edu.uci.ics.texera.workflow.common.ProgressiveUtils | ||
import edu.uci.ics.texera.workflow.common.operators.OperatorExecutor | ||
import edu.uci.ics.texera.workflow.common.tuple.Tuple | ||
import edu.uci.ics.texera.workflow.common.tuple.schema.OperatorSchemaInfo | ||
|
||
import scala.collection.mutable.ArrayBuffer | ||
|
||
class ConsolidateOpExec(operatorSchemaInfo: OperatorSchemaInfo) extends OperatorExecutor { | ||
|
||
private val results = new ArrayBuffer[Tuple]() | ||
|
||
override def processTexeraTuple( | ||
tuple: Either[Tuple, InputExhausted], | ||
input: Int, | ||
pauseManager: PauseManager, | ||
asyncRPCClient: AsyncRPCClient | ||
): Iterator[Tuple] = { | ||
|
||
tuple match { | ||
case Left(t) => | ||
val (isInsertion, tupleValue) = | ||
ProgressiveUtils.getTupleFlagAndValue(t, operatorSchemaInfo) | ||
if (isInsertion) { | ||
results += tupleValue | ||
} else { | ||
results -= tupleValue | ||
} | ||
Iterator() | ||
case Right(_) => | ||
results.iterator | ||
} | ||
|
||
} | ||
|
||
override def open(): Unit = {} | ||
|
||
override def close(): Unit = {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,9 +272,9 @@ public BuilderV2 add(String attributeName, AttributeType attributeType, Object f | |
*/ | ||
public BuilderV2 addSequentially(Object[] fields) { | ||
checkNotNull(fields); | ||
checkSchemaMatchesFields(schema.getAttributes(), Lists.newArrayList(fields)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need such an assertion for the normal tuple fields. if we need to add new fields (e.g., retraction or not), we can treat it separately? If so, I can do it in a future PR. |
||
int startIndex = this.fieldNameMap.size(); | ||
for (int i = 0; i < fields.length; i++) { | ||
this.add(schema.getAttributes().get(i), fields[i]); | ||
this.add(schema.getAttributes().get(startIndex + i), fields[i]); | ||
} | ||
return this; | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see similar code for partial and final aggregate operators to do time-based snapshots to push partial results out. If the time-based snapshot is a universal strategy for incremental operators to push out partial results, is it better to make it a standard framework?