morningman commented on code in PR #51661:
URL: https://github.com/apache/doris/pull/51661#discussion_r2142748388


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java:
##########
@@ -379,7 +380,29 @@ public List<org.apache.paimon.table.source.Split> 
getPaimonSplitFromAPI() {
                     .collect(Collectors.toList())
                     .indexOf(slot.getColumn().getName()))
                     .toArray();
-        ReadBuilder readBuilder = source.getPaimonTable().newReadBuilder();
+        Table paimonTable = source.getPaimonTable();
+        if (scanParams != null && scanParams.incrementalRead()) {
+            Map<String, String> paimonScanParams = new HashMap<>();
+            paimonScanParams.put("scan.snapshot-id", null);

Review Comment:
   Define all these parameter name somewhere, or use pre defined name.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java:
##########
@@ -379,7 +380,29 @@ public List<org.apache.paimon.table.source.Split> 
getPaimonSplitFromAPI() {
                     .collect(Collectors.toList())
                     .indexOf(slot.getColumn().getName()))
                     .toArray();
-        ReadBuilder readBuilder = source.getPaimonTable().newReadBuilder();
+        Table paimonTable = source.getPaimonTable();
+        if (scanParams != null && scanParams.incrementalRead()) {
+            Map<String, String> paimonScanParams = new HashMap<>();
+            paimonScanParams.put("scan.snapshot-id", null);
+            paimonScanParams.put("scan.mode", null);
+
+            String startSnapshotId = 
scanParams.getMapParams().get("startSnapshotId");
+            String endSnapshotId = 
scanParams.getMapParams().get("endSnapshotId");
+            String incrementalBetweenScanMode = scanParams.getMapParams()
+                    .getOrDefault("incrementalBetweenScanMode", "AUTO");
+
+            String startTimestamp = 
scanParams.getMapParams().get("startTimestamp");

Review Comment:
   I didn't see `startTimestamp`, `endTimestamp` and 
`incrementalBetweenScanMode` test cases



##########
regression-test/suites/external_table_p0/paimon/paimon_incr_read.groovy:
##########
@@ -0,0 +1,52 @@
+// 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.
+
+suite("test_paimon_incr_read", 
"p0,external,doris,external_docker,external_docker_doris") {
+    logger.info("start paimon test")
+    String enabled = context.config.otherConfigs.get("enablePaimonTest")
+    if (enabled == null || !enabled.equalsIgnoreCase("true")) {
+        logger.info("disable paimon test.")
+        return
+    }
+    String minio_port = context.config.otherConfigs.get("iceberg_minio_port")
+    String catalog_name = "test_paimon_incr_read_catalog"
+    String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
+    try {
+        sql """drop catalog if exists ${catalog_name}"""
+
+        sql """
+                CREATE CATALOG ${catalog_name} PROPERTIES (
+                        'type' = 'paimon',
+                        'warehouse' = 's3://warehouse/wh',
+                        's3.endpoint' = 
'http://${externalEnvIp}:${minio_port}',
+                        's3.access_key' = 'admin',
+                        's3.secret_key' = 'password',
+                        's3.path.style.access' = 'true'
+                );
+            """
+        sql """switch `${catalog_name}`"""
+        sql """use test_paimon_incr_read_db"""

Review Comment:
   Also test `set force_jni_scanner=true` before executing sql, to see if it is 
ok with paimon  jni scanner.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java:
##########
@@ -379,7 +380,29 @@ public List<org.apache.paimon.table.source.Split> 
getPaimonSplitFromAPI() {
                     .collect(Collectors.toList())
                     .indexOf(slot.getColumn().getName()))
                     .toArray();
-        ReadBuilder readBuilder = source.getPaimonTable().newReadBuilder();
+        Table paimonTable = source.getPaimonTable();
+        if (scanParams != null && scanParams.incrementalRead()) {
+            Map<String, String> paimonScanParams = new HashMap<>();
+            paimonScanParams.put("scan.snapshot-id", null);
+            paimonScanParams.put("scan.mode", null);
+
+            String startSnapshotId = 
scanParams.getMapParams().get("startSnapshotId");
+            String endSnapshotId = 
scanParams.getMapParams().get("endSnapshotId");
+            String incrementalBetweenScanMode = scanParams.getMapParams()
+                    .getOrDefault("incrementalBetweenScanMode", "AUTO");
+
+            String startTimestamp = 
scanParams.getMapParams().get("startTimestamp");

Review Comment:
   Add please also add some negative cases like invalid snapshot id or 
timestamp.
   And expect certain error message



-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to