You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Cheng Su (Jira)" <ji...@apache.org> on 2020/08/25 04:39:00 UTC

[jira] [Updated] (SPARK-26164) [SQL] Allow FileFormatWriter to write multiple partitions/buckets without sort

     [ https://issues.apache.org/jira/browse/SPARK-26164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cheng Su updated SPARK-26164:
-----------------------------
    Affects Version/s: 3.0.0

> [SQL] Allow FileFormatWriter to write multiple partitions/buckets without sort
> ------------------------------------------------------------------------------
>
>                 Key: SPARK-26164
>                 URL: https://issues.apache.org/jira/browse/SPARK-26164
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 2.4.0, 3.0.0
>            Reporter: Cheng Su
>            Priority: Minor
>
> Problem:
> Current spark always requires a local sort before writing to output table on partition/bucket columns [1]. The disadvantage is the sort might waste reserved CPU time on executor due to spill. Hive does not require the local sort before writing output table [2], and we saw performance regression when migrating hive workload to spark.
>  
> Proposal:
> We can avoid the local sort by keeping the mapping between file path and output writer. In case of writing row to a new file path, we create a new output writer. Otherwise, re-use the same output writer if the writer already exists (mainly change should be in FileFormatDataWriter.scala). This is very similar to what hive does in [2].
> Given the new behavior (i.e. avoid sort by keeping multiple output writer) consumes more memory on executor (multiple output writer needs to be opened in same time), than the current behavior (i.e. only one output writer opened). We can add the config to switch between the current and new behavior.
>  
> [1]: spark FileFormatWriter.scala - [https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatWriter.scala#L123]
> [2]: hive FileSinkOperator.java - [https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java#L510]
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org