Skip to content

Commit 20822c8

Browse files
committed
Improvements based on other reviews
1 parent 7e3da2c commit 20822c8

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

src/Functions/array/arrayCompact.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ using FunctionArrayCompact = FunctionArrayMapped<ArrayCompactImpl, NameArrayComp
162162
REGISTER_FUNCTION(ArrayCompact)
163163
{
164164
FunctionDocumentation::Description description = "Removes consecutive duplicate elements from an array. The order of result values is determined by the order in the source array.";
165-
FunctionDocumentation::Syntax syntax = "arrayCompact(x)";
165+
FunctionDocumentation::Syntax syntax = "arrayCompact(arr)";
166166
FunctionDocumentation::Arguments arguments = {
167-
{"x", "An array to remove duplicates from. [`Array`](/sql-reference/data-types/array)"}
167+
{"arr", "An array to remove duplicates from. [`Array(T)`](/sql-reference/data-types/array)"}
168168
};
169-
FunctionDocumentation::ReturnedValue returned_value = "Returns an array without duplicate values. [`Array`](/sql-reference/data-types/array).";
169+
FunctionDocumentation::ReturnedValue returned_value = "Returns an array without duplicate values. [`Array(T)`](/sql-reference/data-types/array).";
170170
FunctionDocumentation::Examples examples = {{"Usage example", "SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]);", "[1,nan,nan,2,3]"}};
171171
FunctionDocumentation::IntroducedIn introduced_in = {20, 1};
172172
FunctionDocumentation::Category category = FunctionDocumentation::Category::Array;

src/Functions/array/arrayFlatten.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ Converts an array of arrays to a flat array.
132132
133133
The flattened array contains all the elements from all source arrays.
134134
)";
135-
FunctionDocumentation::Syntax syntax = "arrayFlatten(x)";
135+
FunctionDocumentation::Syntax syntax = "arrayFlatten(arr)";
136136
FunctionDocumentation::Arguments arguments = {
137-
{"x", "A multidimensional array. [`Array`](/sql-reference/data-types/array)(`Array`)"}
137+
{"arr", "A multidimensional array. [`Array(T)`](/sql-reference/data-types/array)(`Array`)"}
138138
};
139-
FunctionDocumentation::ReturnedValue returned_value = "Returns a flattened array from the multidimensional array. [`Array`](/sql-reference/data-types/array).";
139+
FunctionDocumentation::ReturnedValue returned_value = "Returns a flattened array from the multidimensional array. [`Array(T)`](/sql-reference/data-types/array).";
140140
FunctionDocumentation::Examples examples = {{"Usage example", "SELECT arrayFlatten([[[1]], [[2], [3]]]);", "[1,2,3]"}};
141141
FunctionDocumentation::IntroducedIn introduced_in = {20, 1};
142142
FunctionDocumentation::Category category = FunctionDocumentation::Category::Array;

