Skip to content

Commit 1bf2654

Browse files
committed
Fix style nits
1 parent 722f0e6 commit 1bf2654

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

sql/core/src/main/scala/org/apache/spark/sql/functions.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3466,8 +3466,11 @@ object functions {
34663466
* @group collection_funcs
34673467
* @since 3.0.0
34683468
*/
3469-
def aggregate(expr: Column, zero: Column, merge: (Column, Column) => Column,
3470-
finish: Column => Column): Column = withExpr {
3469+
def aggregate(
3470+
expr: Column,
3471+
zero: Column,
3472+
merge: (Column, Column) => Column,
3473+
finish: Column => Column): Column = withExpr {
34713474
ArrayAggregate(
34723475
expr.expr,
34733476
zero.expr,
@@ -3536,8 +3539,10 @@ object functions {
35363539
* @group collection_funcs
35373540
* @since 3.0.0
35383541
*/
3539-
def map_zip_with(left: Column, right: Column,
3540-
f: (Column, Column, Column) => Column): Column = withExpr {
3542+
def map_zip_with(
3543+
left: Column,
3544+
right: Column,
3545+
f: (Column, Column, Column) => Column): Column = withExpr {
35413546
MapZipWith(left.expr, right.expr, createLambda(f))
35423547
}
35433548

sql/core/src/test/java/test/org/apache/spark/sql/JavaHigherOrderFunctionsSuite.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,17 @@ public void testTransform() {
8989
makeArray(6, 9, 10, 8, 3),
9090
JavaTestUtils.<Integer>makeArray(),
9191
null
92-
));
92+
)
93+
);
9394
checkAnswer(
9495
arrDf.select(transform(col("x"), (x, i) -> x.plus(i))),
9596
toRows(
9697
makeArray(1, 10, 10, 10),
9798
makeArray(5, 9, 11, 10, 6),
9899
JavaTestUtils.<Integer>makeArray(),
99100
null
100-
));
101+
)
102+
);
101103
}
102104

103105
@Test
@@ -109,7 +111,8 @@ public void testFilter() {
109111
makeArray(9),
110112
JavaTestUtils.<Integer>makeArray(),
111113
null
112-
));
114+
)
115+
);
113116
}
114117

115118
@Test
@@ -121,7 +124,8 @@ public void testExists() {
121124
true,
122125
false,
123126
null
124-
));
127+
)
128+
);
125129
}
126130

127131
@Test
@@ -133,7 +137,8 @@ public void testForall() {
133137
false,
134138
true,
135139
null
136-
));
140+
)
141+
);
137142
}
138143

139144
@Test
@@ -145,15 +150,17 @@ public void testAggregate() {
145150
31,
146151
0,
147152
null
148-
));
153+
)
154+
);
149155
checkAnswer(
150156
arrDf.select(aggregate(col("x"), lit(0), (acc, x) -> acc.plus(x), x -> x)),
151157
toRows(
152158
25,
153159
31,
154160
0,
155161
null
156-
));
162+
)
163+
);
157164
}
158165

159166
@Test
@@ -165,35 +172,36 @@ public void testZipWith() {
165172
makeArray(42, 42, 42, 42, 42),
166173
JavaTestUtils.<Integer>makeArray(),
167174
null
168-
));
175+
)
176+
);
169177
}
170178

171179
@Test
172180
public void testTransformKeys() {
173181
checkAnswer(
174182
mapDf.select(transform_keys(col("x"), (k, v) -> k.plus(v))),
175183
toRows(
176-
mapAsScalaMap(
177-
new HashMap<Integer, Integer>() {{
184+
mapAsScalaMap(new HashMap<Integer, Integer>() {{
178185
put(2, 1);
179186
put(4, 2);
180187
}}),
181188
null
182-
));
189+
)
190+
);
183191
}
184192

185193
@Test
186194
public void testTransformValues() {
187195
checkAnswer(
188196
mapDf.select(transform_values(col("x"), (k, v) -> k.plus(v))),
189197
toRows(
190-
mapAsScalaMap(
191-
new HashMap<Integer, Integer>() {{
198+
mapAsScalaMap(new HashMap<Integer, Integer>() {{
192199
put(1, 2);
193200
put(2, 4);
194201
}}),
195202
null
196-
));
203+
)
204+
);
197205
}
198206

199207
@Test
@@ -203,7 +211,8 @@ public void testMapFilter() {
203211
toRows(
204212
mapAsScalaMap(new HashMap<Integer, Integer>()),
205213
null
206-
));
214+
)
215+
);
207216
}
208217

209218
@Test
@@ -216,6 +225,7 @@ public void testMapZipWith() {
216225
put(2, false);
217226
}}),
218227
null
219-
));
228+
)
229+
);
220230
}
221231
}

0 commit comments

Comments
 (0)