yihua commented on code in PR #12781:
URL: https://github.com/apache/hudi/pull/12781#discussion_r1980336390
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/transaction/TestSimpleSchemaConflictResolutionStrategy.java:
##########
@@ -67,303 +65,209 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
public class TestSimpleSchemaConflictResolutionStrategy {
-
+
+ @Mock
+ public static FileSystemViewManager viewManager;
+ @Mock
+ public static HoodieEngineContext engineContext;
+ @Mock
+ public static TaskContextSupplier taskContextSupplier;
public Option<HoodieInstant> lastCompletedTxnOwnerInstant;
public Option<HoodieInstant> tableCompactionOwnerInstant;
+ public Option<HoodieInstant> tableClusteringOwnerInstant;
+ public Option<HoodieInstant> tableReplacementOwnerInstant;
public Option<HoodieInstant> nonTableCompactionInstant;
@TempDir
private java.nio.file.Path basePath;
@Mock
private HoodieWriteConfig config;
private HoodieTableMetaClient metaClient;
private HoodieTestTable dummyInstantGenerator;
- private TestTable table;
+ private TestBaseHoodieTable table;
private SimpleSchemaConflictResolutionStrategy strategy;
-
+
private static final String SCHEMA1 =
"{\"type\":\"record\",\"name\":\"MyRecord\",\"fields\":[{\"name\":\"field1\",\"type\":\"string\"}]}";
private static final String SCHEMA2 =
"{\"type\":\"record\",\"name\":\"MyRecord\",\"fields\":[{\"name\":\"field1\",\"type\":\"string\"},{\"name\":\"field2\",\"type\":\"int\"}]}";
private static final String SCHEMA3 =
"{\"type\":\"record\",\"name\":\"MyRecord\",\"fields\":[{\"name\":\"field1\",\"type\":\"string\"},{\"name\":\"field3\",\"type\":\"boolean\"}]}";
private static final String NULL_SCHEMA = "{\"type\":\"null\"}";
- private void setupMocks(String tableSchemaAtTxnStart, String
tableSchemaAtTxnValidation,
- String writerSchemaOfTxn, Boolean enableResolution)
throws Exception {
- metaClient =
HoodieTestUtils.getMetaClientBuilder(HoodieTableType.COPY_ON_WRITE, new
Properties(),"")
+ private void setupInstants(String tableSchemaAtTxnStart, String
tableSchemaAtTxnValidation,
+ String writerSchemaOfTxn, Boolean
enableResolution, boolean setupLegacyClustering) throws Exception {
+ metaClient =
HoodieTestUtils.getMetaClientBuilder(HoodieTableType.COPY_ON_WRITE, new
Properties(), "")
.setTableCreateSchema(SCHEMA1)
.initTable(getDefaultStorageConf(), basePath.toString());
dummyInstantGenerator = HoodieTestTable.of(metaClient);
- lastCompletedTxnOwnerInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.COMPLETED,
COMMIT_ACTION, "001"));
- tableCompactionOwnerInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.INFLIGHT,
COMPACTION_ACTION, "003"));
- nonTableCompactionInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.INFLIGHT,
COMMIT_ACTION, "003"));
+ lastCompletedTxnOwnerInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.COMPLETED,
COMMIT_ACTION, "001", "001"));
+ tableCompactionOwnerInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.INFLIGHT,
COMPACTION_ACTION, "003", "003"));
+ tableClusteringOwnerInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.INFLIGHT,
CLUSTERING_ACTION, "003", "003"));
+ tableReplacementOwnerInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.INFLIGHT,
REPLACE_COMMIT_ACTION, "003", "003"));
+ nonTableCompactionInstant =
Option.of(metaClient.createNewInstant(HoodieInstant.State.INFLIGHT,
COMMIT_ACTION, "004", "004"));
Review Comment:
would be good to make requested and completion time different, e.g., "003"
and "0031".
--
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]