Uh oh!
There was an error while loading. Please reload this page.
[SPARK-30362][Core] Update InputMetrics in DataSourceRDD - #27021
[SPARK-30362][Core] Update InputMetrics in DataSourceRDD#27021sandeep-katta wants to merge 3 commits into
Conversation
sandeep-katta
commented
Dec 27, 2019
There was a problem hiding this comment.
I'm not sure if we can support this if the data source don't report the size metrics. AFAIK ds v1 doesn't support it either. We only support it in file source.
I think we can only support the "recordsRead" metrics for now. We need to design a general API for data sources to report metrics. cc @rdblue@brkyvz
There was a problem hiding this comment.
if we update only "recordsRead". In the UI "Input Size/Records" column will look like "0/ 10". Is this okay ?
There was a problem hiding this comment.
that's true for DS v1 too, right?
There was a problem hiding this comment.
yes it's true for DS V1 also. Shall we have some marker trait which says Input Size metrics is supported. For e.g. FilePartitionReaderFactory supports Input Size metrics. So that we can collect input size metrics only if it supports .
There was a problem hiding this comment.
yes we should, but then it's an API design and we should involve more people to discuss.
There was a problem hiding this comment.
then shall I update the solution and push, then people can comment on the approach ?
There was a problem hiding this comment.
I'd suggest we send an email to dev list with your proposal to trigger discussion first. AFAIK many people are interested in the metrics API in DS v2.
SparkQA
commented
Dec 27, 2019
Test build #115839 has finished for PR 27021 at commit
|
870ba7d to
1be7a33Comparesandeep-katta
commented
Jan 27, 2020
@rdblue please review this, I have tested the changes from my end. |
SparkQA
commented
Jan 27, 2020
Test build #117431 has finished for PR 27021 at commit
|
1be7a33 to
6c87a41CompareSparkQA
commented
Jan 27, 2020
Test build #117433 has finished for PR 27021 at commit
|
6c87a41 to
df4bff9CompareSparkQA
commented
Jan 27, 2020
Test build #117437 has finished for PR 27021 at commit
|
sandeep-katta
commented
Jan 27, 2020
this is weird :( , I am able to build successfully using mvn but sbt is failing . |
df4bff9 to
5bd4b7bCompareSparkQA
commented
Jan 27, 2020
Test build #117445 has finished for PR 27021 at commit
|
| } | ||
| } | ||
| class MetricsHandler extends Logging with Serializable { |
There was a problem hiding this comment.
Should these new classes be private instead? I don't see a need to expose them.
rdblue
commented
Jan 27, 2020
+1 for this change, with a fix to avoid exposing the new helper classes. To address @cloud-fan's objection, this solution records the amount of data read by Hadoop file systems. We can always expose an additional way for v2 sources to return a size metric if the bytes read by those sources do not go through the Hadoop FileSystem API, but there are many cases that do use the file system API and at least those are supported by this change. Thanks @sandeep-katta! |
SparkQA
commented
Jan 28, 2020
Test build #117465 has finished for PR 27021 at commit
|
sandeep-katta
commented
Jan 28, 2020
retest this please |
SparkQA
commented
Jan 28, 2020
Test build #117478 has finished for PR 27021 at commit
|
| } | ||
| } | ||
| private class MetricsBatchIterator( |
There was a problem hiding this comment.
nit: to be consistent, let's have a MetricsRowIterator, and the base class MetricsIterator doesn't need to implement next
There was a problem hiding this comment.
or the base class can implement next as
protected def numRecords(element: T): Int
override def next(): I = {
val item = iter.next
metricsHandler.updateMetrics(numRecords(item))
item
}
| } | ||
| } | ||
| test("SPARK-30362: test input metrics for DSV2") { |
There was a problem hiding this comment.
to actually test DSV2, let's call withSQLConf in the test and set SQLConf.USE_V1_SOURCE_LIST to empty.
cloud-fan
commented
Jan 30, 2020
OK let's get in this workaround, but we do need to think of a metrics API for DS v2 later. LGTM except a few minor comments. |
SparkQA
commented
Jan 30, 2020
Test build #117569 has finished for PR 27021 at commit
|
cloud-fan
commented
Jan 31, 2020
thanks, merging to master! |
Incase of DS v2 InputMetrics are not updated **Before Fix**  **After Fix** we can see that `Input Size / Records` is updated in the UI  InputMetrics like bytesread and recordread should be updated No Added UT and also verified manually Closesapache#27021 from sandeep-katta/dsv2inputmetrics. Authored-by: sandeep katta <sandeep.katta2007@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> ---- Cherry-pick conflicts: - sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceRDD.scala only import statements, as upstream reorganized packages - sql/core/src/test/scala/org/apache/spark/sql/execution/DataSourceScanExecRedactionSuite.scala The test in original PR sets a SQLConf to empty string that doesnt exist yet. Will need to be reintroduced after pulling from master.
* [SPARK-30362][CORE] Update InputMetrics in DataSourceRDD Incase of DS v2 InputMetrics are not updated **Before Fix**  **After Fix** we can see that `Input Size / Records` is updated in the UI  InputMetrics like bytesread and recordread should be updated No Added UT and also verified manually Closesapache#27021 from sandeep-katta/dsv2inputmetrics. Authored-by: sandeep katta <sandeep.katta2007@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> ---- Cherry-pick conflicts: - sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceRDD.scala only import statements, as upstream reorganized packages - sql/core/src/test/scala/org/apache/spark/sql/execution/DataSourceScanExecRedactionSuite.scala The test in original PR sets a SQLConf to empty string that doesnt exist yet. Will need to be reintroduced after pulling from master. * waitUntilEmpty requires a timeout until 5e92301 Co-authored-by: sandeep katta <sandeep.katta2007@gmail.com>
Incase of DS v2 InputMetrics are not updated **Before Fix**  **After Fix** we can see that `Input Size / Records` is updated in the UI  InputMetrics like bytesread and recordread should be updated No Added UT and also verified manually Closesapache#27021 from sandeep-katta/dsv2inputmetrics. Authored-by: sandeep katta <sandeep.katta2007@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> RB=2618349 BUG=LIHADOOP-57737 G=spark-reviewers R=vsowrira,mshen A=vsowrira
What changes were proposed in this pull request?
Incase of DS v2 InputMetrics are not updated
Before Fix

After Fix we can see that

Input Size / Recordsis updated in the UIWhy are the changes needed?
InputMetrics like bytesread and recordread should be updated
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added UT and also verified manually