JackDrogon commented on code in PR #25585:
URL: https://github.com/apache/doris/pull/25585#discussion_r1364808468
##########
be/src/pipeline/pipeline_x/operator.h:
##########
@@ -21,25 +21,25 @@
namespace doris::pipeline {
-#define CREATE_LOCAL_STATE_RETURN_IF_ERROR(local_state)
\
- auto _sptr = state->get_local_state(id());
\
- if (!_sptr) return Status::InternalError("could not find local state id
{}", id()); \
- auto& local_state = _sptr->template cast<LocalState>();
-
-#define CREATE_SINK_LOCAL_STATE_RETURN_IF_ERROR(local_state)
\
- auto _sptr = state->get_sink_local_state(id());
\
- if (!_sptr) return Status::InternalError("could not find local state id
{}", id()); \
- auto& local_state = _sptr->template cast<LocalState>();
-
-#define CREATE_LOCAL_STATE_RETURN_NULL_IF_ERROR(local_state) \
- auto _sptr = state->get_local_state(id()); \
- if (!_sptr) return nullptr; \
- auto& local_state = _sptr->template cast<LocalState>();
-
-#define CREATE_SINK_LOCAL_STATE_RETURN_NULL_IF_ERROR(local_state) \
- auto _sptr = state->get_sink_local_state(id()); \
- if (!_sptr) return nullptr; \
- auto& local_state = _sptr->template cast<LocalState>();
+#define CREATE_LOCAL_STATE_RETURN_STATUS_IF_ERROR(local_state) \
Review Comment:
why use macro,it's better to use inline function not macro. inline function
is good for debug and can get a clean namespace. macro is only for define scope
or create an anonymous variable
##########
be/src/pipeline/pipeline_x/operator.h:
##########
@@ -21,25 +21,25 @@
namespace doris::pipeline {
-#define CREATE_LOCAL_STATE_RETURN_IF_ERROR(local_state)
\
- auto _sptr = state->get_local_state(id());
\
- if (!_sptr) return Status::InternalError("could not find local state id
{}", id()); \
- auto& local_state = _sptr->template cast<LocalState>();
-
-#define CREATE_SINK_LOCAL_STATE_RETURN_IF_ERROR(local_state)
\
- auto _sptr = state->get_sink_local_state(id());
\
- if (!_sptr) return Status::InternalError("could not find local state id
{}", id()); \
- auto& local_state = _sptr->template cast<LocalState>();
-
-#define CREATE_LOCAL_STATE_RETURN_NULL_IF_ERROR(local_state) \
- auto _sptr = state->get_local_state(id()); \
- if (!_sptr) return nullptr; \
- auto& local_state = _sptr->template cast<LocalState>();
-
-#define CREATE_SINK_LOCAL_STATE_RETURN_NULL_IF_ERROR(local_state) \
- auto _sptr = state->get_sink_local_state(id()); \
- if (!_sptr) return nullptr; \
- auto& local_state = _sptr->template cast<LocalState>();
+#define CREATE_LOCAL_STATE_RETURN_STATUS_IF_ERROR(local_state) \
Review Comment:
why use macro,it's better to use inline function not macro. inline function
is good for debug and can get a clean namespace. macro is only for define scope
or create an anonymous variable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]