You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "pongandnoon (via GitHub)" <gi...@apache.org> on 2023/06/30 08:06:26 UTC

[GitHub] [incubator-paimon] pongandnoon opened a new pull request, #1470: [core] Introduce incremental-between read by timestamp

pongandnoon opened a new pull request, #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Read incremental changes between start timestamp (exclusive) and end timestamp, for example, 't1,t2' means changes between timestamp t1 and timestamp t2.
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] JingsongLi commented on pull request #1470: [core] Introduce incremental-between read by timestamp

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470#issuecomment-1621459229

   Please take a look to your repo. Compile failed.


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] pongandnoon commented on a diff in pull request #1470: [core] Introduce incremental-between read by timestamp

Posted by "pongandnoon (via GitHub)" <gi...@apache.org>.
pongandnoon commented on code in PR #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470#discussion_r1251427666


##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalStartingScanner.java:
##########
@@ -46,6 +46,9 @@ public IncrementalStartingScanner(long start, long end) {
 
     @Override
     public Result scan(SnapshotManager manager, SnapshotReader reader) {
+        start = (start < manager.earliestSnapshotId()) ? manager.earliestSnapshotId() - 1 : start;

Review Comment:
   enen,I will modify to avoid reuse manager.earliestSnapshotId() and  manager.latestSnapshotId().And  any thing elase?



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] wxplovecc commented on a diff in pull request #1470: [core] Introduce incremental-between read by timestamp

Posted by "wxplovecc (via GitHub)" <gi...@apache.org>.
wxplovecc commented on code in PR #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470#discussion_r1247586915


##########
paimon-core/src/main/java/org/apache/paimon/CoreOptions.java:
##########
@@ -941,22 +951,38 @@ public String scanTagName() {
         return options.get(SCAN_TAG_NAME);
     }
 
-    public Pair<String, String> incrementalBetween() {
-        String str = options.get(INCREMENTAL_BETWEEN);
+    public Pair<String, String> incrementalBetweenSnapshot() {
+        String str = options.get(INCREMENTAL_BETWEEN_SNAPSHOT);
         if (str == null) {
             return null;
         }
 
         String[] split = str.split(",");
         if (split.length != 2) {
             throw new IllegalArgumentException(
-                    "The incremental-between must specific start snapshot (exclusive) and end snapshot,"
+                    "The incremental-between-snapshot must specific start snapshot (exclusive) and end snapshot,"
                             + " for example, '5,10' means changes between snapshot 5 and snapshot 10. But is: "
                             + str);
         }
         return Pair.of(split[0], split[1]);
     }
 
+    public Pair<String, String> incrementalBetweenTimestamp() {

Review Comment:
   Duplicate code ?



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1470: [core] Introduce incremental-between read by timestamp

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470#discussion_r1250579330


##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalStartingScanner.java:
##########
@@ -46,6 +46,9 @@ public IncrementalStartingScanner(long start, long end) {
 
     @Override
     public Result scan(SnapshotManager manager, SnapshotReader reader) {
+        start = (start < manager.earliestSnapshotId()) ? manager.earliestSnapshotId() - 1 : start;

Review Comment:
   reuse earliestSnapshotId and latestSnapshotId



##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.paimon.table.source.snapshot;
+
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.SnapshotManager;
+
+/** {@link StartingScanner} for incremental changes by timestamp. */
+public class IncrementalTimeStampStartingScanner implements StartingScanner {
+
+    private final long startTimestamp;
+    private final long endTimestamp;
+
+    public IncrementalTimeStampStartingScanner(long startTimestamp, long endTimestamp) {
+        this.startTimestamp = startTimestamp;
+        this.endTimestamp = endTimestamp;
+    }
+
+    @Override
+    public Result scan(SnapshotManager manager, SnapshotReader reader) {
+        Snapshot earliestSnapshot = manager.snapshot(manager.earliestSnapshotId());
+        Snapshot latestSnapshot = manager.latestSnapshot();
+        if (startTimestamp > latestSnapshot.timeMillis()
+                || endTimestamp < earliestSnapshot.timeMillis()) {
+            return new NoSnapshot();
+        }
+        Snapshot startSnapshot = manager.earlierOrEqualTimeMills(startTimestamp);
+        Long startSnapshotId =
+                (startSnapshot == null)
+                        ? manager.snapshot(manager.earliestSnapshotId()).id() - 1

Review Comment:
   reuse earliestSnapshotId



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] wxplovecc commented on a diff in pull request #1470: [core] Introduce incremental-between read by timestamp

Posted by "wxplovecc (via GitHub)" <gi...@apache.org>.
wxplovecc commented on code in PR #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470#discussion_r1247590974


##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/IncrementalTimeStampStartingScanner.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.paimon.table.source.snapshot;
+
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.SnapshotManager;
+
+/** {@link StartingScanner} for incremental changes by timestamp. */
+public class IncrementalTimeStampStartingScanner implements StartingScanner {

Review Comment:
   Extends IncrementalStartingScanner?



##########
paimon-core/src/main/java/org/apache/paimon/CoreOptions.java:
##########
@@ -941,22 +951,38 @@ public String scanTagName() {
         return options.get(SCAN_TAG_NAME);
     }
 
-    public Pair<String, String> incrementalBetween() {
-        String str = options.get(INCREMENTAL_BETWEEN);
+    public Pair<String, String> incrementalBetweenSnapshot() {
+        String str = options.get(INCREMENTAL_BETWEEN_SNAPSHOT);
         if (str == null) {
             return null;
         }
 
         String[] split = str.split(",");
         if (split.length != 2) {
             throw new IllegalArgumentException(
-                    "The incremental-between must specific start snapshot (exclusive) and end snapshot,"
+                    "The incremental-between-snapshot must specific start snapshot (exclusive) and end snapshot,"
                             + " for example, '5,10' means changes between snapshot 5 and snapshot 10. But is: "
                             + str);
         }
         return Pair.of(split[0], split[1]);
     }
 
+    public Pair<String, String> incrementalBetweenTimestamp() {

Review Comment:
   Duplicate code 



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] JingsongLi merged pull request #1470: [core] Introduce incremental-between read by timestamp

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #1470:
URL: https://github.com/apache/incubator-paimon/pull/1470


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org