holdenk commented on code in PR #55145:
URL: https://github.com/apache/spark/pull/55145#discussion_r3262684818
##########
sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/graph/SystemMetadata.scala:
##########
@@ -37,32 +37,33 @@ case class FlowSystemMetadata(
) extends SystemMetadata with Logging {
/**
- * Returns the checkpoint root directory for a given flow
- * which is storage/_checkpoints/flow_destination_table/flow_name.
- * @return the checkpoint root directory for `flow`
+ * @return the checkpoint root directory for this flow
+ * (of the form
storage/_checkpoints/flow_destination_table/flow_name)
+ * @throws IllegalArgumentException when the flow's destination is neither a
table nor sink
*/
- def flowCheckpointsDirOpt(): Option[Path] = {
- Option(if (graph.table.contains(flow.destinationIdentifier) ||
- graph.sink.contains(flow.destinationIdentifier)) {
- val checkpointRoot = new Path(context.storageRoot, "_checkpoints")
- // Different tables in the pipeline can have flows with the same name,
so we include
- // the table's fully qualified identifier in the path to avoid
collisions.
- val flowTableId = tableIdentifierToPathString(flow.destinationIdentifier)
- val flowName = flow.identifier.table
- val checkpointDir = new Path(
- new Path(checkpointRoot, flowTableId),
- flowName
- )
- logInfo(
- log"Flow ${MDC(LogKeys.FLOW_NAME, flowName)} using checkpoint " +
- log"directory: ${MDC(LogKeys.CHECKPOINT_PATH, checkpointDir)}"
- )
- checkpointDir
- } else {
+ def flowCheckpointsDir(): Path = {
+ def isTableOrSink(destination: TableIdentifier): Boolean = {
+ graph.table.contains(destination) || graph.sink.contains(destination)
+ }
Review Comment:
nit: This is weird to have as a function, I would rather have the if check
in-line
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]