aokolnychyi commented on code in PR #7646:
URL: https://github.com/apache/iceberg/pull/7646#discussion_r1198238915


##########
spark/v3.4/spark-extensions/src/jmh/java/org/apache/iceberg/spark/UpdateProjectionBenchmark.java:
##########
@@ -0,0 +1,210 @@
+/*
+ * 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;
+
+import static org.apache.spark.sql.functions.current_date;
+import static org.apache.spark.sql.functions.date_add;
+import static org.apache.spark.sql.functions.expr;
+
+import java.util.UUID;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.iceberg.DistributionMode;
+import org.apache.iceberg.RowLevelOperationMode;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.TableProperties;
+import org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
+import org.apache.spark.sql.catalyst.parser.ParseException;
+import org.apache.spark.sql.internal.SQLConf;
+import org.apache.spark.sql.types.StructType;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+
+@Fork(1)
+@State(Scope.Benchmark)
+@Warmup(iterations = 3)
+@Measurement(iterations = 5)
+@BenchmarkMode(Mode.SingleShotTime)
+public class UpdateProjectionBenchmark {

Review Comment:
   Here are results for the existing benchmark for merging rows.
   
   ```
         Benchmark                                                              
          Mode  Cnt   Score   Error  Units
   [OLD] 
MergeCardinalityCheckBenchmark.copyOnWriteMergeCardinalityCheck10PercentUpdates 
   ss    5  11.287 ± 0.978   s/op
   [NEW] 
MergeCardinalityCheckBenchmark.copyOnWriteMergeCardinalityCheck10PercentUpdates 
   ss    5  11.100 ± 0.465   s/op
   
   [OLD] 
MergeCardinalityCheckBenchmark.copyOnWriteMergeCardinalityCheck30PercentUpdates 
   ss    5  11.344 ± 0.272   s/op
   [NEW] 
MergeCardinalityCheckBenchmark.copyOnWriteMergeCardinalityCheck30PercentUpdates 
   ss    5  11.417 ± 1.082   s/op
   
   [OLD] 
MergeCardinalityCheckBenchmark.copyOnWriteMergeCardinalityCheck90PercentUpdates 
   ss    5  11.835 ± 0.322   s/op
   [NEW] 
MergeCardinalityCheckBenchmark.copyOnWriteMergeCardinalityCheck90PercentUpdates 
   ss    5  11.887 ± 3.269   s/op
   
   [OLD] 
MergeCardinalityCheckBenchmark.mergeOnReadMergeCardinalityCheck10PercentUpdates 
   ss    5   7.817 ± 0.245   s/op
   [NEW] 
MergeCardinalityCheckBenchmark.mergeOnReadMergeCardinalityCheck10PercentUpdates 
   ss    5   7.106 ± 0.240   s/op
   
   [OLD] 
MergeCardinalityCheckBenchmark.mergeOnReadMergeCardinalityCheck30PercentUpdates 
   ss    5  12.440 ± 0.339   s/op
   [NEW] 
MergeCardinalityCheckBenchmark.mergeOnReadMergeCardinalityCheck30PercentUpdates 
   ss    5  11.662 ± 0.258   s/op
   
   [OLD] 
MergeCardinalityCheckBenchmark.mergeOnReadMergeCardinalityCheck90PercentUpdates 
   ss    5  26.052 ± 0.865   s/op
   [NEW] 
MergeCardinalityCheckBenchmark.mergeOnReadMergeCardinalityCheck90PercentUpdates 
   ss    5  23.681 ± 1.110   s/op
   ```
   
   The new approach performs a tad better for MoR MERGE. Could be related to 
the projection logic in the writer but it does not really matter as long as it 
is not worse.



-- 
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]

Reply via email to