Skip to content

Commit

Permalink
[VL] Add query id to fall-back log (#3919)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhli1142015 authored Dec 5, 2023
1 parent 144df96 commit dfb985c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ case class GlutenFallbackReporter(glutenConfig: GlutenConfig, spark: SparkSessio
}

private def logFallbackReason(logLevel: String, nodeName: String, reason: String): Unit = {
logOnLevel(logLevel, s"Validation failed for plan: $nodeName, due to: $reason.")
val executionIdInfo = Option(spark.sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY))
.map(id => s"[QueryId=$id]")
.getOrElse("")
logOnLevel(logLevel, s"Validation failed for plan: $nodeName$executionIdInfo, due to: $reason.")
}

private def printFallbackReason(plan: SparkPlan): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ class GlutenFallbackSuite extends GlutenSQLTestsTrait {
sql("SELECT * FROM t").collect()
}
}
assert(
testAppender.loggingEvents.exists(
_.getMessage.getFormattedMessage.contains(
"Validation failed for plan: Scan parquet default.t, " +
"due to: columnar FileScan is not enabled in FileSourceScanExec")))
val msgRegex = """Validation failed for plan: Scan parquet default\.t\[QueryId=[0-9]+\],""" +
""" due to: columnar FileScan is not enabled in FileSourceScanExec\."""
assert(testAppender.loggingEvents.exists(_.getMessage.getFormattedMessage.matches(msgRegex)))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ class GlutenFallbackSuite extends GlutenSQLTestsTrait {
sql("SELECT * FROM t").collect()
}
}
assert(
testAppender.loggingEvents.exists(
_.getMessage.getFormattedMessage.contains(
"Validation failed for plan: Scan parquet default.t, " +
"due to: columnar FileScan is not enabled in FileSourceScanExec")))
val msgRegex = """Validation failed for plan: Scan parquet default\.t\[QueryId=[0-9]+\],""" +
""" due to: columnar FileScan is not enabled in FileSourceScanExec\."""
assert(testAppender.loggingEvents.exists(_.getMessage.getFormattedMessage.matches(msgRegex)))
}
}

Expand Down

0 comments on commit dfb985c

Please sign in to comment.