| 989 | } |
| 990 | |
| 991 | Status ExecStateful(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 992 | // We take the value from the state and multiply the data in batch[0] with it |
| 993 | ExampleState* state = static_cast<ExampleState*>(ctx->state()); |
| 994 | int32_t multiplier = checked_cast<const Int32Scalar&>(*state->value).value; |
| 995 | |
| 996 | const ArraySpan& arg0 = batch[0].array; |
| 997 | ArraySpan* out_arr = out->array_span_mutable(); |
| 998 | const int32_t* arg0_data = arg0.GetValues<int32_t>(1); |
| 999 | int32_t* dst = out_arr->GetValues<int32_t>(1); |
| 1000 | for (int64_t i = 0; i < arg0.length; ++i) { |
| 1001 | dst[i] = arg0_data[i] * multiplier; |
| 1002 | } |
| 1003 | return Status::OK(); |
| 1004 | } |
| 1005 | |
| 1006 | Status ExecAddInt32(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 1007 | const int32_t* left_data = batch[0].array.GetValues<int32_t>(1); |