You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "hemasrishalini (via GitHub)" <gi...@apache.org> on 2026/06/07 18:13:43 UTC
[PR] Add test coverage for MetricsRecordConverter [polaris]
hemasrishalini opened a new pull request, #4636:
URL: https://github.com/apache/polaris/pull/4636
## Summary
Adds direct unit test coverage for `MetricsRecordConverter`.
### Changes
* Add `testScanReportConversion()` to verify conversion from `ScanReport` to `ScanMetricsRecord`
* Add `testCommitReportConversion()` to verify conversion from `CommitReport` to `CommitMetricsRecord`
* Verify key mapped fields including:
* catalog ID
* table ID
* snapshot ID
* schema ID
* filter expression
* sequence number
* operation type
### Testing
Ran:
```bash
./gradlew :polaris-core:test --tests "*MetricsRecordConverterTest"
```
and verified the tests pass successfully.
## Checklist
* [x] ๐งช Added/updated tests with good coverage, or manually tested (and explained how)
* [ ] ๐งพ Updated CHANGELOG.md (not needed - test-only change)
* [ ] ๐ Updated documentation (not needed - test-only change)
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add test coverage for MetricsRecordConverter [polaris]
Posted by "hemasrishalini (via GitHub)" <gi...@apache.org>.
hemasrishalini commented on PR #4636:
URL: https://github.com/apache/polaris/pull/4636#issuecomment-4657031044
Thanks for the review!
My thinking was that `MetricsRecordConverterTest` provides direct unit test coverage for the conversion logic itself, independent of `PersistingMetricsReporter`, while `PersistingMetricsReporterTest` verifies reporter behavior and persistence interactions.
That said, I can see the overlap with the existing reporter tests. If you'd prefer keeping this coverage in `PersistingMetricsReporterTest` instead, I'm happy to move the assertions there.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add test coverage for MetricsRecordConverter [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4636:
URL: https://github.com/apache/polaris/pull/4636#discussion_r3376100754
##########
polaris-core/src/test/java/org/apache/polaris/core/metrics/iceberg/MetricsRecordConverterTest.java:
##########
@@ -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.polaris.core.metrics.iceberg;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.apache.iceberg.expressions.Expressions;
+import org.apache.iceberg.metrics.CommitMetrics;
+import org.apache.iceberg.metrics.CommitMetricsResult;
+import org.apache.iceberg.metrics.CommitReport;
+import org.apache.iceberg.metrics.ImmutableCommitReport;
+import org.apache.iceberg.metrics.ImmutableScanReport;
+import org.apache.iceberg.metrics.ScanMetrics;
+import org.apache.iceberg.metrics.ScanMetricsResult;
+import org.apache.iceberg.metrics.ScanReport;
+import org.apache.polaris.core.persistence.metrics.CommitMetricsRecord;
+import org.apache.polaris.core.persistence.metrics.ScanMetricsRecord;
+import org.junit.jupiter.api.Test;
+
+class MetricsRecordConverterTest {
+
+ @Test
+ void testScanReportConversion() {
+ ScanReport scanReport =
+ ImmutableScanReport.builder()
+ .tableName("db.schema.test_table")
+ .snapshotId(123456789L)
+ .schemaId(1)
+ .filter(Expressions.alwaysTrue())
+ .scanMetrics(ScanMetricsResult.fromScanMetrics(ScanMetrics.noop()))
+ .build();
+
+ ScanMetricsRecord record =
+ MetricsRecordConverter.forScanReport(scanReport).catalogId(100L).tableId(200L).build();
+
+ assertThat(record.catalogId()).isEqualTo(100L);
Review Comment:
Some of the coverage appears to duplicate `PersistingMetricsReporterTest` ๐ค
Would it make sense to enhance `PersistingMetricsReporterTest` instead of adding a new test?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add test coverage for MetricsRecordConverter [polaris]
Posted by "hemasrishalini (via GitHub)" <gi...@apache.org>.
hemasrishalini commented on code in PR #4636:
URL: https://github.com/apache/polaris/pull/4636#discussion_r3407563705
##########
polaris-core/src/test/java/org/apache/polaris/core/metrics/iceberg/MetricsRecordConverterTest.java:
##########
@@ -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.polaris.core.metrics.iceberg;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.apache.iceberg.expressions.Expressions;
+import org.apache.iceberg.metrics.CommitMetrics;
+import org.apache.iceberg.metrics.CommitMetricsResult;
+import org.apache.iceberg.metrics.CommitReport;
+import org.apache.iceberg.metrics.ImmutableCommitReport;
+import org.apache.iceberg.metrics.ImmutableScanReport;
+import org.apache.iceberg.metrics.ScanMetrics;
+import org.apache.iceberg.metrics.ScanMetricsResult;
+import org.apache.iceberg.metrics.ScanReport;
+import org.apache.polaris.core.persistence.metrics.CommitMetricsRecord;
+import org.apache.polaris.core.persistence.metrics.ScanMetricsRecord;
+import org.junit.jupiter.api.Test;
+
+class MetricsRecordConverterTest {
+
+ @Test
+ void testScanReportConversion() {
+ ScanReport scanReport =
+ ImmutableScanReport.builder()
+ .tableName("db.schema.test_table")
+ .snapshotId(123456789L)
+ .schemaId(1)
+ .filter(Expressions.alwaysTrue())
+ .scanMetrics(ScanMetricsResult.fromScanMetrics(ScanMetrics.noop()))
+ .build();
+
+ ScanMetricsRecord record =
+ MetricsRecordConverter.forScanReport(scanReport).catalogId(100L).tableId(200L).build();
+
+ assertThat(record.catalogId()).isEqualTo(100L);
Review Comment:
Thanks for the review!
My thinking was that MetricsRecordConverterTest provides direct unit test coverage for the conversion logic itself, independent of PersistingMetricsReporter, while PersistingMetricsReporterTest verifies reporter behavior and persistence interactions.
That said, I can see the overlap with the existing reporter tests. If you'd prefer keeping this coverage in PersistingMetricsReporterTest instead, I'm happy to move the assertions there.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add test coverage for MetricsRecordConverter [polaris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4636: Add test coverage for MetricsRecordConverter
URL: https://github.com/apache/polaris/pull/4636
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add test coverage for MetricsRecordConverter [polaris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4636:
URL: https://github.com/apache/polaris/pull/4636#issuecomment-4964747618
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org