You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/08/02 10:10:24 UTC

[GitHub] [flink] luoyuxia opened a new pull request, #20419: [FLINK-28774][hive] Allow user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource

luoyuxia opened a new pull request, #20419:
URL: https://github.com/apache/flink/pull/20419

   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   To enable user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource
   
   
   ## Brief change log
     -  Add a configuration `table.exec.hive.dynamic-grouping.enabled` for enable dynamic grouping or not
     - In `HiveTableSInk#requiresPartitionGrouping`, only both  `table.exec.hive.dynamic-grouping.enabled` and passed parameter are true,  return true and set `dynamicGroupingEnabled` = `true`.
   
   
   ## Verifying this change
   The test in 
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (not applicable / **docs** / JavaDocs / not documented)
   


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

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


[GitHub] [flink] wuchong commented on a diff in pull request #20419: [FLINK-28774][hive] Allow user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource

Posted by GitBox <gi...@apache.org>.
wuchong commented on code in PR #20419:
URL: https://github.com/apache/flink/pull/20419#discussion_r940136586


##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveOptions.java:
##########
@@ -77,6 +77,19 @@ public class HiveOptions {
                     .withDescription(
                             "The thread number to split hive's partitions to splits. It should be bigger than 0.");
 
+    public static final ConfigOption<Boolean> TABLE_EXEC_HIVE_DYNAMIC_GROUPING_ENABLED =
+            key("table.exec.hive.dynamic-grouping.enabled")

Review Comment:
   `table.exec.hive.sink.sort-by-dynamic-partition.enable`



##########
docs/content/docs/connectors/table/hive/hive_read_write.md:
##########
@@ -472,6 +472,14 @@ This configuration is set in the `TableConfig` and will affect all sinks of the
   </tbody>
 </table>
 
+### Configuration for Dynamic Partition Inserting 
+By default, if it's for dynamic partition inserting, Flink will sort the data additionally by dynamic partition columns before writing into sink table.

Review Comment:
   Add the following words:
   
   That means the sink will receive all elements of one partition and then all elements of another partition. Elements of different partitions will not be mixed. This is helpful for Hive sink to reduce the number of partition writers and improve writing performance by writing one partition at a time. Otherwise, too many partition writers may cause the OutOfMemory exception. 



##########
docs/content/docs/connectors/table/hive/hive_read_write.md:
##########
@@ -472,6 +472,14 @@ This configuration is set in the `TableConfig` and will affect all sinks of the
   </tbody>
 </table>
 
+### Configuration for Dynamic Partition Inserting 

Review Comment:
   ```suggestion
   ### Dynamic Partition Writing 
   ```



##########
docs/content/docs/connectors/table/hive/hive_read_write.md:
##########
@@ -472,6 +472,14 @@ This configuration is set in the `TableConfig` and will affect all sinks of the
   </tbody>
 </table>
 
+### Configuration for Dynamic Partition Inserting 
+By default, if it's for dynamic partition inserting, Flink will sort the data additionally by dynamic partition columns before writing into sink table.
+
+To avoid the extra sorting, you can set job configuration `table.exec.hive.dynamic-grouping.enabled` (`true` by default) to `false`.
+But with such configuration, it'll throw OOM exception if there are too may dynamic partitions.
+

Review Comment:
   Add some hints about how to tune the dynamic partitioning. For example, add `DISTRIBUTED BY <partition_fields>` for hash shuffling when data is not skewed. You can also manually add `SORTED BY <partition_fields>` to achieve the same purpose as `table.exec.hive.dynamic-grouping.enabled=true`.



##########
docs/content/docs/connectors/table/hive/hive_read_write.md:
##########
@@ -472,6 +472,14 @@ This configuration is set in the `TableConfig` and will affect all sinks of the
   </tbody>
 </table>
 
+### Configuration for Dynamic Partition Inserting 

Review Comment:
   Introduce what's is dynamic partition writing at the beginning. 



##########
docs/content/docs/connectors/table/hive/hive_read_write.md:
##########
@@ -472,6 +472,14 @@ This configuration is set in the `TableConfig` and will affect all sinks of the
   </tbody>
 </table>
 
+### Configuration for Dynamic Partition Inserting 
+By default, if it's for dynamic partition inserting, Flink will sort the data additionally by dynamic partition columns before writing into sink table.
+
+To avoid the extra sorting, you can set job configuration `table.exec.hive.dynamic-grouping.enabled` (`true` by default) to `false`.
+But with such configuration, it'll throw OOM exception if there are too may dynamic partitions.

Review Comment:
   ```suggestion
   But with such a configuration, it may throw OutOfMemory exception if there are too many dynamic partitions.
   ```



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

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


[GitHub] [flink] wuchong merged pull request #20419: [FLINK-28774][hive] Allow user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource

Posted by GitBox <gi...@apache.org>.
wuchong merged PR #20419:
URL: https://github.com/apache/flink/pull/20419


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

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


[GitHub] [flink] wuchong commented on pull request #20419: [FLINK-28774][hive] Allow user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource

Posted by GitBox <gi...@apache.org>.
wuchong commented on PR #20419:
URL: https://github.com/apache/flink/pull/20419#issuecomment-1210176326

   CI is passed: https://dev.azure.com/imjark/Flink/_build/results?buildId=576&view=results


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

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


[GitHub] [flink] luoyuxia commented on pull request #20419: [FLINK-28774][hive] Allow user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource

Posted by GitBox <gi...@apache.org>.
luoyuxia commented on PR #20419:
URL: https://github.com/apache/flink/pull/20419#issuecomment-1210069019

   @flinkbot run azure


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

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


[GitHub] [flink] flinkbot commented on pull request #20419: [FLINK-28774][hive] Allow user to configure whether to enable sort not when it's for dynamic partition writing for HiveSource

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #20419:
URL: https://github.com/apache/flink/pull/20419#issuecomment-1202304700

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08ed51dcda41a7261799a50c8f7dbf66eb6f5439",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "08ed51dcda41a7261799a50c8f7dbf66eb6f5439",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 08ed51dcda41a7261799a50c8f7dbf66eb6f5439 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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

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