Skip to content

Commit

Permalink
Profiling tool : Update readSchema string parser
Browse files Browse the repository at this point in the history
Signed-off-by: Niranjan Artal <[email protected]>
  • Loading branch information
nartal1 committed Oct 27, 2023
1 parent c3d34df commit 7c7afc0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ abstract class AppBase(
}
}

private def trimSchema(str: String): String = {
val index = str.lastIndexOf(",")
if (index != -1 && str.contains("...")) {
str.substring(0, index)
} else {
str
}
}

// The ReadSchema metadata is only in the eventlog for DataSource V1 readers
protected def checkMetadataForReadSchema(sqlID: Long, planInfo: SparkPlanInfo): Unit = {
// check if planInfo has ReadSchema
Expand All @@ -284,7 +293,7 @@ abstract class AppBase(
val readSchema = ReadParser.formatSchemaStr(meta.getOrElse("ReadSchema", ""))
val scanNode = allNodes.filter(node => {
// Get ReadSchema of each Node and sanitize it for comparison
val trimmedNode = ReadParser.parseReadNode(node).schema.replace("...", "")
val trimmedNode = trimSchema(ReadParser.parseReadNode(node).schema)
readSchema.contains(trimmedNode)
}).filter(x => x.name.startsWith("Scan")).head

Expand Down

0 comments on commit 7c7afc0

Please sign in to comment.