MCPcopy Create free account
hub / github.com/apache/arrow / Make

Method Make

cpp/src/gandiva/random_generator_holder.cc:25–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24namespace gandiva {
25Result<std::shared_ptr<RandomGeneratorHolder>> RandomGeneratorHolder::Make(
26 const FunctionNode& node) {
27 ARROW_RETURN_IF(node.children().size() > 1,
28 Status::Invalid("'random' function requires at most one parameter"));
29
30 if (node.children().size() == 0) {
31 return std::shared_ptr<RandomGeneratorHolder>(new RandomGeneratorHolder());
32 }
33
34 auto literal = dynamic_cast<LiteralNode*>(node.children().at(0).get());
35 ARROW_RETURN_IF(literal == nullptr,
36 Status::Invalid("'random' function requires a literal as parameter"));
37
38 auto literal_type = literal->return_type()->id();
39 ARROW_RETURN_IF(
40 literal_type != arrow::Type::INT32,
41 Status::Invalid("'random' function requires an int32 literal as parameter"));
42
43 return std::shared_ptr<RandomGeneratorHolder>(new RandomGeneratorHolder(
44 literal->is_null() ? 0 : std::get<int32_t>(literal->holder())));
45}
46
47Result<std::shared_ptr<RandomIntegerGeneratorHolder>> RandomIntegerGeneratorHolder::Make(
48 const FunctionNode& node) {

Callers

nothing calls this directly

Calls 8

is_nullMethod · 0.80
InvalidFunction · 0.50
sizeMethod · 0.45
childrenMethod · 0.45
getMethod · 0.45
idMethod · 0.45
return_typeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected