Skip to content

Commit 6aaa014

Browse files
committed
Fix build
1 parent d5d4ee2 commit 6aaa014

File tree

4 files changed

+54
-7
lines changed

4 files changed

+54
-7
lines changed

src/Functions/array/arrayAUC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ For more details, please see [here](https://developers.google.com/machine-learni
504504
FunctionDocumentation::Arguments arguments_roc = {
505505
{"scores", "Scores prediction model gives. [`Array(T)`](/sql-reference/data-types/array) of [Integers](../data-types/int-uint.md) or [Floats](../data-types/float.md)."},
506506
{"labels", "Labels of samples, usually 1 for positive sample and 0 for negative sample. [Array](/sql-reference/data-types/array) of [Integers](../data-types/int-uint.md) or [Enums](../data-types/enum.md)."},
507-
{"scale", "Decides whether to return the normalized area. If false, returns the area under the TP (true positives) x FP (false positives) curve instead. Default value: true. [Bool](../data-types/boolean.md). Optional."}
507+
{"scale", "Decides whether to return the normalized area. If false, returns the area under the TP (true positives) x FP (false positives) curve instead. Default value: true. [Bool](../data-types/boolean.md). Optional."},
508508
{"partial_offsets", R"(
509509
- An array of four non-negative integers for calculating a partial area under the ROC curve (equivalent to a vertical band of the ROC space) instead of the whole AUC. This option is useful for distributed computation of the ROC AUC. The array must contain the following elements [`higher_partitions_tp`, `higher_partitions_fp`, `total_positives`, `total_negatives`]. [Array](/sql-reference/data-types/array) of non-negative [Integers](../data-types/int-uint.md). Optional.
510510
- `higher_partitions_tp`: The number of positive labels in the higher-scored partitions.

src/Functions/array/arrayFill.cpp

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,59 @@ using FunctionArrayReverseFill = FunctionArrayMapped<ArrayFillImpl<true>, NameAr
128128

129129
REGISTER_FUNCTION(ArrayFill)
130130
{
131-
factory.registerFunction<FunctionArrayFill>();
132-
factory.registerFunction<FunctionArrayReverseFill>();
131+
FunctionDocumentation::Description description = R"(
132+
The `arrayFill` function sequentially processes a source array from the first element
133+
to the last, evaluating a lambda condition at each position using elements from
134+
the source and condition arrays. When the condition evaluates to false at
135+
position i, the function replaces that element with the element at position i-1
136+
from the current state of the array. The first element is always preserved
137+
regardless of any condition.
138+
139+
`arrayFill` is a [higher-order function](/sql-reference/functions/overview#higher-order-functions). You must pass a lambda function to it as the first argument, and it can't be omitted.
140+
)";
141+
FunctionDocumentation::Syntax syntax = "arrayFill(λ(x [, y1, ..., yN]), source [, cond1, ... , condN])";
142+
FunctionDocumentation::Arguments arguments = {
143+
{"λ(x [, y1, ..., yN])", "A lambda function `λ(x [, y1, y2, ... yN]) → F(x [, y1, y2, ... yN])` which operates on elements of the source array (`x`) and condition arrays (`y`). [Lambda function](/sql-reference/functions/overview#arrow-operator-and-lambda)."},
144+
{"source", "The source array to process [`Array(T)`](/sql-reference/data-types/array)."},
145+
{"[, cond1, ... , condN]", "Optional. N condition arrays providing additional arguments to the lambda function. [`Array(T)`](/sql-reference/data-types/array)."},
146+
};
147+
FunctionDocumentation::ReturnedValue returned_value = "Returns an array. [`Array(T)`](/sql-reference/data-types/array).";
148+
FunctionDocumentation::Examples examples = {
149+
{"Example with single array", "SELECT arrayFill(x -> not isNull(x), [1, null, 2, null]) AS res", "[1,1,2,2]"},
150+
{"Example with two arrays", "SELECT arrayFill(x, y, z -> x > y AND x < z, [5, 3, 6, 2], [4, 7, 1, 3], [10, 2, 8, 5]) AS res", "[5,5,6,6]"}
151+
};
152+
FunctionDocumentation::IntroducedIn introduced_in = {20, 1};
153+
FunctionDocumentation::Category category = FunctionDocumentation::Category::Array;
154+
FunctionDocumentation documentation = {description, syntax, arguments, returned_value, examples, introduced_in, category};
155+
156+
factory.registerFunction<FunctionArrayFill>(documentation);
157+
158+
FunctionDocumentation::Description description_reverse = R"(
159+
The `arrayReverseFill` function sequentially processes a source array from the last
160+
element to the first, evaluating a lambda condition at each position using elements
161+
from the source and condition arrays. When the condition evaluates to false at
162+
position i, the function replaces that element with the element at position i+1
163+
from the current state of the array. The last element is always preserved
164+
regardless of any condition.
165+
166+
`arrayReverseFill` is a [higher-order function](/sql-reference/functions/overview#higher-order-functions). You must pass a lambda function to it as the first argument, and it can't be omitted.
167+
)";
168+
FunctionDocumentation::Syntax syntax_reverse = "arrayReverseFill(λ(x [, y1, ..., yN]), source [, cond1, ... , condN])";
169+
FunctionDocumentation::Arguments arguments_reverse = {
170+
{"λ(x [, y1, ..., yN])", "A lambda function `λ(x [, y1, y2, ... yN]) → F(x [, y1, y2, ... yN])` which operates on elements of the source array (`x`) and condition arrays (`y`). [Lambda function](/sql-reference/functions/overview#arrow-operator-and-lambda)."},
171+
{"source", "The source array to process [`Array(T)`](/sql-reference/data-types/array)."},
172+
{"[, cond1, ... , condN]", "Optional. N condition arrays providing additional arguments to the lambda function. [`Array(T)`](/sql-reference/data-types/array)."},
173+
};
174+
FunctionDocumentation::ReturnedValue returned_value_reverse = "";
175+
FunctionDocumentation::Examples examples_reverse = {
176+
{"Example with a single array", "SELECT arrayReverseFill(x -> not isNull(x), [1, null, 2, null]) AS res", "[1,2,2,NULL]"},
177+
{"Example with two arrays", "SELECT arrayReverseFill(x, y, z -> x > y AND x < z, [5, 3, 6, 2], [4, 7, 1, 3], [10, 2, 8, 5]) AS res;", "[5,6,6,2]"}
178+
};
179+
FunctionDocumentation::IntroducedIn introduced_in_reverse = {20, 1};
180+
FunctionDocumentation::Category category_reverse = FunctionDocumentation::Category::Array;
181+
FunctionDocumentation documentation_reverse = {description_reverse, syntax_reverse, arguments_reverse, returned_value_reverse, examples_reverse, introduced_in_reverse, category_reverse};
182+
183+
factory.registerFunction<FunctionArrayReverseFill>(documentation_reverse);
133184
}
134185

135186
}

tests/queries/0_stateless/02415_all_new_functions_must_be_documented.reference

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ arrayEnumerateDense
104104
arrayEnumerateDenseRanked
105105
arrayEnumerateUniq
106106
arrayExists
107-
arrayFill
108107
arrayFilter
109108
arrayFirst
110109
arrayFirstIndex
@@ -122,7 +121,6 @@ arrayRandomSample
122121
arrayReduceInRanges
123122
arrayResize
124123
arrayReverse
125-
arrayReverseFill
126124
arrayReverseSort
127125
arrayReverseSplit
128126
arraySlice

tests/queries/0_stateless/02415_all_new_functions_must_have_version_information.reference

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ arrayEnumerateDense
121121
arrayEnumerateDenseRanked
122122
arrayEnumerateUniq
123123
arrayExists
124-
arrayFill
125124
arrayFilter
126125
arrayFirst
127126
arrayFirstIndex
@@ -145,7 +144,6 @@ arrayRandomSample
145144
arrayReduceInRanges
146145
arrayResize
147146
arrayReverse
148-
arrayReverseFill
149147
arrayReverseSort
150148
arrayReverseSplit
151149
arrayRotateLeft

0 commit comments

Comments
 (0)