File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -813,22 +813,24 @@ struct DataFrameTests {
813813 @Test
814814 func transpose( ) async throws {
815815 let spark = try await SparkSession . builder. getOrCreate ( )
816- #expect( try await spark. range ( 1 ) . transpose ( ) . columns == [ " key " , " 0 " ] )
817- #expect( try await spark. range ( 1 ) . transpose ( ) . count ( ) == 0 )
818-
819- let df = try await spark. sql (
816+ if await spark. version. starts ( with: " 4. " ) {
817+ #expect( try await spark. range ( 1 ) . transpose ( ) . columns == [ " key " , " 0 " ] )
818+ #expect( try await spark. range ( 1 ) . transpose ( ) . count ( ) == 0 )
819+
820+ let df = try await spark. sql (
820821 """
821822 SELECT * FROM
822823 VALUES ('A', 1, 2),
823824 ('B', 3, 4)
824825 T(id, val1, val2)
825826 """ )
826- let expected = [
827- Row ( " val1 " , 1 , 3 ) ,
828- Row ( " val2 " , 2 , 4 ) ,
829- ]
830- #expect( try await df. transpose ( ) . collect ( ) == expected)
831- #expect( try await df. transpose ( " id " ) . collect ( ) == expected)
827+ let expected = [
828+ Row ( " val1 " , 1 , 3 ) ,
829+ Row ( " val2 " , 2 , 4 ) ,
830+ ]
831+ #expect( try await df. transpose ( ) . collect ( ) == expected)
832+ #expect( try await df. transpose ( " id " ) . collect ( ) == expected)
833+ }
832834 await spark. stop ( )
833835 }
834836#endif
You can’t perform that action at this time.
0 commit comments