Skip to content

Commit

Permalink
clearer naming and a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Dec 13, 2023
1 parent 4787a68 commit 8641dd9
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public PartitionedTable transform(
// Perform the transformation
final Table resultTable = prepared.update(List.of(new TableTransformationColumn(
constituentColumnName,
maybeReplaceExecContext(executionContext),
disableRecursiveParallelOperationInitialization(executionContext),
prepared.isRefreshing() ? transformer : assertResultsStatic(transformer))));

// Make sure we have a valid result constituent definition
Expand Down Expand Up @@ -325,7 +325,7 @@ public PartitionedTable transform(
* {@link OperationInitializer#canParallelize()}, or must be a different instance than the current context's
* OperationInitializer.
*/
private static ExecutionContext maybeReplaceExecContext(ExecutionContext provided) {
private static ExecutionContext disableRecursiveParallelOperationInitialization(ExecutionContext provided) {
if (provided == null) {
return null;
}
Expand All @@ -336,6 +336,9 @@ private static ExecutionContext maybeReplaceExecContext(ExecutionContext provide
if (current.getInitializer() != provided.getInitializer()) {
return provided;
}

// The current operation initializer isn't safe to submit more tasks that we will block on, replace
// with an instance that will never attempt to push work to another thread
return provided.withOperationInitializer(OperationInitializer.NON_PARALLELIZABLE);
}

Expand Down Expand Up @@ -374,7 +377,7 @@ public PartitionedTable partitionedTransform(
.update(List.of(new BiTableTransformationColumn(
constituentColumnName,
RHS_CONSTITUENT,
maybeReplaceExecContext(executionContext),
disableRecursiveParallelOperationInitialization(executionContext),
prepared.isRefreshing() ? transformer : assertResultsStatic(transformer))))
.dropColumns(RHS_CONSTITUENT);

Expand Down

0 comments on commit 8641dd9

Please sign in to comment.