Skip to content

Commit

Permalink
Fix python udf source detection (#3189)
Browse files Browse the repository at this point in the history
PhysicalOp relies on the input port number to determine if an operator
is a source operator. For Python UDF, from the changes in #3183, the
input ports are not correctly associated with the PhysicalOp, causing
all the Python UDFs to be recognized as source operators. This PR fixes
the issue.
  • Loading branch information
Yicong-Huang authored Jan 1, 2025
1 parent c2bef3a commit f2aeb0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PythonProxyClient(portNumberPromise: Promise[Int], val actorId: ActorVirtu
logger.warn(
s"Failed to connect to Flight Server in this attempt, retrying after $UNIT_WAIT_TIME_MS ms... remaining attempts: ${MAX_TRY_COUNT - tryCount}"
)
flightClient.close()
if (flightClient != null) flightClient.close()
Thread.sleep(UNIT_WAIT_TIME_MS)
tryCount += 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PythonUDFOpDescV2 extends LogicalOp {
Map(operatorInfo.outputPorts.head.id -> outputSchema)
}

if (workers > 1) {
val physicalOp = if (workers > 1) {
PhysicalOp
.oneToOnePhysicalOp(
workflowId,
Expand All @@ -112,7 +112,10 @@ class PythonUDFOpDescV2 extends LogicalOp {
OpExecWithCode(code, "python")
)
.withParallelizable(false)
}.withDerivePartition(_ => UnknownPartition())
}

physicalOp
.withDerivePartition(_ => UnknownPartition())
.withInputPorts(operatorInfo.inputPorts)
.withOutputPorts(operatorInfo.outputPorts)
.withPartitionRequirement(partitionRequirement)
Expand Down

0 comments on commit f2aeb0a

Please sign in to comment.