File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -2022,9 +2022,20 @@ def test_toDF_with_schema_string(self):
20222022 self .assertEqual (df .collect (), [Row (key = i ) for i in range (100 )])
20232023
20242024 def test_join_without_on (self ):
2025- self .assertRaises (
2026- AnalysisException ,
2027- lambda : self .spark .range (1 ).join (self .spark .range (1 ), how = "inner" ).collect ())
2025+ df1 = self .spark .range (1 ).toDF ("a" )
2026+ df2 = self .spark .range (1 ).toDF ("b" )
2027+
2028+ try :
2029+ self .spark .conf .set ("spark.sql.crossJoin.enabled" , "false" )
2030+ self .assertRaises (AnalysisException , lambda : df1 .join (df2 , how = "inner" ).collect ())
2031+
2032+ self .spark .conf .set ("spark.sql.crossJoin.enabled" , "true" )
2033+ actual = df1 .join (df2 , how = "inner" ).collect ()
2034+ expected = [Row (a = 0 , b = 0 )]
2035+ self .assertEqual (actual , expected )
2036+ finally :
2037+ # We should unset this. Otherwise, other tests are affected.
2038+ self .spark .conf .unset ("spark.sql.crossJoin.enabled" )
20282039
20292040 # Regression test for invalid join methods when on is None, Spark-14761
20302041 def test_invalid_join_method (self ):
You can’t perform that action at this time.
0 commit comments