rdblue commented on code in PR #5794: URL: https://github.com/apache/iceberg/pull/5794#discussion_r974776505
########## core/src/test/java/org/apache/iceberg/TestStatistics.java: ########## @@ -0,0 +1,125 @@ +/* + * 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 org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class TestStatistics extends TableTestBase { + @Parameterized.Parameters(name = "formatVersion = {0}") + public static Object[] parameters() { + return new Object[] {1, 2}; + } + + public TestStatistics(int formatVersion) { + super(formatVersion); + } + + @Test + public void testEmptyUpdateStatistics() { + Assert.assertEquals("Table should be on version 0", 0, (int) version()); + TableMetadata base = readMetadata(); + + Transaction transaction = table.newTransaction(); + transaction.updateStatistics().commit(); + transaction.commitTransaction(); Review Comment: I don't see a benefit of doing this in a transaction. If you want to have both tests, then it probably makes sense to inject a `TransactionTable` and a couple callbacks. However, most tests are direct and use the operation without a transaction. Then the transaction tests only need to validate a couple of cases. Tests for the operation should be thorough and use the operation directly. Tests for the operation within a transaction just need to validate that it is called correctly (because of how transactions work). -- 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]
