-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add logging to explain reasons for Comet not being able to run a query stage natively #397
Changes from 9 commits
19472ed
07c7784
7becda1
26cbb1c
4f2c26c
14d95f1
5c21783
eb9c21c
22409f4
8e800ec
b8566fe
bf87ff7
0dee9c7
78043bd
af39640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -734,6 +734,22 @@ class CometSparkSessionExtensions | |
} else { | ||
var newPlan = transform(plan) | ||
|
||
// if the plan cannot be run natively then explain why (when appropriate config is enabled) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that ExecRule is going to be invoked multiple times as planning proceeds, this may get logged multiple times for the same plan. Perhaps that is why we need to keep this configurable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is one reason, yes. The logging could get verbose. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would assume that this feature is useful in development but less so in production since we have the integration with Spark's explain for that. |
||
if (CometConf.COMET_EXPLAIN_FALLBACK_ENABLED.get() && !isCometNative(newPlan)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comet could only trigger native execution for partial query plan. This check |
||
new ExtendedExplainInfo().extensionInfo(newPlan) match { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated, but I feel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I had the same thought There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is possible that it has to be a class due to the way this integrates into Spark, but I am not sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just seeing this. I don't think Spark prevents us from this being an object. I'll take care of this. #452 |
||
case reasons if reasons.isEmpty => | ||
logWarning( | ||
"Comet cannot execute this plan natively, but no reason is given. " + | ||
"This is likely a bug.") | ||
case reasons if reasons.size == 1 => | ||
logWarning(s"Comet cannot execute this plan natively because ${reasons.head}") | ||
case reasons => | ||
logWarning( | ||
"Comet cannot execute this plan natively because:\n\t- " + | ||
s"${reasons.mkString("\n\t- ")}") | ||
} | ||
} | ||
|
||
// Remove placeholders | ||
newPlan = newPlan.transform { | ||
case CometSinkPlaceHolder(_, _, s) => s | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ class ExtendedExplainInfo extends ExtendedExplainGenerator { | |
} | ||
} | ||
|
||
private def extensionInfo(node: TreeNode[_]): Set[String] = { | ||
def extensionInfo(node: TreeNode[_]): Set[String] = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I made that change. |
||
var info = mutable.Seq[String]() | ||
val sorted = sortup(node) | ||
sorted.foreach { p => | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to make this configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a config should be good. Sometimes it might be verbose.