-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-34234][SQL] Remove TreeNodeException that didn't work #31337
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
Conversation
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #134476 has finished for PR 31337 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #134501 has finished for PR 31337 at commit
|
|
cc @cloud-fan |
| a | ||
| } else { | ||
| BoundReference(ordinal, a.dataType, input(ordinal).nullable) | ||
| sys.error(s"Couldn't find $a in ${input.attrs.mkString("[", ",", "]")}") |
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.
since we are here, let's change it to throw new IllegalStateException, as sys.error exists the JVM.
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.
+1
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.
OK
| * Thrown when an invalid attempt is made to access a property of a tree that has yet to be fully | ||
| * resolved. | ||
| */ | ||
| class UnresolvedException[TreeType <: TreeNode[_]](tree: TreeType, function: String) |
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.
Seems we don't need the tree parameter
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.
OK
|
yea, removing it looks fine. |
| |${sideBySide(plan.treeString, reOptimized.treeString).mkString("\n")} | ||
| """.stripMargin | ||
| throw new TreeNodeException(reOptimized, message, null) | ||
| throw new AnalysisException(message) |
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.
Is this always an analysis exception? Seems to me it is not only for analyzer rule.
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.
For a place like this, should we keep tree node exception?
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.
TreeNodeException makes stacktrace verbose and complicated. Yeah! it was work for analyzer, optimizer and expressions, do we need to create RuleExeception? or you have another idea.
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.
RuntimeException is also fine. It's test-only and most likely people don't care about exception type here.
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.
sounds okay.
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.
OK
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.
sgtm, too.
| } | ||
| } | ||
|
|
||
| protected override def doExecute(): RDD[InternalRow] = attachTree(this, "execute") { |
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.
Removing tree node exception for a place like this looks good to me. The error happened here should not be node tree related.
|
Test build #134975 has finished for PR 31337 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #134976 has finished for PR 31337 at commit
|
|
Kubernetes integration test status success |
|
retest this please |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #135062 has finished for PR 31337 at commit
|
|
Kubernetes integration test starting |
|
Test build #135065 has finished for PR 31337 at commit
|
|
Kubernetes integration test status success |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #135068 has finished for PR 31337 at commit
|
|
cc @cloud-fan |
| /** | ||
| * Functions for attaching and retrieving trees that are associated with errors. | ||
| */ | ||
| package object errors { |
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.
we still need this file?
| a | ||
| } else { | ||
| BoundReference(ordinal, a.dataType, input(ordinal).nullable) | ||
| throw QueryExecutionErrors.cannotFindExpressionInInputAttributesError(a, input) |
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.
nit: previously it's sys.error, which means it's something that shouldn't hit. I think it's also assert-like and we can just use IllegalStateException here.
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.
Yeah. It hears more reasonable.
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
thanks, merging to master! |
|
@cloud-fan Thanks for your work! @maropu @viirya Thanks for your review! |
|
Test build #135088 has finished for PR 31337 at commit
|
|
Test build #135089 has finished for PR 31337 at commit
|
| throw new IllegalStateException( | ||
| s"Couldn't find $a in ${input.attrs.mkString("[", ",", "]")}") |
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.
Is it supposed an internal error, correct? or end users might face to the error on some SQL queries?
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 guess we should use internal error too. At that time, we didn't have this understanding yet.
|
@beliefer @cloud-fan I understand that the intention of this change is to eliminate redundant messages for internal errors that occur during the SparkPlan execution. But I think it makes the error message less useful if something goes wrong in the analyze or optimize phases. For example, I hit an error that happens in the rule the below stacktrace comes from the internal version based on OSS Spark 3.3 |
|
It seems the |
@beliefer, absolutely right, but which node? I expect a sub-plan tree to be printed to narrow the scope from a huge whole plan tree. |
|
so |
|
Got it. I have no idea if it is worth to keep. I think we can print more info for |
What changes were proposed in this pull request?
TreeNodeExceptioncauses the error msg not clear and it didn't work well.Because the
TreeNodeExceptionlooks redundancy, we could remove it.There are show a case:
The above code will use
HashAggregateExec. In order to ensure that an exception will be thrown when executingHashAggregateExec, I addedthrow new RuntimeException("calculate error")intospark/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/HashAggregateExec.scala
Line 85 in 72b7f8a
So, if the above code is executed,
RuntimeException("calculate error")will be thrown.Before this PR, the error is:
After this PR, the error is:
Why are the changes needed?
TreeNodeExceptiondidn't work well.Does this PR introduce any user-facing change?
'No'.
How was this patch tested?
Jenkins test.