@@ -212,6 +212,33 @@ from large_nested_arrays_with_repeating_elements;
212212[[1, 2, 3], [4, 5, 6], [4, 5, 6], [10, 11, 12], [13, 14, 15], [10, 11, 12], [10, 11, 12], [28, 29, 30], [19, 20, 21], [28, 29, 30], [19, 20, 21], [22, 23, 24]] [[19, 20, 21], [19, 20, 21], [19, 20, 21], [22, 23, 24], [19, 20, 21], [25, 26, 27], [19, 20, 21], [22, 23, 24], [19, 20, 21], [19, 20, 21]] [[11, 12, 13], [19, 20, 21], [19, 20, 21], [22, 23, 24], [19, 20, 21], [25, 26, 27], [19, 20, 21], [22, 23, 24], [19, 20, 21], [19, 20, 21]]
213213[[1, 2, 3], [4, 5, 6], [4, 5, 6], [10, 11, 12], [13, 14, 15], [10, 11, 12], [10, 11, 12], [19, 20, 21], [19, 20, 21], [37, 38, 39], [19, 20, 21], [22, 23, 24]] [[28, 29, 30], [31, 32, 33], [34, 35, 36], [28, 29, 30], [31, 32, 33], [34, 35, 36], [28, 29, 30], [31, 32, 33], [34, 35, 36], [28, 29, 30]] [[11, 12, 13], [31, 32, 33], [34, 35, 36], [28, 29, 30], [31, 32, 33], [34, 35, 36], [28, 29, 30], [31, 32, 33], [34, 35, 36], [28, 29, 30]]
214214
215+ # array_replace scalar arguments over multiple input rows
216+ query ???
217+ select
218+ array_replace(column1, 2, 9),
219+ array_replace_n(column1, 2, 9, 2),
220+ array_replace_all(column1, 2, 9)
221+ from (
222+ values
223+ (make_array(1, 2, 2, 3)),
224+ (make_array(2, 4, 2))
225+ ) as t(column1);
226+ ----
227+ [1, 9, 2, 3] [1, 9, 9, 3] [1, 9, 9, 3]
228+ [9, 4, 2] [9, 4, 9] [9, 4, 9]
229+
230+ # array_replace_n scalar max exceeding matches over multiple input rows
231+ query ?
232+ select array_replace_n(column1, 2, 9, 10)
233+ from (
234+ values
235+ (make_array(1, 2, 2, 3)),
236+ (make_array(2, 4, 2))
237+ ) as t(column1);
238+ ----
239+ [1, 9, 9, 3]
240+ [9, 4, 9]
241+
215242## array_replace_n (aliases: `list_replace_n`)
216243
217244# array_replace_n scalar function #1
@@ -226,22 +253,35 @@ select
226253----
227254[1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3] [1, 4, 4] [1, 4, 4] [0, 4, 0, 5]
228255
229- query ????
256+ query ??????
230257select
231258 array_replace_n(arrow_cast(make_array(1, 2, 3, 4), 'LargeList(Int64)'), 2, 3, 2),
232259 array_replace_n(arrow_cast(make_array(1, 4, 4, 5, 4, 6, 7), 'LargeList(Int64)'), 4, 0, 2),
233260 array_replace_n(arrow_cast(make_array(1, 2, 3), 'LargeList(Int64)'), 4, 0, 3),
234- array_replace_n(arrow_cast(make_array(1, 4, 4), 'LargeList(Int64)'), 4, 0, 0);
261+ array_replace_n(arrow_cast(make_array(1, 4, 4), 'LargeList(Int64)'), 4, 0, 0),
262+ array_replace_n(arrow_cast(make_array(1, 4, 4), 'LargeList(Int64)'), 4, 0, -1),
263+ array_replace_n(arrow_cast(make_array(1, 4, 1, 5), 'LargeList(Int64)'), 1, 0, 10);
235264----
236- [1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3] [1, 4, 4]
265+ [1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3] [1, 4, 4] [1, 4, 4] [0, 4, 0, 5]
237266
238- query ???
267+ query ??????
239268select
240269 array_replace_n(arrow_cast(make_array(1, 2, 3, 4), 'FixedSizeList(4, Int64)'), 2, 3, 2),
241270 array_replace_n(arrow_cast(make_array(1, 4, 4, 5, 4, 6, 7), 'FixedSizeList(7, Int64)'), 4, 0, 2),
242- array_replace_n(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3, Int64)'), 4, 0, 3);
271+ array_replace_n(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3, Int64)'), 4, 0, 3),
272+ array_replace_n(arrow_cast(make_array(1, 4, 4), 'FixedSizeList(3, Int64)'), 4, 0, 0),
273+ array_replace_n(arrow_cast(make_array(1, 4, 4), 'FixedSizeList(3, Int64)'), 4, 0, -1),
274+ array_replace_n(arrow_cast(make_array(1, 4, 1, 5), 'FixedSizeList(4, Int64)'), 1, 0, 10);
243275----
244- [1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3]
276+ [1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3] [1, 4, 4] [1, 4, 4] [0, 4, 0, 5]
277+
278+ # array_replace_n scalar max exceeding matches for empty arrays
279+ query ??
280+ select
281+ array_replace_n(arrow_cast(make_array(), 'List(Int64)'), 2, 9, 10),
282+ array_replace_n(arrow_cast(make_array(), 'LargeList(Int64)'), 2, 9, 10);
283+ ----
284+ [] []
245285
246286# array_replace_n scalar function #2 (element is list)
247287query ??
@@ -657,6 +697,14 @@ select column1, column2, column3, column4, array_replace_n(column1, column2, col
657697NULL 3 2 1 NULL
658698[3, 1, 3] 3 NULL 1 [NULL, 1, 3]
659699
700+ query ???
701+ select
702+ array_replace(make_array(3, NULL, NULL), NULL, 5),
703+ array_replace_n(make_array(3, NULL, NULL), NULL, 5, 10),
704+ array_replace_all(make_array(3, NULL, NULL), NULL, 5);
705+ ----
706+ [3, 5, NULL] [3, 5, 5] [3, 5, 5]
707+
660708
661709
662710statement ok
0 commit comments