chenjunjiedada commented on a change in pull request #588: Add sequential 
number prepare for supporting row level delete (WIP)
URL: https://github.com/apache/incubator-iceberg/pull/588#discussion_r350234145
 
 

 ##########
 File path: core/src/test/java/org/apache/iceberg/TestSequenceNumber.java
 ##########
 @@ -0,0 +1,60 @@
+/*
+ * 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.junit.Assert;
+import org.junit.Test;
+
+
+public class TestSequenceNumber extends TableTestBase {
+
+  @Test
+  public void testWriteSequenceNumber() {
+    table.newFastAppend().appendFile(FILE_A).commit();
+
+    Assert.assertEquals("sequence number should be 1", 1,
+        table.currentSnapshot().sequenceNumber().longValue());
+
+    table.newFastAppend().appendFile(FILE_B).commit();
+
+    Assert.assertEquals("sequence number should be 2", 2,
+        table.currentSnapshot().sequenceNumber().longValue());
+
+  }
+
+  @Test
+  public void testReadSequenceNumber() {
+    long curSeqNum;
+
+    if (table.currentSnapshot() == null) {
 
 Review comment:
   No, the snapshot is produced in `SnapshotProducer` and the 
`SnapshotProducer` has three subtypes `BaseRewriteManifests`, `FastAppend`, 
`MergeAppend`, so only when `commit` is triggered inside these classes, for 
example, append one file and commit, a new snapshot is generated. Here we just 
create an empty table and no data has been written yet, so the snapshot is 
null. This is a bit weird though.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to