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 07:49:47 UTC

[GitHub] [incubator-seatunnel] TyrantLucifer opened a new pull request, #3842: [Improve][Connector-V2][Hive] Support assign partitions

TyrantLucifer opened a new pull request, #3842:
URL: https://github.com/apache/incubator-seatunnel/pull/3842

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   close #3841 
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update change log that in connector document. For more details you can refer to [connector-v2](https://github.com/apache/incubator-seatunnel/tree/dev/docs/en/connector-v2)
     2. Update [plugin-mapping.properties](https://github.com/apache/incubator-seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     3. Update the pom file of [seatunnel-dist](https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-dist/pom.xml)


-- 
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


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

Posted by "ic4y (via GitHub)" <gi...@apache.org>.
ic4y commented on PR #3842:
URL: https://github.com/apache/incubator-seatunnel/pull/3842#issuecomment-1407619269

   Please update the [release-note](https://github.com/apache/incubator-seatunnel/blob/dev/release-note.md)


-- 
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


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

Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on code in PR #3842:
URL: https://github.com/apache/incubator-seatunnel/pull/3842#discussion_r1059873957


##########
docs/en/connector-v2/source/Hive.md:
##########
@@ -33,11 +33,12 @@ Read all the data in a split in a pollNext call. What splits are read will be sa
 
 ## Options
 
-| name           | type   | required | default value |
-|----------------|--------|----------|---------------|
-| table_name     | string | yes      | -             |
-| metastore_uri  | string | yes      | -             |
-| common-options |        | no       | -             |
+| name            | type   | required | default value |
+|-----------------|--------|----------|---------------|
+| table_name      | string | yes      | -             |
+| metastore_uri   | string | yes      | -             |
+| read_partitions | string | no       | -             |

Review Comment:
   array is better? For example `read_partitions=[par1=true, par1=false/par2=true]`



-- 
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


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

Posted by "TyrantLucifer (via GitHub)" <gi...@apache.org>.
TyrantLucifer commented on PR #3842:
URL: https://github.com/apache/incubator-seatunnel/pull/3842#issuecomment-1407620061

   > Please update the [release-note](https://github.com/apache/incubator-seatunnel/blob/dev/release-note.md)
   
   Done. Thank you for your review.


-- 
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


[GitHub] [incubator-seatunnel] CalvinKirs merged pull request #3842: [Improve][Connector-V2][Hive] Support assign partitions

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


-- 
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


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

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on PR #3842:
URL: https://github.com/apache/incubator-seatunnel/pull/3842#issuecomment-1368384772

   ```hocon
   env {
     spark.app.name = "SeaTunnel"
     spark.executor.instances = 2
     spark.executor.cores = 1
     spark.executor.memory = "1g"
     job.mode = "BATCH"
     spark.master = local
   }
   
   source {
     Hive {
       table_name = "default.hive_multi_partitions"
       metastore_uri = "thrift://hadoop001:9083"
       read_partitions = ["par1=true"]
     }
   }
   
   sink {
     Console {}
   }
   ```
   
   ![image](https://user-images.githubusercontent.com/51053924/210164794-973f0f36-4fad-4c84-88c6-7da1d9bf1118.png)
   
   ```hocon
   env {
     spark.app.name = "SeaTunnel"
     spark.executor.instances = 2
     spark.executor.cores = 1
     spark.executor.memory = "1g"
     job.mode = "BATCH"
     spark.master = local
   }
   
   source {
     Hive {
       table_name = "default.hive_multi_partitions"
       metastore_uri = "thrift://hadoop001:9083"
       read_partitions = ["par1=true/par2=false"]
     }
   }
   
   sink {
     Console {}
   }
   ```
   
   ![image](https://user-images.githubusercontent.com/51053924/210164861-42094d3c-b297-449b-bdd4-b5eefe28c68b.png)
   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
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