Add a step to the program, taking ownership. If successful, returns the pointer to the step. Otherwise, returns nullptr. Note: the pointer is only guaranteed to stay valid until the parent subexpression is finalized. Optimizers may modify the program plan which may free the step at that point.
| 1692 | // subexpression is finalized. Optimizers may modify the program plan which |
| 1693 | // may free the step at that point. |
| 1694 | ExpressionStep* AddStep( |
| 1695 | absl::StatusOr<std::unique_ptr<ExpressionStep>> step) { |
| 1696 | if (step.ok()) { |
| 1697 | return AddStep(*std::move(step)); |
| 1698 | } else { |
| 1699 | SetProgressStatusError(step.status()); |
| 1700 | } |
| 1701 | return nullptr; |
| 1702 | } |
| 1703 | |
| 1704 | template <typename T> |
| 1705 | std::enable_if_t<std::is_base_of_v<ExpressionStep, T>, T*> AddStep( |