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

Function NaiveExecuteScalarExpression

cpp/src/arrow/compute/expression_test.cc:1036–1064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036Result<Datum> NaiveExecuteScalarExpression(const Expression& expr, const Datum& input) {
1037 if (auto lit = expr.literal()) {
1038 return *lit;
1039 }
1040
1041 if (auto ref = expr.field_ref()) {
1042 if (input.type()) {
1043 return ref->GetOneOrNone(*input.make_array());
1044 }
1045 return ref->GetOneOrNone(*input.record_batch());
1046 }
1047
1048 auto call = CallNotNull(expr);
1049
1050 std::vector<Datum> arguments(call->arguments.size());
1051 for (size_t i = 0; i < arguments.size(); ++i) {
1052 ARROW_ASSIGN_OR_RAISE(arguments[i],
1053 NaiveExecuteScalarExpression(call->arguments[i], input));
1054 }
1055
1056 compute::ExecContext exec_context;
1057 ARROW_ASSIGN_OR_RAISE(auto function, GetFunction(*call, &exec_context));
1058
1059 std::vector<TypeHolder> types = GetTypes(call->arguments);
1060 ARROW_ASSIGN_OR_RAISE(auto expected_kernel, function->DispatchExact(types));
1061
1062 EXPECT_EQ(call->kernel, expected_kernel);
1063 return function->Execute(arguments, call->options.get(), &exec_context);
1064}
1065
1066void ExpectExecute(Expression expr, Datum in, Datum* actual_out = NULLPTR) {
1067 std::shared_ptr<Schema> schm;

Callers

nothing calls this directly

Calls 10

CallNotNullFunction · 0.85
literalMethod · 0.80
field_refMethod · 0.80
make_arrayMethod · 0.80
GetTypesFunction · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.50
typeMethod · 0.45
sizeMethod · 0.45
ExecuteMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected