diff --git a/core/src/main/java/org/apache/iceberg/BaseTable.java b/core/src/main/java/org/apache/iceberg/BaseTable.java index 23299a962ce5..89aac72da43d 100644 --- a/core/src/main/java/org/apache/iceberg/BaseTable.java +++ b/core/src/main/java/org/apache/iceberg/BaseTable.java @@ -27,6 +27,7 @@ import org.apache.iceberg.io.LocationProvider; import org.apache.iceberg.metrics.LoggingMetricsReporter; import org.apache.iceberg.metrics.MetricsReporter; +import org.apache.iceberg.metrics.MetricsReporters; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; /** @@ -41,7 +42,7 @@ public class BaseTable implements Table, HasTableOperations, Serializable { private final TableOperations ops; private final String name; - private final MetricsReporter reporter; + private MetricsReporter reporter; public BaseTable(TableOperations ops, String name) { this(ops, name, LoggingMetricsReporter.instance()); @@ -58,6 +59,10 @@ public MetricsReporter reporter() { return reporter; } + public void combineMetricsReporter(MetricsReporter metricsReporter) { + this.reporter = MetricsReporters.combine(this.reporter, metricsReporter); + } + @Override public TableOperations operations() { return ops; diff --git a/core/src/main/java/org/apache/iceberg/metrics/InMemoryMetricsReporter.java b/core/src/main/java/org/apache/iceberg/metrics/InMemoryMetricsReporter.java index 79b446c0ddbf..1d130c2d7dca 100644 --- a/core/src/main/java/org/apache/iceberg/metrics/InMemoryMetricsReporter.java +++ b/core/src/main/java/org/apache/iceberg/metrics/InMemoryMetricsReporter.java @@ -18,6 +18,7 @@ */ package org.apache.iceberg.metrics; +import javax.annotation.Nullable; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; public class InMemoryMetricsReporter implements MetricsReporter { @@ -35,4 +36,13 @@ public ScanReport scanReport() { "Metrics report is not a scan report"); return (ScanReport) metricsReport; } + + @Nullable + public CommitReport commitReport() { + if (metricsReport instanceof CommitReport) { + return (CommitReport) metricsReport; + } else { + return null; + } + } } diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkWriteUtil.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkWriteUtil.java index 0d68a0d8cdd0..82ba142859be 100644 --- a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkWriteUtil.java +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkWriteUtil.java @@ -23,10 +23,38 @@ import static org.apache.spark.sql.connector.write.RowLevelOperation.Command.UPDATE; import java.util.Arrays; +import java.util.List; import org.apache.iceberg.DistributionMode; import org.apache.iceberg.MetadataColumns; import org.apache.iceberg.Table; +import org.apache.iceberg.metrics.CommitMetricsResult; +import org.apache.iceberg.metrics.CommitReport; +import org.apache.iceberg.metrics.CounterResult; +import org.apache.iceberg.metrics.InMemoryMetricsReporter; +import org.apache.iceberg.relocated.com.google.common.collect.Lists; import org.apache.iceberg.relocated.com.google.common.collect.ObjectArrays; +import org.apache.iceberg.spark.source.metrics.AddedDataFiles; +import org.apache.iceberg.spark.source.metrics.AddedDeleteFiles; +import org.apache.iceberg.spark.source.metrics.AddedEqualityDeleteFiles; +import org.apache.iceberg.spark.source.metrics.AddedEqualityDeletes; +import org.apache.iceberg.spark.source.metrics.AddedFileSizeInBytes; +import org.apache.iceberg.spark.source.metrics.AddedPositionalDeleteFiles; +import org.apache.iceberg.spark.source.metrics.AddedPositionalDeletes; +import org.apache.iceberg.spark.source.metrics.AddedRecords; +import org.apache.iceberg.spark.source.metrics.RemovedDataFiles; +import org.apache.iceberg.spark.source.metrics.RemovedDeleteFiles; +import org.apache.iceberg.spark.source.metrics.RemovedEqualityDeleteFiles; +import org.apache.iceberg.spark.source.metrics.RemovedEqualityDeletes; +import org.apache.iceberg.spark.source.metrics.RemovedFileSizeInBytes; +import org.apache.iceberg.spark.source.metrics.RemovedPositionalDeleteFiles; +import org.apache.iceberg.spark.source.metrics.RemovedPositionalDeletes; +import org.apache.iceberg.spark.source.metrics.RemovedRecords; +import org.apache.iceberg.spark.source.metrics.TotalDataFiles; +import org.apache.iceberg.spark.source.metrics.TotalDeleteFiles; +import org.apache.iceberg.spark.source.metrics.TotalEqualityDeletes; +import org.apache.iceberg.spark.source.metrics.TotalFileSizeInBytes; +import org.apache.iceberg.spark.source.metrics.TotalPositionalDeletes; +import org.apache.iceberg.spark.source.metrics.TotalRecords; import org.apache.iceberg.types.Types; import org.apache.iceberg.util.SortOrderUtil; import org.apache.spark.sql.connector.distributions.Distribution; @@ -36,6 +64,8 @@ import org.apache.spark.sql.connector.expressions.NamedReference; import org.apache.spark.sql.connector.expressions.SortDirection; import org.apache.spark.sql.connector.expressions.SortOrder; +import org.apache.spark.sql.connector.metric.CustomMetric; +import org.apache.spark.sql.connector.metric.CustomTaskMetric; import org.apache.spark.sql.connector.write.RowLevelOperation.Command; /** @@ -256,4 +286,101 @@ private static SortOrder[] orderBy(Expression... exprs) { private static SortOrder sort(Expression expr) { return Expressions.sort(expr, SortDirection.ASCENDING); } + + public static CustomMetric[] supportedCustomMetrics() { + return new CustomMetric[] { + new AddedDataFiles(), + new AddedDeleteFiles(), + new AddedEqualityDeletes(), + new AddedEqualityDeleteFiles(), + new AddedFileSizeInBytes(), + new AddedPositionalDeletes(), + new AddedPositionalDeleteFiles(), + new AddedRecords(), + new RemovedDataFiles(), + new RemovedDeleteFiles(), + new RemovedRecords(), + new RemovedEqualityDeleteFiles(), + new RemovedEqualityDeletes(), + new RemovedFileSizeInBytes(), + new RemovedPositionalDeleteFiles(), + new RemovedPositionalDeletes(), + new TotalDataFiles(), + new TotalDeleteFiles(), + new TotalEqualityDeletes(), + new TotalFileSizeInBytes(), + new TotalPositionalDeletes(), + new TotalRecords() + }; + } + + public static CustomTaskMetric[] customTaskMetrics(InMemoryMetricsReporter metricsReporter) { + List taskMetrics = Lists.newArrayList(); + if (metricsReporter != null) { + CommitReport commitReport = metricsReporter.commitReport(); + if (commitReport != null) { + CommitMetricsResult metricsResult = commitReport.commitMetrics(); + addMetricValue(new AddedDataFiles(), metricsResult.addedDataFiles(), taskMetrics); + addMetricValue(new AddedDeleteFiles(), metricsResult.addedDeleteFiles(), taskMetrics); + addMetricValue( + new AddedEqualityDeletes(), metricsResult.addedEqualityDeletes(), taskMetrics); + addMetricValue( + new AddedEqualityDeleteFiles(), metricsResult.addedEqualityDeleteFiles(), taskMetrics); + addMetricValue( + new AddedFileSizeInBytes(), metricsResult.addedFilesSizeInBytes(), taskMetrics); + addMetricValue( + new AddedPositionalDeletes(), metricsResult.addedPositionalDeletes(), taskMetrics); + addMetricValue( + new AddedPositionalDeleteFiles(), + metricsResult.addedPositionalDeleteFiles(), + taskMetrics); + addMetricValue(new AddedRecords(), metricsResult.addedRecords(), taskMetrics); + addMetricValue(new RemovedDataFiles(), metricsResult.removedDataFiles(), taskMetrics); + addMetricValue(new RemovedDeleteFiles(), metricsResult.removedDeleteFiles(), taskMetrics); + addMetricValue(new RemovedRecords(), metricsResult.removedRecords(), taskMetrics); + addMetricValue( + new RemovedEqualityDeleteFiles(), + metricsResult.removedEqualityDeleteFiles(), + taskMetrics); + addMetricValue( + new RemovedEqualityDeletes(), metricsResult.removedEqualityDeletes(), taskMetrics); + addMetricValue( + new RemovedFileSizeInBytes(), metricsResult.removedFilesSizeInBytes(), taskMetrics); + addMetricValue( + new RemovedPositionalDeleteFiles(), + metricsResult.removedPositionalDeleteFiles(), + taskMetrics); + addMetricValue( + new RemovedPositionalDeletes(), metricsResult.removedPositionalDeletes(), taskMetrics); + addMetricValue(new TotalDataFiles(), metricsResult.totalDataFiles(), taskMetrics); + addMetricValue(new TotalDeleteFiles(), metricsResult.totalDeleteFiles(), taskMetrics); + addMetricValue( + new TotalEqualityDeletes(), metricsResult.totalEqualityDeletes(), taskMetrics); + addMetricValue( + new TotalFileSizeInBytes(), metricsResult.totalFilesSizeInBytes(), taskMetrics); + addMetricValue( + new TotalPositionalDeletes(), metricsResult.totalPositionalDeletes(), taskMetrics); + addMetricValue(new TotalRecords(), metricsResult.totalRecords(), taskMetrics); + } + } + return taskMetrics.toArray(new CustomTaskMetric[0]); + } + + private static void addMetricValue( + CustomMetric metric, CounterResult result, List taskMetrics) { + if (result != null) { + taskMetrics.add( + new CustomTaskMetric() { + @Override + public String name() { + return metric.name(); + } + + @Override + public long value() { + return result.value(); + } + }); + } + } } diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java index d072397dc6a3..a1cb31bd3720 100644 --- a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java @@ -30,6 +30,7 @@ import java.util.Locale; import java.util.Map; import java.util.function.Function; +import org.apache.iceberg.BaseTable; import org.apache.iceberg.ContentFile; import org.apache.iceberg.DataFile; import org.apache.iceberg.DeleteFile; @@ -66,12 +67,14 @@ import org.apache.iceberg.io.PartitioningWriter; import org.apache.iceberg.io.PositionDeltaWriter; import org.apache.iceberg.io.WriteResult; +import org.apache.iceberg.metrics.InMemoryMetricsReporter; import org.apache.iceberg.relocated.com.google.common.collect.Lists; import org.apache.iceberg.relocated.com.google.common.collect.Maps; import org.apache.iceberg.spark.CommitMetadata; import org.apache.iceberg.spark.SparkSchemaUtil; import org.apache.iceberg.spark.SparkWriteConf; import org.apache.iceberg.spark.SparkWriteRequirements; +import org.apache.iceberg.spark.SparkWriteUtil; import org.apache.iceberg.types.Types; import org.apache.iceberg.util.CharSequenceSet; import org.apache.iceberg.util.DeleteFileSet; @@ -83,6 +86,8 @@ import org.apache.spark.sql.catalyst.expressions.JoinedRow; import org.apache.spark.sql.connector.distributions.Distribution; import org.apache.spark.sql.connector.expressions.SortOrder; +import org.apache.spark.sql.connector.metric.CustomMetric; +import org.apache.spark.sql.connector.metric.CustomTaskMetric; import org.apache.spark.sql.connector.write.DeltaBatchWrite; import org.apache.spark.sql.connector.write.DeltaWrite; import org.apache.spark.sql.connector.write.DeltaWriter; @@ -116,6 +121,7 @@ class SparkPositionDeltaWrite implements DeltaWrite, RequiresDistributionAndOrde private final Map writeProperties; private boolean cleanupOnAbort = false; + private InMemoryMetricsReporter metricsReporter; SparkPositionDeltaWrite( SparkSession spark, @@ -139,6 +145,11 @@ class SparkPositionDeltaWrite implements DeltaWrite, RequiresDistributionAndOrde this.writeRequirements = writeConf.positionDeltaRequirements(command); this.context = new Context(dataSchema, writeConf, info, writeRequirements); this.writeProperties = writeConf.writeProperties(); + + if (this.table instanceof BaseTable) { + this.metricsReporter = new InMemoryMetricsReporter(); + ((BaseTable) this.table).combineMetricsReporter(metricsReporter); + } } @Override @@ -172,6 +183,16 @@ public DeltaBatchWrite toBatch() { return new PositionDeltaBatchWrite(); } + @Override + public CustomMetric[] supportedCustomMetrics() { + return SparkWriteUtil.supportedCustomMetrics(); + } + + @Override + public CustomTaskMetric[] reportDriverMetrics() { + return SparkWriteUtil.customTaskMetrics(metricsReporter); + } + private class PositionDeltaBatchWrite implements DeltaBatchWrite { @Override diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java index c9a94090ef89..3b37a7806dbe 100644 --- a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java @@ -29,6 +29,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.apache.iceberg.AppendFiles; +import org.apache.iceberg.BaseTable; import org.apache.iceberg.DataFile; import org.apache.iceberg.FileFormat; import org.apache.iceberg.FileScanTask; @@ -53,12 +54,14 @@ import org.apache.iceberg.io.OutputFileFactory; import org.apache.iceberg.io.PartitioningWriter; import org.apache.iceberg.io.RollingDataWriter; +import org.apache.iceberg.metrics.InMemoryMetricsReporter; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; import org.apache.iceberg.relocated.com.google.common.collect.Lists; import org.apache.iceberg.spark.CommitMetadata; import org.apache.iceberg.spark.FileRewriteCoordinator; import org.apache.iceberg.spark.SparkWriteConf; import org.apache.iceberg.spark.SparkWriteRequirements; +import org.apache.iceberg.spark.SparkWriteUtil; import org.apache.iceberg.util.ContentFileUtil; import org.apache.iceberg.util.DataFileSet; import org.apache.iceberg.util.DeleteFileSet; @@ -72,6 +75,7 @@ import org.apache.spark.sql.catalyst.expressions.JoinedRow; import org.apache.spark.sql.connector.distributions.Distribution; import org.apache.spark.sql.connector.expressions.SortOrder; +import org.apache.spark.sql.connector.metric.CustomTaskMetric; import org.apache.spark.sql.connector.write.BatchWrite; import org.apache.spark.sql.connector.write.DataWriter; import org.apache.spark.sql.connector.write.DataWriterFactory; @@ -108,6 +112,7 @@ abstract class SparkWrite implements Write, RequiresDistributionAndOrdering { private final Map writeProperties; private boolean cleanupOnAbort = false; + private InMemoryMetricsReporter metricsReporter; SparkWrite( SparkSession spark, @@ -135,6 +140,11 @@ abstract class SparkWrite implements Write, RequiresDistributionAndOrdering { this.writeRequirements = writeRequirements; this.outputSpecId = writeConf.outputSpecId(); this.writeProperties = writeConf.writeProperties(); + + if (this.table instanceof BaseTable) { + this.metricsReporter = new InMemoryMetricsReporter(); + ((BaseTable) this.table).combineMetricsReporter(metricsReporter); + } } @Override @@ -265,6 +275,11 @@ private DataFileSet files(WriterCommitMessage[] messages) { return files; } + @Override + public CustomTaskMetric[] reportDriverMetrics() { + return SparkWriteUtil.customTaskMetrics(metricsReporter); + } + @Override public String toString() { return String.format("IcebergWrite(table=%s, format=%s)", table, format); diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWriteBuilder.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWriteBuilder.java index 89af7740d988..b47703ac7e4b 100644 --- a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWriteBuilder.java +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWriteBuilder.java @@ -32,8 +32,10 @@ import org.apache.iceberg.spark.SparkUtil; import org.apache.iceberg.spark.SparkWriteConf; import org.apache.iceberg.spark.SparkWriteRequirements; +import org.apache.iceberg.spark.SparkWriteUtil; import org.apache.iceberg.types.TypeUtil; import org.apache.spark.sql.SparkSession; +import org.apache.spark.sql.connector.metric.CustomMetric; import org.apache.spark.sql.connector.read.Scan; import org.apache.spark.sql.connector.write.BatchWrite; import org.apache.spark.sql.connector.write.LogicalWriteInfo; @@ -186,6 +188,11 @@ public StreamingWrite toStreaming() { return asStreamingAppend(); } } + + @Override + public CustomMetric[] supportedCustomMetrics() { + return SparkWriteUtil.supportedCustomMetrics(); + } }; } diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedDataFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedDataFiles.java new file mode 100644 index 000000000000..6d8c72bb0e95 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedDataFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedDataFiles extends CustomSumMetric { + + static final String NAME = "addedDataFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added data files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedDeleteFiles.java new file mode 100644 index 000000000000..727eb0042ca2 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedDeleteFiles extends CustomSumMetric { + + static final String NAME = "addedDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedEqualityDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedEqualityDeleteFiles.java new file mode 100644 index 000000000000..442f60365443 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedEqualityDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedEqualityDeleteFiles extends CustomSumMetric { + + static final String NAME = "addedEqualityDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added equality delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedEqualityDeletes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedEqualityDeletes.java new file mode 100644 index 000000000000..4723176c88f7 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedEqualityDeletes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedEqualityDeletes extends CustomSumMetric { + + static final String NAME = "addedEqualityDeletes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added equality deletes"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedFileSizeInBytes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedFileSizeInBytes.java new file mode 100644 index 000000000000..06353ea80f13 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedFileSizeInBytes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedFileSizeInBytes extends CustomSumMetric { + + static final String NAME = "addedFileSizeInBytes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added file size (bytes)"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedPositionalDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedPositionalDeleteFiles.java new file mode 100644 index 000000000000..93ea3acde925 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedPositionalDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedPositionalDeleteFiles extends CustomSumMetric { + + static final String NAME = "addedPositionalDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added positional delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedPositionalDeletes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedPositionalDeletes.java new file mode 100644 index 000000000000..897f55f3dc2b --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedPositionalDeletes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedPositionalDeletes extends CustomSumMetric { + + static final String NAME = "addedPositionalDeletes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added positional deletes"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedRecords.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedRecords.java new file mode 100644 index 000000000000..fecdb28be39d --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/AddedRecords.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class AddedRecords extends CustomSumMetric { + + static final String NAME = "addedRecords"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of added records"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedDataFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedDataFiles.java new file mode 100644 index 000000000000..f9ecadd9b8fe --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedDataFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedDataFiles extends CustomSumMetric { + + static final String NAME = "removedDataFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed data files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedDeleteFiles.java new file mode 100644 index 000000000000..6543abd934e5 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedDeleteFiles extends CustomSumMetric { + + static final String NAME = "removedDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedEqualityDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedEqualityDeleteFiles.java new file mode 100644 index 000000000000..31928a293357 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedEqualityDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedEqualityDeleteFiles extends CustomSumMetric { + + static final String NAME = "removedEqualityDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed equality delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedEqualityDeletes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedEqualityDeletes.java new file mode 100644 index 000000000000..0838a288fe75 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedEqualityDeletes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedEqualityDeletes extends CustomSumMetric { + + static final String NAME = "removedEqualityDeletes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed equality deletes"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedFileSizeInBytes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedFileSizeInBytes.java new file mode 100644 index 000000000000..666e33743ead --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedFileSizeInBytes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedFileSizeInBytes extends CustomSumMetric { + + static final String NAME = "removedFileSizeInBytes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed file size (bytes)"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedPositionalDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedPositionalDeleteFiles.java new file mode 100644 index 000000000000..85d191f9edcc --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedPositionalDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedPositionalDeleteFiles extends CustomSumMetric { + + static final String NAME = "removedPositionalDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed positional delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedPositionalDeletes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedPositionalDeletes.java new file mode 100644 index 000000000000..1a59348745df --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedPositionalDeletes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedPositionalDeletes extends CustomSumMetric { + + static final String NAME = "removedPositionalDeletes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed positional deletes"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedRecords.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedRecords.java new file mode 100644 index 000000000000..6c0a8eaae052 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/RemovedRecords.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class RemovedRecords extends CustomSumMetric { + + static final String NAME = "removedRecords"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "number of removed records"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalDataFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalDataFiles.java new file mode 100644 index 000000000000..61d87be65bb1 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalDataFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class TotalDataFiles extends CustomSumMetric { + + static final String NAME = "totalDataFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "total number of data files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalDeleteFiles.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalDeleteFiles.java new file mode 100644 index 000000000000..5f6d8d7dea1c --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalDeleteFiles.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class TotalDeleteFiles extends CustomSumMetric { + + static final String NAME = "totalDeleteFiles"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "total number of delete files"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalEqualityDeletes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalEqualityDeletes.java new file mode 100644 index 000000000000..ea4e3afc7d78 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalEqualityDeletes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class TotalEqualityDeletes extends CustomSumMetric { + + static final String NAME = "totalEqualityDeletes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "total number of equality deletes"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalFileSizeInBytes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalFileSizeInBytes.java new file mode 100644 index 000000000000..2277b10cd364 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalFileSizeInBytes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class TotalFileSizeInBytes extends CustomSumMetric { + + static final String NAME = "totalFileSizeInBytes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "total data file size (bytes)"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalPositionalDeletes.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalPositionalDeletes.java new file mode 100644 index 000000000000..f143b63fbf2a --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalPositionalDeletes.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class TotalPositionalDeletes extends CustomSumMetric { + + static final String NAME = "totalPositionalDeletes"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "total number of positional deletes"; + } +} diff --git a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalRecords.java b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalRecords.java new file mode 100644 index 000000000000..14c2262ae308 --- /dev/null +++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/metrics/TotalRecords.java @@ -0,0 +1,36 @@ +/* + * 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.spark.source.metrics; + +import org.apache.spark.sql.connector.metric.CustomSumMetric; + +public class TotalRecords extends CustomSumMetric { + + static final String NAME = "totalRecords"; + + @Override + public String name() { + return NAME; + } + + @Override + public String description() { + return "total number of records"; + } +}