@@ -125,19 +125,25 @@ struct DataFrameTests {
125
125
await spark. stop ( )
126
126
}
127
127
128
+ #if !os(Linux)
128
129
@Test
129
130
func sort( ) async throws {
130
131
let spark = try await SparkSession . builder. getOrCreate ( )
131
- #expect( try await spark. range ( 10 ) . sort ( " id " ) . count ( ) == 10 )
132
+ let expected = ( 1 ... 10 ) . map { [ String ( $0) ] }
133
+ #expect( try await spark. range ( 10 , 0 , - 1 ) . sort ( " id " ) . collect ( ) == expected)
132
134
await spark. stop ( )
133
135
}
134
136
135
137
@Test
136
138
func orderBy( ) async throws {
137
139
let spark = try await SparkSession . builder. getOrCreate ( )
138
- #expect( try await spark. range ( 10 ) . orderBy ( " id " ) . count ( ) == 10 )
140
+ let expected = ( 1 ... 10 ) . map { [ String ( $0) ] }
141
+ print ( expected)
142
+ print ( try await spark. range ( 10 , 0 , - 1 ) . orderBy ( " id " ) . collect ( ) )
143
+ #expect( try await spark. range ( 10 , 0 , - 1 ) . orderBy ( " id " ) . collect ( ) == expected)
139
144
await spark. stop ( )
140
145
}
146
+ #endif
141
147
142
148
@Test
143
149
func table( ) async throws {
@@ -153,6 +159,17 @@ struct DataFrameTests {
153
159
}
154
160
155
161
#if !os(Linux)
162
+ @Test
163
+ func collect( ) async throws {
164
+ let spark = try await SparkSession . builder. getOrCreate ( )
165
+ #expect( try await spark. range ( 0 ) . collect ( ) . isEmpty)
166
+ #expect(
167
+ try await spark. sql (
168
+ " SELECT * FROM VALUES (1, true, 'abc'), (null, null, null), (3, false, 'def') "
169
+ ) . collect ( ) == [ [ " 1 " , " true " , " abc " ] , [ " NULL " , " NULL " , " NULL " ] , [ " 3 " , " false " , " def " ] ] )
170
+ await spark. stop ( )
171
+ }
172
+
156
173
@Test
157
174
func show( ) async throws {
158
175
let spark = try await SparkSession . builder. getOrCreate ( )
0 commit comments