kozakana opened a new pull request #30803:
URL: https://github.com/apache/spark/pull/30803


   ### What changes were proposed in this pull request?
   
   [The PySpark 
documentation](https://spark.apache.org/docs/3.0.1/api/python/pyspark.sql.html#pyspark.sql.DataFrame.join)
 says "Must be one of: inner, cross, outer, full, fullouter, full_outer, left, 
leftouter, left_outer, right, rightouter, right_outer, semi, leftsemi, 
left_semi, anti, leftanti and left_anti."
   However, I get the following error when I set the cross option.
   
   ```
   scala> val df1 = spark.createDataFrame(Seq((1,"a"),(2,"b")))
   df1: org.apache.spark.sql.DataFrame = [_1: int, _2: string]
   
   scala> val df2 = spark.createDataFrame(Seq((1,"A"),(2,"B"), (3, "C")))
   df2: org.apache.spark.sql.DataFrame = [_1: int, _2: string]
   
   scala> df1.join(right = df2, usingColumns = Seq("_1"), joinType = 
"cross").show()
   java.lang.IllegalArgumentException: requirement failed: Unsupported using 
join type Cross
     at scala.Predef$.require(Predef.scala:281)
     at 
org.apache.spark.sql.catalyst.plans.UsingJoin.<init>(joinTypes.scala:106)
     at org.apache.spark.sql.Dataset.join(Dataset.scala:1025)
     ... 53 elided
   ```
   
   ### Why are the changes needed?
   
   The documentation says cross option can be set, but when I try to set it, I 
get an java.lang.IllegalArgumentException.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Accepting this PR fix will behave the same as the documentation.
   
   ### How was this patch tested?
   
   There is already a test for 
[JoinTypes](https://github.com/apache/spark/blob/1b9fd67904671ea08526bfb7a97d694815d47665/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans/JoinTypesTest.scala),
 but I can't find a test for the join option itself.
   


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

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to