rdblue commented on a change in pull request #3863:
URL: https://github.com/apache/iceberg/pull/3863#discussion_r780840320
##########
File path:
spark/v3.0/spark/src/test/java/org/apache/iceberg/spark/SparkTestBase.java
##########
@@ -199,6 +205,36 @@ protected void withSQLConf(Map<String, String> conf,
Action action) {
}
}
+ private Set<SQLExecutionUIData> currentExecutionUIDataSet() throws
TimeoutException {
+ spark.sparkContext().listenerBus().waitUntilEmpty(10000);
+ return
Sets.newHashSet(JavaConverters.seqAsJavaList(spark.sharedState().statusStore().executionsList()));
+ }
+
+ protected void checkMetrics(Callable sparkCallable, Map<String, String>
expectedMetrics) throws Exception {
+ Set<SQLExecutionUIData> originalExecutions = currentExecutionUIDataSet();
+ sparkCallable.call();
+ Set<SQLExecutionUIData> currentExecutions = currentExecutionUIDataSet();
+ currentExecutions.removeAll(originalExecutions);
+ Assert.assertEquals(currentExecutions.size(), 1);
+ SQLExecutionUIData currentExecution =
currentExecutions.stream().findFirst().get();
+
+ Map<Long, String> metricsIds = Maps.newHashMap();
+
JavaConverters.seqAsJavaList(currentExecution.metrics()).stream().forEach(metricsDeclaration
-> {
+ if (expectedMetrics.containsKey(metricsDeclaration.name())) {
+ metricsIds.put(metricsDeclaration.accumulatorId(),
metricsDeclaration.name());
+ }
+ });
+ Assert.assertEquals("Expected metric name not match",
+ expectedMetrics.keySet(), Sets.newHashSet(metricsIds.values()));
+
+ Map<Object, String> currentMetrics =
+
JavaConverters.mapAsJavaMap(spark.sharedState().statusStore().executionMetrics(currentExecution.executionId()))
+ .entrySet().stream()
+ .filter(x -> metricsIds.containsKey(x.getKey()))
+ .collect(Collectors.toMap(x -> metricsIds.get(x.getKey()), x ->
x.getValue()));
Review comment:
Style: indentation is 4 spaces (2 indents) for continuation indent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]