src/Functions/array/arrayFold.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,13 @@ class FunctionArrayFold : public IFunction
290290
REGISTER_FUNCTION(ArrayFold)
291291
{
292292
FunctionDocumentation::Description description = "Applies a lambda function to one or more equally-sized arrays and collects the result in an accumulator.";
293-
FunctionDocumentation::Syntax syntax = "arrayFold(λ(acc, x1 [, x2, x3, ... xN]), x1 [, x2, x3, ... xN], acc)";
293+
FunctionDocumentation::Syntax syntax = "arrayFold(λ(acc, x1 [, x2, x3, ... xN]), arr1 [, arr2, arr3, ... arrN], acc)";
294294
FunctionDocumentation::Arguments arguments = {
295-
{"λ(acc, x1 [, x2, x3, ... xN])", "A lambda function `λ(acc, x1 [, x2, x3, ... xN]) → F(acc, x1 [, x2, x3, ... xN])` where `F` is an operation applied to `acc` and the values of one, or multiple arrays, with the result of `acc` re-used. [Lambda function](/sql-reference/functions/overview#arrow-operator-and-lambda)"},
296-
{"x1 [, x2, x3, ... xN]", "N arrays over which to operate. [Array](/sql-reference/data-types/array)"},
295+
{"λ(x, x1 [, x2, x3, ... xN])", "A lambda function `λ(acc, x1 [, x2, x3, ... xN]) → F(acc, x1 [, x2, x3, ... xN])` where `F` is an operation applied to `acc` and array values from `x` with the result of `acc` re-used. [Lambda function](/sql-reference/functions/overview#arrow-operator-and-lambda)."},
296+
{"arr1 [, arr2, arr3, ... arrN]", "N arrays over which to operate. [`Array(T)`](/sql-reference/data-types/array)"},
297297
{"acc", "Accumulator value with the same type as the return type of the Lambda function."}
298298
};
299-
FunctionDocumentation::ReturnedValue returned_value = "Returns the result of the lambda sequentially applied to each";
299+
FunctionDocumentation::ReturnedValue returned_value = "Returns the final `acc` value.";
300300
FunctionDocumentation::Examples examples = {
301301
{
302302
"Usage example",

src/Functions/array/arrayJaccardIndex.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ class FunctionArrayJaccardIndex : public IFunction
152152
REGISTER_FUNCTION(ArrayJaccardIndex)
153153
{
154154
FunctionDocumentation::Description description = "Returns the [Jaccard index](https://en.wikipedia.org/wiki/Jaccard_index) of two arrays.";
155-
FunctionDocumentation::Syntax syntax = "arrayJaccardIndex(x, y)";
155+
FunctionDocumentation::Syntax syntax = "arrayJaccardIndex(arr_x, arr_y)";
156156
FunctionDocumentation::Arguments arguments = {
157-
{"x", "First array. [Array](/sql-reference/data-types/array)."},
158-
{"y", "Second array. [Array](/sql-reference/data-types/array)."},
157+
{"arr_x", "First array. [`Array(T)`](/sql-reference/data-types/array)."},
158+
{"arr_y", "Second array. [`Array(T)`](/sql-reference/data-types/array)."},
159159
};
160-
FunctionDocumentation::ReturnedValue returned_value = "Returns the Jaccard index of `x` and `y`.[Float64](/sql-reference/data-types/float)";
160+
FunctionDocumentation::ReturnedValue returned_value = "Returns the Jaccard index of `arr_x` and `arr_y`.[Float64](/sql-reference/data-types/float)";
161161
FunctionDocumentation::Examples examples = {{"Usage example", "SELECT arrayJaccardIndex([1, 2], [2, 3]) AS res", "0.3333333333333333"}};
162162
FunctionDocumentation::IntroducedIn introduced_in = {23, 7};
163163
FunctionDocumentation::Category category = FunctionDocumentation::Category::Array;

src/Functions/array/arrayReduce.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ Applies an aggregate function to array elements and returns its result.
221221
The name of the aggregation function is passed as a string in single quotes `'max'`, `'sum'`.
222222
When using parametric aggregate functions, the parameter is indicated after the function name in parentheses `'uniqUpTo(6)'`.
223223
)";
224-
FunctionDocumentation::Syntax syntax = "arrayReduce(agg_f, x1, x2, ..., xN)";
224+
FunctionDocumentation::Syntax syntax = "arrayReduce(agg_f, arr1 [, arr2, ... , arrN)]";
225225
FunctionDocumentation::Arguments arguments = {
226-
{"agg_f", "The name of an aggregate function which should be a constant [string](/sql-reference/data-types/string)."},
227-
{"xN", "Any number of [array](/sql-reference/data-types/array) type columns as the parameters of the aggregation function."},
226+
{"agg_f", "The name of an aggregate function which should be a constant [String](/sql-reference/data-types/string)."},
227+
{"arr1 [, arr2, ... , arrN)]", "N arrays corresponding to the arguments of `agg_f`. [`Array(T)`](/sql-reference/data-types/array)."},
228228
};
229229
FunctionDocumentation::ReturnedValue returned_value = "Returns the result of the aggregate function";
230230
FunctionDocumentation::Examples examples = {{"Usage example", "SELECT arrayReduce('max', [1, 2, 3]);", R"(

src/Functions/array/arrayReduceInRanges.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,16 @@ ColumnPtr FunctionArrayReduceInRanges::executeImpl(
388388
REGISTER_FUNCTION(ArrayReduceInRanges)
389389
{
390390
FunctionDocumentation::Description description = R"(
391-
Applies an aggregate function to array elements in given ranges and returns an array containing the result corresponding to each range.
391+
Applies an aggregate function to array elements in the given ranges and returns an array containing the result corresponding to each range.
392392
The function will return the same result as multiple `arrayReduce(agg_func, arraySlice(arr1, index, length), ...)`.
393393
)";
394-
FunctionDocumentation::Syntax syntax = "arrayReduceInRanges(agg_f, ranges, x1, x2, ..., xN)";
394+
FunctionDocumentation::Syntax syntax = "arrayReduceInRanges(agg_f, ranges, arr1 [, arr2, ... ,arrN)]";
395395
FunctionDocumentation::Arguments arguments = {
396396
{"agg_f", "The name of the aggregate function to use. [String](/sql-reference/data-types/string)"},
397-
{"ranges", "The range over which to aggregate. An array of tuples, `(i, r)` containing the index `i` from which to begin from and the range `r` over which to aggregate [Array](/sql-reference/data-types/array)([Tuple](/sql-reference/data-types/tuple))"},
398-
{"x1, x2, ..., xN", "N arrays as arguments to the aggregate function. [Array](/sql-reference/data-types/array)."},
397+
{"ranges", "The range over which to aggregate. An array of tuples, `(i, r)` containing the index `i` from which to begin from and the range `r` over which to aggregate [`Array(T)`](/sql-reference/data-types/array)([`Tuple(T1, T2, ...)`](/sql-reference/data-types/tuple))"},
398+
{"arr1 [, arr2, ... ,arrN)]", "N arrays as arguments to the aggregate function. [`Array(T)`](/sql-reference/data-types/array)."},
399399
};
400-
FunctionDocumentation::ReturnedValue returned_value = "Returns an array containing results of the aggregate function over the specified ranges. [Array](/sql-reference/data-types/array).";
400+
FunctionDocumentation::ReturnedValue returned_value = "Returns an array containing results of the aggregate function over the specified ranges. [`Array(T)`](/sql-reference/data-types/array).";
401401
FunctionDocumentation::Examples examples = {{"Usage example", R"(
402402
SELECT arrayReduceInRanges(
403403
'sum',

src/Functions/array/arrayReverse.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,18 @@ bool FunctionArrayReverse::executeString(const IColumn & src_data, const ColumnA
247247
REGISTER_FUNCTION(ArrayReverse)
248248
{
249249
FunctionDocumentation::Description description = R"(
250-
Reverses an array.
250+
Reverses the order of elements of a given array.
251251
252252
:::note
253-
Function `reverse(x)` performs the same functionality but works on other data-types
253+
Function `reverse(arr)` performs the same functionality but works on other data-types
254254
in addition to Arrays.
255255
:::
256256
)";
257-
FunctionDocumentation::Syntax syntax = "arrayReverse(x)";
257+
FunctionDocumentation::Syntax syntax = "arrayReverse(arr)";
258258
FunctionDocumentation::Arguments arguments = {
259-
{"x", "An array to reverse. [Array](/sql-reference/data-types/array)"}
259+
{"arr", "The array to reverse. [`Array(T)`](/sql-reference/data-types/array)."}
260260
};
261-
FunctionDocumentation::ReturnedValue returned_value = "Returns an array of the same size as the original array containing the elements in reverse order. [Array](/sql-reference/data-types/array)";
261+
FunctionDocumentation::ReturnedValue returned_value = "Returns an array of the same size as the original array containing the elements in reverse order. [`Array(T)`](/sql-reference/data-types/array).";
262262
FunctionDocumentation::Examples examples = {{"Usage example", "SELECT arrayReverse([1, 2, 3])", "[3,2,1]"}};
263263
FunctionDocumentation::IntroducedIn introduced_in = {1, 1};
264264
FunctionDocumentation::Category category = FunctionDocumentation::Category::Array;

src/Functions/array/arrayZip.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,20 @@ class FunctionArrayZip : public IFunction
172172
REGISTER_FUNCTION(ArrayZip)
173173
{
174174
FunctionDocumentation::Description description = "Combines multiple arrays into a single array. The resulting array contains the corresponding elements of the source arrays grouped into tuples in the listed order of arguments.";
175-
FunctionDocumentation::Syntax syntax = "arrayZip(x1, x2, ..., xN)";
176-
FunctionDocumentation::Arguments argument = {{"x1, x2, ..., xN", "N arrays to combine into a single array. [`Array`](/sql-reference/data-types/array)"}};
177-
FunctionDocumentation::ReturnedValue returned_value = "Returns an array with elements from the source arrays grouped in tuples. Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed. [`Array`](/sql-reference/data-types/array)([`Tuple`](/sql-reference/data-types/tuple)).";
175+
FunctionDocumentation::Syntax syntax = "arrayZip(arr1, arr2, ..., arrN)";
176+
FunctionDocumentation::Arguments argument = {{"arr1, arr2, ..., arrN", "N arrays to combine into a single array. [`Array(T)`](/sql-reference/data-types/array)"}};
177+
FunctionDocumentation::ReturnedValue returned_value = "Returns an array with elements from the source arrays grouped in tuples. Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed. [`Array(T)`](/sql-reference/data-types/array)([`Tuple`](/sql-reference/data-types/tuple)).";
178178
FunctionDocumentation::Examples example = {{"Usage example", "SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]);", "[('a',5),('b',2),('c',1)]"}};
179179
FunctionDocumentation::IntroducedIn introduced_in = {20, 1};
180180
FunctionDocumentation::Category category = FunctionDocumentation::Category::Array;
181181
FunctionDocumentation documentation = {description, syntax, argument, returned_value, example, introduced_in, category};
182182

183183
factory.registerFunction<FunctionArrayZip<false>>(documentation);
184184

185-
FunctionDocumentation::Description description_unaligned = "Combines multiple arrays into a single array, allowing for unaligned arrays (arrays of different lengths). The resulting array contains the corresponding elements of the source arrays grouped into tuples in the listed order of arguments.";
186-
FunctionDocumentation::Syntax syntax_unaligned = "arrayZipUnaligned(x1, x2, ..., xN)";
187-
FunctionDocumentation::Arguments argument_unaligned = {{"x1, x2, ..., xN", "N arrays to combine into a single array. [`Array`](/sql-reference/data-types/array)."}};
188-
FunctionDocumentation::ReturnedValue returned_value_unaligned = "Returns an array with elements from the source arrays grouped in tuples. Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed. [`Array`](/sql-reference/data-types/array)([`Tuple`](/sql-reference/data-types/tuple)).";
185+
FunctionDocumentation::Description description_unaligned = "Combines multiple arrays into a single array, allowing for unaligned arrays (arrays of differing lengths). The resulting array contains the corresponding elements of the source arrays grouped into tuples in the listed order of arguments.";
186+
FunctionDocumentation::Syntax syntax_unaligned = "arrayZipUnaligned(arr1, arr2, ..., arrN)";
187+
FunctionDocumentation::Arguments argument_unaligned = {{"arr1, arr2, ..., arrN", "N arrays to combine into a single array. [`Array(T)`](/sql-reference/data-types/array)."}};
188+
FunctionDocumentation::ReturnedValue returned_value_unaligned = "Returns an array with elements from the source arrays grouped in tuples. Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed. [`Array(T)`](/sql-reference/data-types/array)([`Tuple(T1, T2, ...)`](/sql-reference/data-types/tuple)).";
189189
FunctionDocumentation::Examples example_unaligned = {{"Usage example", "SELECT arrayZipUnaligned(['a'], [1, 2, 3]);", "[('a',1),(NULL,2),(NULL,3)]"}};
190190
FunctionDocumentation::IntroducedIn introduced_in_unaligned = {20, 1};
191191
FunctionDocumentation::Category category_unaligned = FunctionDocumentation::Category::Array;

0 commit comments

Comments
 (0)