-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-41442][SQL] Only update SQLMetric value if merging with valid metric #38969
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
sunchao
left a comment
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.
LGTM
dongjoon-hyun
left a comment
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, LGTM.
|
Thank you @sunchao @dongjoon-hyun ! Pending on CI (not sure if any existing tests depend on current behavior). |
|
Could you re-trigger the failure CI test only? |
|
I can reproduce the failed tests. Trying to fix them. |
| if (rowCount == 0) { | ||
| // For empty relation, the query stage doesn't serialize any bytes. | ||
| // The SQLMetric keeps initial value. | ||
| assert(stats.sizeInBytes == -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.
Nice!
HeartSaVioR
left a comment
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 It totally makes sense.
|
All tests passed. Merged to master. Thank you, @viirya and all! |
|
Thank you! |
| // The exchange doesn't serialize any bytes. | ||
| // The SQLMetric keeps initial value. | ||
| testMetricsInSparkPlanOperator(exchanges(1), | ||
| Map("dataSize" -> -1, "shuffleRecordsWritten" -> 0)) |
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.
what do we show in the SQL UI? printing -1 as the size is a bit weird.
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 -1 will be filtered out.
…metric ### What changes were proposed in this pull request? This patch updates how `SQLMetric` merges two invalid instances where the value is both -1. ### Why are the changes needed? We use -1 as initial value of `SQLMetric`, and change it to 0 while merging with other `SQLMetric` instances. A `SQLMetric` will be treated as invalid and filtered out later. While we are developing with Spark, it is trouble behavior that two invalid `SQLMetric` instances merge to a valid `SQLMetric` because merging will set the value to 0. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests. Closes apache#38969 from viirya/minor_sql_metrics. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
…it's invalid ### What changes were proposed in this pull request? This is a followup of #38969 to fix a regression. SQL UI is not the only way for end users to see the SQL metrics. They can also access the accumulator values in the physical plan programmatically via query execution listener. We should be consistent with the SQL UI and not expose the -1 value. ### Why are the changes needed? make SQL UI and the accumulator value consistent ### Does this PR introduce _any_ user-facing change? Yes, as end users can access accumulator values directly. ### How was this patch tested? existing tests Closes #39311 from cloud-fan/metric. Authored-by: Wenchen Fan <wenchen@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
…metric (apache#1643) ### What changes were proposed in this pull request? This patch updates how `SQLMetric` merges two invalid instances where the value is both -1. ### Why are the changes needed? We use -1 as initial value of `SQLMetric`, and change it to 0 while merging with other `SQLMetric` instances. A `SQLMetric` will be treated as invalid and filtered out later. While we are developing with Spark, it is trouble behavior that two invalid `SQLMetric` instances merge to a valid `SQLMetric` because merging will set the value to 0. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests. Closes apache#38969 from viirya/minor_sql_metrics. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
What changes were proposed in this pull request?
This patch updates how
SQLMetricmerges two invalid instances where the value is both -1.Why are the changes needed?
We use -1 as initial value of
SQLMetric, and change it to 0 while merging with otherSQLMetricinstances. ASQLMetricwill be treated as invalid and filtered out later.While we are developing with Spark, it is trouble behavior that two invalid
SQLMetricinstances merge to a validSQLMetricbecause merging will set the value to 0.Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing tests.