You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "xuzifu666 (via GitHub)" <gi...@apache.org> on 2024/10/11 02:25:51 UTC
[PR] [core] Support set snapshot-id when query by consumer-id [paimon]
xuzifu666 opened a new pull request, #4307:
URL: https://github.com/apache/paimon/pull/4307
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
Scenario:In our producation user query by consumer-id cannot set startup snapshot-id directly (except use procedure firstly then start flink job), currently this is not very flexible,this pr is aimed to support it by 'consumer.snapshot-id'. Like:
SELECT * FROM tableName /*+ OPTIONS('consumer-id'='myid','consumer.expiration-time'='3h','consumer.snapshot-id'='3') */
<!-- Linking this pull request to the issue -->
Linked issue: close #xxx
<!-- 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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4307:
URL: https://github.com/apache/paimon/pull/4307#discussion_r1797611022
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+
+ Preconditions.checkArgument(
+ scanHandleKey.size() == 1,
+ String.format(
+ "Only one of the following parameters may be set : [%s, %s, %s, %s]",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
Review Comment:
Here may can not swith due to case key() method.
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4307:
URL: https://github.com/apache/paimon/pull/4307#discussion_r1796899811
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static List<String> scanKeys;
+
+ public static Snapshot resolveSnapshotFromOption(
+ Options options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : getScanKeys()) {
+ if (options.containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+ if (scanHandleKey.size() > 1) {
+ throw new IllegalArgumentException(
+ String.format(
+ "%s %s %s and %s can contains only one",
Review Comment:
Thanks @LinMingQiang had addressed
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #4307:
URL: https://github.com/apache/paimon/pull/4307
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4307:
URL: https://github.com/apache/paimon/pull/4307#issuecomment-2408414391
@wwj6591812 had addressd, Thanks.
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on PR #4307:
URL: https://github.com/apache/paimon/pull/4307#issuecomment-2409678255
+1
--
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
Re: [PR] [core] Support specify snapshot-id and timestamp when query by consumer-id [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4307:
URL: https://github.com/apache/paimon/pull/4307#issuecomment-2406621656
> Maybe you want `/*+ OPTIONS('consumer-id'='myid', 'scan.snapshot-id'='3', 'consumer.ignore-progress' = 'true') */`?
Yes, it is a direct way, I had test for it, can query right snapshot and reset consumer. Thanks @JingsongLi
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 closed pull request #4307: [core] Add TimeTravelUtils to resolve snapshot from scan params
URL: https://github.com/apache/paimon/pull/4307
--
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
Re: [PR] [core] Support TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on code in PR #4307:
URL: https://github.com/apache/paimon/pull/4307#discussion_r1796861253
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.options.Options;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtilsTest}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
Review Comment:
@link TimeTravelUtil
--
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
Re: [PR] [core] Support set snapshot-id when query by consumer-id [paimon]
Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on PR #4307:
URL: https://github.com/apache/paimon/pull/4307#issuecomment-2406446951
Expansion :We can support more scan startup mode, like `timestamp`.
--
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
Re: [PR] [core] Support set snapshot-id when query by consumer-id [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4307:
URL: https://github.com/apache/paimon/pull/4307#issuecomment-2406516900
> Expansion :We can support more scan startup mode, like `timestamp`.
>
> Add parameters : `consumer.scan.startup.mode` = `snapshot/timestamp`
Thanks @LinMingQiang ,Good reminder, had added timestamp config, but mode not add due to user not need add two config if they use snapshot or timestamp.
--
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
Re: [PR] [core] Support specify snapshot-id and timestamp when query by consumer-id [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #4307:
URL: https://github.com/apache/paimon/pull/4307#issuecomment-2406582744
Maybe you want `/*+ OPTIONS('consumer-id'='myid', 'scan.snapshot-id'='3', 'consumer.ignore-progress') */`?
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on code in PR #4307:
URL: https://github.com/apache/paimon/pull/4307#discussion_r1796869874
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static List<String> scanKeys;
+
+ public static Snapshot resolveSnapshotFromOption(
+ Options options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : getScanKeys()) {
+ if (options.containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+ if (scanHandleKey.size() > 1) {
+ throw new IllegalArgumentException(
+ String.format(
+ "%s %s %s and %s can contains only one",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+ }
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
Review Comment:
switch()?
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static List<String> scanKeys;
+
+ public static Snapshot resolveSnapshotFromOption(
+ Options options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : getScanKeys()) {
+ if (options.containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+ if (scanHandleKey.size() > 1) {
+ throw new IllegalArgumentException(
+ String.format(
+ "%s %s %s and %s can contains only one",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+ }
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
+ return snapshot;
+ }
+
+ private static Snapshot handleSnapshotId(SnapshotManager snapshotManager, Options options) {
+ Long snapshotId = options.get(CoreOptions.SCAN_SNAPSHOT_ID);
+ return snapshotManager.snapshot(snapshotId);
+ }
+
+ private static Snapshot handleTimestamp(SnapshotManager snapshotManager, Options options) {
+ Long timestamp = options.get(CoreOptions.SCAN_TIMESTAMP_MILLIS);
+ return snapshotManager.earlierOrEqualTimeMills(timestamp);
+ }
+
+ private static Snapshot handleWatermark(SnapshotManager snapshotManager, Options options) {
+ Long watermark = options.get(CoreOptions.SCAN_WATERMARK);
+ return snapshotManager.laterOrEqualWatermark(watermark);
+ }
+
+ private static Snapshot handleTagName(SnapshotManager snapshotManager, Options options) {
+ String tagName = options.get(CoreOptions.SCAN_TAG_NAME);
+ TagManager tagManager =
+ new TagManager(snapshotManager.fileIO(), snapshotManager.tablePath());
+ return tagManager.taggedSnapshot(tagName);
+ }
+
+ public static List<String> getScanKeys() {
+ if (scanKeys == null) {
+ scanKeys = new ArrayList<>();
+ scanKeys.add(CoreOptions.SCAN_SNAPSHOT_ID.key());
+ scanKeys.add(CoreOptions.SCAN_TAG_NAME.key());
+ scanKeys.add(CoreOptions.SCAN_WATERMARK.key());
+ scanKeys.add(CoreOptions.SCAN_TIMESTAMP_MILLIS.key());
+ }
Review Comment:
Use String[]{} is better.
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static List<String> scanKeys;
+
+ public static Snapshot resolveSnapshotFromOption(
+ Options options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : getScanKeys()) {
+ if (options.containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+ if (scanHandleKey.size() > 1) {
+ throw new IllegalArgumentException(
+ String.format(
+ "%s %s %s and %s can contains only one",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+ }
Review Comment:
Use `checkArgument` will be better.
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static List<String> scanKeys;
+
+ public static Snapshot resolveSnapshotFromOption(
+ Options options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : getScanKeys()) {
+ if (options.containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+ if (scanHandleKey.size() > 1) {
+ throw new IllegalArgumentException(
+ String.format(
+ "%s %s %s and %s can contains only one",
Review Comment:
Only one of the following parameters may be set : [%s, %s, %s]
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on code in PR #4307:
URL: https://github.com/apache/paimon/pull/4307#discussion_r1796869874
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static List<String> scanKeys;
+
+ public static Snapshot resolveSnapshotFromOption(
+ Options options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : getScanKeys()) {
+ if (options.containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+ if (scanHandleKey.size() > 1) {
+ throw new IllegalArgumentException(
+ String.format(
+ "%s %s %s and %s can contains only one",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+ }
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
Review Comment:
switch()?
--
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
Re: [PR] [core] Add TimeTravelUtils to resolve snapshot from scan params [paimon]
Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on code in PR #4307:
URL: https://github.com/apache/paimon/pull/4307#discussion_r1797538924
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
Review Comment:
List<String> scanHandleKey = new ArrayList<>(1);
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
Review Comment:
Add a warn log?
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
Review Comment:
resolveSnapshotFromOptions
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
+ SnapshotManager snapshotManager = table.snapshotManager();
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowData(1, 10, 100L));
+ commit.commit(0, write.prepareCommit(true, 0));
+ long ts = System.currentTimeMillis();
+
+ write.write(rowData(2, 30, 101L));
+ commit.commit(1, write.prepareCommit(true, 1));
+
+ write.write(rowData(3, 50, 500L));
+ commit.commit(2, write.prepareCommit(true, 2));
+
+ HashMap<String, String> optMap = new HashMap<>();
+ optMap.put("scan.snapshot-id", "2");
+ CoreOptions options = CoreOptions.fromMap(optMap);
+ Snapshot snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 2);
Review Comment:
assertTrue
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
+ SnapshotManager snapshotManager = table.snapshotManager();
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowData(1, 10, 100L));
+ commit.commit(0, write.prepareCommit(true, 0));
+ long ts = System.currentTimeMillis();
+
+ write.write(rowData(2, 30, 101L));
+ commit.commit(1, write.prepareCommit(true, 1));
+
+ write.write(rowData(3, 50, 500L));
+ commit.commit(2, write.prepareCommit(true, 2));
+
+ HashMap<String, String> optMap = new HashMap<>();
Review Comment:
Map<String, String> optMap = new HashMap<>(4);
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
Review Comment:
private static final String[] SCAN_KEYS = {
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+
+ Preconditions.checkArgument(
+ scanHandleKey.size() == 1,
+ String.format(
+ "Only one of the following parameters may be set : [%s, %s, %s, %s]",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
+ return snapshot;
+ }
+
+ private static Snapshot handleSnapshotId(SnapshotManager snapshotManager, CoreOptions options) {
+ Long snapshotId = options.scanSnapshotId();
+ if (snapshotId != null && snapshotManager.snapshotExists(snapshotId)) {
+ return snapshotManager.snapshot(snapshotId);
+ }
+ return null;
+ }
+
+ private static Snapshot handleTimestamp(SnapshotManager snapshotManager, CoreOptions options) {
Review Comment:
resolveSnapshotByTimestamp
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+
+ Preconditions.checkArgument(
+ scanHandleKey.size() == 1,
+ String.format(
+ "Only one of the following parameters may be set : [%s, %s, %s, %s]",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
+ return snapshot;
+ }
+
+ private static Snapshot handleSnapshotId(SnapshotManager snapshotManager, CoreOptions options) {
+ Long snapshotId = options.scanSnapshotId();
+ if (snapshotId != null && snapshotManager.snapshotExists(snapshotId)) {
+ return snapshotManager.snapshot(snapshotId);
+ }
+ return null;
+ }
+
+ private static Snapshot handleTimestamp(SnapshotManager snapshotManager, CoreOptions options) {
+ Long timestamp = options.scanTimestampMills();
+ return snapshotManager.earlierOrEqualTimeMills(timestamp);
+ }
+
+ private static Snapshot handleWatermark(SnapshotManager snapshotManager, CoreOptions options) {
Review Comment:
resolveSnapshotByWatermark
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+
+ Preconditions.checkArgument(
+ scanHandleKey.size() == 1,
+ String.format(
+ "Only one of the following parameters may be set : [%s, %s, %s, %s]",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
+ return snapshot;
+ }
+
+ private static Snapshot handleSnapshotId(SnapshotManager snapshotManager, CoreOptions options) {
Review Comment:
resolveSnapshotBySnapshotId
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+
+ Preconditions.checkArgument(
+ scanHandleKey.size() == 1,
+ String.format(
+ "Only one of the following parameters may be set : [%s, %s, %s, %s]",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
+ if (key.equals(CoreOptions.SCAN_SNAPSHOT_ID.key())) {
+ snapshot = handleSnapshotId(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_WATERMARK.key())) {
+ snapshot = handleWatermark(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TIMESTAMP_MILLIS.key())) {
+ snapshot = handleTimestamp(snapshotManager, options);
+ } else if (key.equals(CoreOptions.SCAN_TAG_NAME.key())) {
+ snapshot = handleTagName(snapshotManager, options);
+ }
+ return snapshot;
+ }
+
+ private static Snapshot handleSnapshotId(SnapshotManager snapshotManager, CoreOptions options) {
+ Long snapshotId = options.scanSnapshotId();
+ if (snapshotId != null && snapshotManager.snapshotExists(snapshotId)) {
+ return snapshotManager.snapshot(snapshotId);
+ }
+ return null;
+ }
+
+ private static Snapshot handleTimestamp(SnapshotManager snapshotManager, CoreOptions options) {
+ Long timestamp = options.scanTimestampMills();
+ return snapshotManager.earlierOrEqualTimeMills(timestamp);
+ }
+
+ private static Snapshot handleWatermark(SnapshotManager snapshotManager, CoreOptions options) {
+ Long watermark = options.scanWatermark();
+ return snapshotManager.laterOrEqualWatermark(watermark);
+ }
+
+ private static Snapshot handleTagName(SnapshotManager snapshotManager, CoreOptions options) {
Review Comment:
resolveSnapshotByTagName
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
+public class TimeTravelUtil {
+
+ public static String[] scanKeys = {
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()
+ };
+
+ public static Snapshot resolveSnapshotFromOption(
+ CoreOptions options, SnapshotManager snapshotManager) {
+ List<String> scanHandleKey = new ArrayList<>();
+ for (String key : scanKeys) {
+ if (options.toConfiguration().containsKey(key)) {
+ scanHandleKey.add(key);
+ }
+ }
+
+ if (scanHandleKey.size() == 0) {
+ return null;
+ }
+
+ Preconditions.checkArgument(
+ scanHandleKey.size() == 1,
+ String.format(
+ "Only one of the following parameters may be set : [%s, %s, %s, %s]",
+ CoreOptions.SCAN_SNAPSHOT_ID.key(),
+ CoreOptions.SCAN_TAG_NAME.key(),
+ CoreOptions.SCAN_WATERMARK.key(),
+ CoreOptions.SCAN_TIMESTAMP_MILLIS.key()));
+
+ String key = scanHandleKey.get(0);
+ Snapshot snapshot = null;
Review Comment:
May use switch...case better
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/TimeTravelUtil.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.utils.Preconditions;
+import org.apache.paimon.utils.SnapshotManager;
+import org.apache.paimon.utils.TagManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/** Contains time travel functions. */
Review Comment:
The util class of resolve snapshot from scan params for time travel.
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
+ SnapshotManager snapshotManager = table.snapshotManager();
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowData(1, 10, 100L));
+ commit.commit(0, write.prepareCommit(true, 0));
+ long ts = System.currentTimeMillis();
+
+ write.write(rowData(2, 30, 101L));
+ commit.commit(1, write.prepareCommit(true, 1));
+
+ write.write(rowData(3, 50, 500L));
+ commit.commit(2, write.prepareCommit(true, 2));
+
+ HashMap<String, String> optMap = new HashMap<>();
+ optMap.put("scan.snapshot-id", "2");
+ CoreOptions options = CoreOptions.fromMap(optMap);
+ Snapshot snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 2);
+
+ optMap.clear();
+ optMap.put("scan.timestamp-millis", ts + "");
+ options = CoreOptions.fromMap(optMap);
+ snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 1);
+
+ table.createTag("tag3", 3);
+ optMap.clear();
+ optMap.put("scan.tag-name", "tag3");
+ options = CoreOptions.fromMap(optMap);
+ snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 3);
Review Comment:
assertTrue
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
+ SnapshotManager snapshotManager = table.snapshotManager();
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowData(1, 10, 100L));
+ commit.commit(0, write.prepareCommit(true, 0));
+ long ts = System.currentTimeMillis();
+
+ write.write(rowData(2, 30, 101L));
+ commit.commit(1, write.prepareCommit(true, 1));
+
+ write.write(rowData(3, 50, 500L));
+ commit.commit(2, write.prepareCommit(true, 2));
+
+ HashMap<String, String> optMap = new HashMap<>();
+ optMap.put("scan.snapshot-id", "2");
+ CoreOptions options = CoreOptions.fromMap(optMap);
+ Snapshot snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 2);
+
+ optMap.clear();
+ optMap.put("scan.timestamp-millis", ts + "");
+ options = CoreOptions.fromMap(optMap);
+ snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 1);
Review Comment:
assertTrue
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
Review Comment:
testResolveSnapshotFromOptions
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
+ SnapshotManager snapshotManager = table.snapshotManager();
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowData(1, 10, 100L));
+ commit.commit(0, write.prepareCommit(true, 0));
+ long ts = System.currentTimeMillis();
+
+ write.write(rowData(2, 30, 101L));
+ commit.commit(1, write.prepareCommit(true, 1));
+
+ write.write(rowData(3, 50, 500L));
+ commit.commit(2, write.prepareCommit(true, 2));
+
+ HashMap<String, String> optMap = new HashMap<>();
+ optMap.put("scan.snapshot-id", "2");
+ CoreOptions options = CoreOptions.fromMap(optMap);
+ Snapshot snapshot = TimeTravelUtil.resolveSnapshotFromOption(options, snapshotManager);
+ assertThat(snapshot.id() == 2);
Review Comment:
add assert snapshot.id() is not null
##########
paimon-core/src/test/java/org/apache/paimon/table/source/snapshot/TimeTravelUtilsTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.CoreOptions;
+import org.apache.paimon.Snapshot;
+import org.apache.paimon.table.sink.StreamTableCommit;
+import org.apache.paimon.table.sink.StreamTableWrite;
+import org.apache.paimon.utils.SnapshotManager;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/** Tests for {@link TimeTravelUtil}. */
+public class TimeTravelUtilsTest extends ScannerTestBase {
+
+ @Test
+ public void testScan() throws Exception {
+ SnapshotManager snapshotManager = table.snapshotManager();
+ StreamTableWrite write = table.newWrite(commitUser);
+ StreamTableCommit commit = table.newCommit(commitUser);
+
+ write.write(rowData(1, 10, 100L));
+ commit.commit(0, write.prepareCommit(true, 0));
+ long ts = System.currentTimeMillis();
Review Comment:
inline this
--
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