[ 
https://issues.apache.org/jira/browse/SPARK-44512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17746025#comment-17746025
 ] 

Yiu-Chung Lee edited comment on SPARK-44512 at 7/25/23 7:32 AM:
----------------------------------------------------------------

Here is the 
[gist|https://gist.github.com/leeyc0/2bdab65901fe5754c471832acdc00890] that 
reproduces the issue.

To compile: javac Test.java && jar cvf Test.jar Test.class
bug reproduce: spark-submit --class Test Test.jar
no bug: spark-submit --conf spark.sql.optimizer.plannedWrite.enabled=false 
--class Test Test.jar

(the following commands are either invalid or no longer necessary)
-no bug if workaround is enabled: spark-submit --class Test Test.jar workaround-
-no bug too if AQE is disabled: spark-submit --conf 
spark.sql.adaptive.enabled=false --class Test Test.jar (3 output files in each 
partition key)-

 


was (Author: JIRAUSER301473):
Here is the 
[gist|https://gist.github.com/leeyc0/2bdab65901fe5754c471832acdc00890] that 
reproduces the issue.

To compile: javac Test.java && jar cvf Test.jar Test.class
bug reproduce: spark-submit --class Test Test.jar
no bug: spark-submit --conf spark.sql.optimizer.plannedWrite.enabled=false 
--class Test Test.jar
-no bug if workaround is enabled: spark-submit --class Test Test.jar workaround-
-no bug too if AQE is disabled: spark-submit --conf 
spark.sql.adaptive.enabled=false --class Test Test.jar (3 output files in each 
partition key)-

 

> dataset.sort.select.write.partitionBy does not return a sorted output
> ---------------------------------------------------------------------
>
>                 Key: SPARK-44512
>                 URL: https://issues.apache.org/jira/browse/SPARK-44512
>             Project: Spark
>          Issue Type: Bug
>          Components: Optimizer, SQL
>    Affects Versions: 3.4.1
>            Reporter: Yiu-Chung Lee
>            Priority: Major
>              Labels: correctness
>
> (In this example the dataset is of type Tuple3, and the columns are named _1, 
> _2 and _3)
>  
> I found -then when AQE is enabled,- that the following code does not produce 
> sorted output (.drop() also have the same problem), unless 
> spark.sql.optimizer.plannedWrite.enabled is set to false
> {{dataset.sort("_1")}}
> {{.select("_2", "_3")}}
> {{.write()}}
> {{.partitionBy("_2")}}
> {{.text("output");}}
>  
> (the following workaround is no longer necessary)
> -However, if I insert an identity mapper between select and write, the output 
> would be sorted as expected.-
> -{{dataset = dataset.sort("_1")}}-
> -{{.select("_2", "_3");}}-
> -{{dataset.map((MapFunction<Row, Row>) row -> row, dataset.encoder())}}-
> -{{.write()}}-
> -{{{}.{}}}{{{}partitionBy("_2"){}}}-
> -{{.text("output")}}-
> Below is the complete code that reproduces the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to