lincoln-lil commented on code in PR #23047: URL: https://github.com/apache/flink/pull/23047#discussion_r1271293985
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/common/CommonPhysicalTableSourceScan.scala: ########## @@ -51,9 +52,21 @@ abstract class CommonPhysicalTableSourceScan( } override def explainTerms(pw: RelWriter): RelWriter = { + val version = extractSnapshotVersion() super .explainTerms(pw) .item("fields", getRowType.getFieldNames.asScala.mkString(", ")) .itemIf("hints", RelExplainUtil.hintsToString(getHints), !getHints.isEmpty) + .itemIf("version", version.get, version.isDefined) + } + + private def extractSnapshotVersion(): Option[String] = { + val originTable: CatalogBaseTable = + relOptTable.contextResolvedTable.getTable.asInstanceOf[CatalogBaseTable] + originTable match { + case catalogTable: CatalogTable if catalogTable.getSnapshot.isPresent => + Option(catalogTable.getSnapshot.get().toString) + case _ => Option("") Review Comment: As a second thought, it would be safer to use 'getOrElse' -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org