You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2023/01/01 16:40:33 UTC

[GitHub] [incubator-seatunnel] TaoZex commented on a diff in pull request #3842: [Improve][Connector-V2][Hive] Support assign partitions

TaoZex commented on code in PR #3842:
URL: https://github.com/apache/incubator-seatunnel/pull/3842#discussion_r1059773490


##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java:
##########
@@ -115,8 +116,18 @@ public List<String> getFileNamesByPath(HadoopConf hadoopConf, String path) throw
             if (fileStatus.isFile()) {
                 // filter '_SUCCESS' file
                 if (!fileStatus.getPath().getName().equals("_SUCCESS")) {
-                    fileNames.add(fileStatus.getPath().toString());
-                    this.fileNames.add(fileStatus.getPath().toString());
+                    if (!readPartitions.isEmpty()) {
+                        for (String readPartition : readPartitions) {
+                            if (fileStatus.getPath().toString().contains(readPartition)) {
+                                fileNames.add(fileStatus.getPath().toString());
+                                this.fileNames.add(fileStatus.getPath().toString());
+                                break;
+                            }
+                        }
+                    } else {
+                        fileNames.add(fileStatus.getPath().toString());
+                        this.fileNames.add(fileStatus.getPath().toString());
+                    }

Review Comment:
   ```suggestion
                       String fileStatusString = fileStatus.getPath().toString();
                       if (!readPartitions.isEmpty()) {
                           for (String readPartition : readPartitions) {
                               if (fileStatusString.contains(readPartition)) {
                                   fileNames.add(fileStatusString);
                                   this.fileNames.add(fileStatusString);
                                   break;
                               }
                           }
                       } else {
                           fileNames.add(fileStatusString);
                           this.fileNames.add(fileStatusString);
                       }
   ```



-- 
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-unsubscribe@seatunnel.apache.org

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