From 0818a57662d9b3491daa0080b273f5cbc88387d9 Mon Sep 17 00:00:00 2001 From: rtjd6554 <174791724+rtjd6554@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:08:13 +0100 Subject: [PATCH] Update to include base test structure --- .../commit/StateStoreCommitterTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/java/statestore-commit/src/test/java/sleeper/commit/StateStoreCommitterTest.java b/java/statestore-commit/src/test/java/sleeper/commit/StateStoreCommitterTest.java index 2b86f753ac..e5074c9ace 100644 --- a/java/statestore-commit/src/test/java/sleeper/commit/StateStoreCommitterTest.java +++ b/java/statestore-commit/src/test/java/sleeper/commit/StateStoreCommitterTest.java @@ -15,6 +15,7 @@ */ package sleeper.commit; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -31,10 +32,12 @@ import sleeper.core.record.process.RecordsProcessedSummary; import sleeper.core.record.process.status.ProcessRun; import sleeper.core.schema.Schema; +import sleeper.core.schema.type.StringType; import sleeper.core.statestore.FileReference; import sleeper.core.statestore.FileReferenceFactory; import sleeper.core.statestore.ReplaceFileReferencesRequest; import sleeper.core.statestore.StateStore; +import sleeper.core.statestore.commit.SplitPartitionCommitRequest; import sleeper.core.statestore.commit.StateStoreCommitRequestInS3; import sleeper.core.statestore.commit.StateStoreCommitRequestInS3SerDe; import sleeper.core.statestore.exception.FileReferenceAssignedToJobException; @@ -347,6 +350,39 @@ void shouldRefuseReferenceToS3HeldInS3() throws Exception { } } + @Nested + @DisplayName("Split partition commit request") + class SplitPartition { + Schema schema = schemaWithKey("key", new StringType()); + + @Test + @Disabled + void shouldApplySplitPartitionIntoTheStateStore() throws Exception { + PartitionsBuilder builder = new PartitionsBuilder(schema).rootFirst("root"); + + PartitionTree beforeTree = builder.buildTree(); + + PartitionTree afterTree = builder.splitToNewChildren("root", "left", "right", "aaa") + .buildTree(); + + // Given + StateStore stateStore = createTable("test-table"); + FileReference outputFile = fileFactory.rootFile("output.parquet", 123L); + SplitPartitionCommitRequest commitRequest = new SplitPartitionCommitRequest("test-table", + afterTree.getPartition("root"), + afterTree.getPartition("left"), + afterTree.getPartition("right")); + + // When + committer().apply(StateStoreCommitRequest.forSplitPartition(commitRequest)); + + // Then + //assertThat(stateStore.getFileReferences()).containsExactly(outputFile); + //assertThat(ingestJobStatusStore.getAllJobs("test-table")).isEmpty(); + + } + } + private StateStoreCommitter committer() { return committerWithTimes(Instant::now); }