Skip to content

Commit c9495ab

Browse files
committed
ARROW-14751: [C++] Add doc for set lookup "meta" compute functions
`is_in_meta_binary` and `index_in_meta_binary` were lacking a FunctionDoc. Closes #11737 from pitrou/ARROW-14751-set-lookup-meta Authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
1 parent 7e25ef2 commit c9495ab

1 file changed

Lines changed: 34 additions & 22 deletions

File tree

‎cpp/src/arrow/compute/kernels/scalar_set_lookup.cc‎

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,43 @@ void AddBasicSetLookupKernels(ScalarKernel kernel,
444444
}
445445
}
446446

447+
const FunctionDoc is_in_doc{
448+
"Find each element in a set of values",
449+
("For each element in `values`, return true if it is found in a given\n"
450+
"set of values, false otherwise.\n"
451+
"The set of values to look for must be given in SetLookupOptions.\n"
452+
"By default, nulls are matched against the value set, this can be\n"
453+
"changed in SetLookupOptions."),
454+
{"values"},
455+
"SetLookupOptions"};
456+
457+
const FunctionDoc is_in_meta_doc{
458+
"Find each element in a set of values",
459+
("For each element in `values`, return true if it is found in `value_set`,\n"
460+
"false otherwise."),
461+
{"values", "value_set"}};
462+
463+
const FunctionDoc index_in_doc{
464+
"Return index of each element in a set of values",
465+
("For each element in `values`, return its index in a given set of\n"
466+
"values, or null if it is not found there.\n"
467+
"The set of values to look for must be given in SetLookupOptions.\n"
468+
"By default, nulls are matched against the value set, this can be\n"
469+
"changed in SetLookupOptions."),
470+
{"values"},
471+
"SetLookupOptions"};
472+
473+
const FunctionDoc index_in_meta_doc{
474+
"Return index of each element in a set of values",
475+
("For each element in `values`, return its index in the `value_set`,\n"
476+
"or null if it is not found there."),
477+
{"values", "value_set"}};
478+
447479
// Enables calling is_in with CallFunction as though it were binary.
448480
class IsInMetaBinary : public MetaFunction {
449481
public:
450482
IsInMetaBinary()
451-
: MetaFunction("is_in_meta_binary", Arity::Binary(), /*doc=*/nullptr) {}
483+
: MetaFunction("is_in_meta_binary", Arity::Binary(), &is_in_meta_doc) {}
452484

453485
Result<Datum> ExecuteImpl(const std::vector<Datum>& args,
454486
const FunctionOptions* options,
@@ -464,7 +496,7 @@ class IsInMetaBinary : public MetaFunction {
464496
class IndexInMetaBinary : public MetaFunction {
465497
public:
466498
IndexInMetaBinary()
467-
: MetaFunction("index_in_meta_binary", Arity::Binary(), /*doc=*/nullptr) {}
499+
: MetaFunction("index_in_meta_binary", Arity::Binary(), &index_in_meta_doc) {}
468500

469501
Result<Datum> ExecuteImpl(const std::vector<Datum>& args,
470502
const FunctionOptions* options,
@@ -485,26 +517,6 @@ struct SetLookupFunction : ScalarFunction {
485517
}
486518
};
487519

488-
const FunctionDoc is_in_doc{
489-
"Find each element in a set of values",
490-
("For each element in `values`, return true if it is found in a given\n"
491-
"set of values, false otherwise.\n"
492-
"The set of values to look for must be given in SetLookupOptions.\n"
493-
"By default, nulls are matched against the value set, this can be\n"
494-
"changed in SetLookupOptions."),
495-
{"values"},
496-
"SetLookupOptions"};
497-
498-
const FunctionDoc index_in_doc{
499-
"Return index of each element in a set of values",
500-
("For each element in `values`, return its index in a given set of\n"
501-
"values, or null if it is not found there.\n"
502-
"The set of values to look for must be given in SetLookupOptions.\n"
503-
"By default, nulls are matched against the value set, this can be\n"
504-
"changed in SetLookupOptions."),
505-
{"values"},
506-
"SetLookupOptions"};
507-
508520
} // namespace
509521

510522
void RegisterScalarSetLookup(FunctionRegistry* registry) {

0 commit comments

Comments
 (0)