-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Spark 3.5: Fix metrics reporting in distributed planning #8602
Merged
aokolnychyi
merged 1 commit into
apache:master
from
aokolnychyi:fix-filtered-files-count-dist-planning
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
core/src/test/java/org/apache/iceberg/TestLocalScanPlanningAndReporting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.iceberg; | ||
|
||
public class TestLocalScanPlanningAndReporting | ||
extends ScanPlanningAndReportingTestBase<TableScan, FileScanTask, CombinedScanTask> { | ||
|
||
@Override | ||
protected TableScan newScan(Table table) { | ||
return table.newScan(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
spark/v3.5/spark/src/test/java/org/apache/iceberg/TestSparkDistributedDataScanReporting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.iceberg; | ||
|
||
import static org.apache.iceberg.PlanningMode.DISTRIBUTED; | ||
import static org.apache.iceberg.PlanningMode.LOCAL; | ||
|
||
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; | ||
import org.apache.iceberg.spark.SparkReadConf; | ||
import org.apache.spark.sql.SparkSession; | ||
import org.apache.spark.sql.internal.SQLConf; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
@RunWith(Parameterized.class) | ||
public class TestSparkDistributedDataScanReporting | ||
extends ScanPlanningAndReportingTestBase<BatchScan, ScanTask, ScanTaskGroup<ScanTask>> { | ||
|
||
@Parameterized.Parameters(name = "dataMode = {0}, deleteMode = {1}") | ||
public static Object[] parameters() { | ||
return new Object[][] { | ||
new Object[] {LOCAL, LOCAL}, | ||
new Object[] {LOCAL, DISTRIBUTED}, | ||
new Object[] {DISTRIBUTED, LOCAL}, | ||
new Object[] {DISTRIBUTED, DISTRIBUTED} | ||
}; | ||
} | ||
|
||
private static SparkSession spark = null; | ||
|
||
private final PlanningMode dataMode; | ||
private final PlanningMode deleteMode; | ||
|
||
public TestSparkDistributedDataScanReporting( | ||
PlanningMode dataPlanningMode, PlanningMode deletePlanningMode) { | ||
this.dataMode = dataPlanningMode; | ||
this.deleteMode = deletePlanningMode; | ||
} | ||
|
||
@BeforeClass | ||
public static void startSpark() { | ||
TestSparkDistributedDataScanReporting.spark = | ||
SparkSession.builder() | ||
.master("local[2]") | ||
.config("spark.serializer", "org.apache.spark.serializer.KryoSerializer") | ||
.config(SQLConf.SHUFFLE_PARTITIONS().key(), "4") | ||
.getOrCreate(); | ||
} | ||
|
||
@AfterClass | ||
public static void stopSpark() { | ||
SparkSession currentSpark = TestSparkDistributedDataScanReporting.spark; | ||
TestSparkDistributedDataScanReporting.spark = null; | ||
currentSpark.stop(); | ||
} | ||
|
||
@Override | ||
protected BatchScan newScan(Table table) { | ||
table | ||
.updateProperties() | ||
.set(TableProperties.DATA_PLANNING_MODE, dataMode.modeName()) | ||
.set(TableProperties.DELETE_PLANNING_MODE, deleteMode.modeName()) | ||
.commit(); | ||
SparkReadConf readConf = new SparkReadConf(spark, table, ImmutableMap.of()); | ||
return new SparkDistributedDataScan(spark, table, readConf); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The simplest approach is to just expose the reporter with package-private access.
We could have an interface called
HasMetricsReporter
, similar toHasTableOperations
. It will be a bit more generic but it is not required for this PR. Let me know.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.
this should be fine. In fact, I'm making it public in https://github.com/apache/iceberg/pull/8032/files#diff-725c9531623b4e47248f10a8caac9b18ead6906101efdf7e8c14c6363b3b6d59R267
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.
Oh, good to know!