Uniform Status (#1317)
This commit is contained in:
@ -85,16 +85,16 @@ Status SchemaScanNode::init(const TPlanNode& tnode, RuntimeState* state) {
|
||||
if (tnode.schema_scan_node.__isset.thread_id) {
|
||||
_scanner_param.thread_id = tnode.schema_scan_node.thread_id;
|
||||
}
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status SchemaScanNode::prepare(RuntimeState* state) {
|
||||
if (_is_init) {
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
if (NULL == state) {
|
||||
return Status("input pointer is NULL.");
|
||||
return Status::InternalError("input pointer is NULL.");
|
||||
}
|
||||
|
||||
RETURN_IF_ERROR(ScanNode::prepare(state));
|
||||
@ -103,14 +103,14 @@ Status SchemaScanNode::prepare(RuntimeState* state) {
|
||||
_tuple_pool.reset(new(std::nothrow) MemPool(mem_tracker()));
|
||||
|
||||
if (NULL == _tuple_pool.get()) {
|
||||
return Status("Allocate MemPool failed.");
|
||||
return Status::InternalError("Allocate MemPool failed.");
|
||||
}
|
||||
|
||||
// get dest tuple desc
|
||||
_dest_tuple_desc = state->desc_tbl().get_tuple_descriptor(_tuple_id);
|
||||
|
||||
if (NULL == _dest_tuple_desc) {
|
||||
return Status("Failed to get tuple descriptor.");
|
||||
return Status::InternalError("Failed to get tuple descriptor.");
|
||||
}
|
||||
|
||||
_slot_num = _dest_tuple_desc->slots().size();
|
||||
@ -119,14 +119,14 @@ Status SchemaScanNode::prepare(RuntimeState* state) {
|
||||
static_cast<const SchemaTableDescriptor*>(_dest_tuple_desc->table_desc());
|
||||
|
||||
if (NULL == schema_table) {
|
||||
return Status("Failed to get schema table descriptor.");
|
||||
return Status::InternalError("Failed to get schema table descriptor.");
|
||||
}
|
||||
|
||||
// new one scanner
|
||||
_schema_scanner.reset(SchemaScanner::create(schema_table->schema_table_type()));
|
||||
|
||||
if (NULL == _schema_scanner.get()) {
|
||||
return Status("schema scanner get NULL pointer.");
|
||||
return Status::InternalError("schema scanner get NULL pointer.");
|
||||
}
|
||||
|
||||
RETURN_IF_ERROR(_schema_scanner->init(&_scanner_param, _pool));
|
||||
@ -134,13 +134,13 @@ Status SchemaScanNode::prepare(RuntimeState* state) {
|
||||
_src_tuple_desc = _schema_scanner->tuple_desc();
|
||||
|
||||
if (NULL == _src_tuple_desc) {
|
||||
return Status("failed to get src schema tuple desc.");
|
||||
return Status::InternalError("failed to get src schema tuple desc.");
|
||||
}
|
||||
|
||||
_src_tuple = reinterpret_cast<Tuple*>(new(std::nothrow) char[_src_tuple_desc->byte_size()]);
|
||||
|
||||
if (NULL == _src_tuple) {
|
||||
return Status("new src tuple failed.");
|
||||
return Status::InternalError("new src tuple failed.");
|
||||
}
|
||||
|
||||
// if src tuple desc slots is zero, it's the dummy slots.
|
||||
@ -165,13 +165,13 @@ Status SchemaScanNode::prepare(RuntimeState* state) {
|
||||
if (j >= _src_tuple_desc->slots().size()) {
|
||||
LOG(WARNING) << "no match column for this column("
|
||||
<< _dest_tuple_desc->slots()[i]->col_name() << ")";
|
||||
return Status("no match column for this column.");
|
||||
return Status::InternalError("no match column for this column.");
|
||||
}
|
||||
|
||||
if (_src_tuple_desc->slots()[j]->type().type != _dest_tuple_desc->slots()[i]->type().type) {
|
||||
LOG(WARNING) << "schema not match. input is " << _src_tuple_desc->slots()[j]->type()
|
||||
<< " and output is " << _dest_tuple_desc->slots()[i]->type();
|
||||
return Status("schema not match.");
|
||||
return Status::InternalError("schema not match.");
|
||||
}
|
||||
_index_map[i] = j;
|
||||
}
|
||||
@ -180,16 +180,16 @@ Status SchemaScanNode::prepare(RuntimeState* state) {
|
||||
_tuple_idx = 0;
|
||||
_is_init = true;
|
||||
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status SchemaScanNode::open(RuntimeState* state) {
|
||||
if (!_is_init) {
|
||||
return Status("Open before Init.");
|
||||
return Status::InternalError("Open before Init.");
|
||||
}
|
||||
|
||||
if (NULL == state) {
|
||||
return Status("input pointer is NULL.");
|
||||
return Status::InternalError("input pointer is NULL.");
|
||||
}
|
||||
|
||||
SCOPED_TIMER(_runtime_profile->total_time_counter());
|
||||
@ -231,11 +231,11 @@ void SchemaScanNode::copy_one_row() {
|
||||
Status SchemaScanNode::get_next(RuntimeState* state, RowBatch* row_batch,
|
||||
bool* eos) {
|
||||
if (!_is_init) {
|
||||
return Status("GetNext before Init.");
|
||||
return Status::InternalError("GetNext before Init.");
|
||||
}
|
||||
|
||||
if (NULL == state || NULL == row_batch || NULL == eos) {
|
||||
return Status("input pointer is NULL.");
|
||||
return Status::InternalError("input pointer is NULL.");
|
||||
}
|
||||
|
||||
RETURN_IF_CANCELLED(state);
|
||||
@ -244,7 +244,7 @@ Status SchemaScanNode::get_next(RuntimeState* state, RowBatch* row_batch,
|
||||
|
||||
if (reached_limit()) {
|
||||
*eos = true;
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
// create new tuple buffer for row_batch
|
||||
@ -252,7 +252,7 @@ Status SchemaScanNode::get_next(RuntimeState* state, RowBatch* row_batch,
|
||||
void* tuple_buffer = _tuple_pool->allocate(tuple_buffer_size);
|
||||
|
||||
if (NULL == tuple_buffer) {
|
||||
return Status("Allocate tuple buffer failed.");
|
||||
return Status::InternalError("Allocate tuple buffer failed.");
|
||||
}
|
||||
|
||||
// no use to clear, because CopyOneRow can clear
|
||||
@ -268,7 +268,7 @@ Status SchemaScanNode::get_next(RuntimeState* state, RowBatch* row_batch,
|
||||
// next get_next() call
|
||||
row_batch->tuple_data_pool()->acquire_data(_tuple_pool.get(), !reached_limit());
|
||||
*eos = reached_limit();
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
RETURN_IF_ERROR(_schema_scanner->get_next_row(_src_tuple,
|
||||
@ -277,7 +277,7 @@ Status SchemaScanNode::get_next(RuntimeState* state, RowBatch* row_batch,
|
||||
if (scanner_eos) {
|
||||
row_batch->tuple_data_pool()->acquire_data(_tuple_pool.get(), false);
|
||||
*eos = true;
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
int row_idx = row_batch->add_row();
|
||||
@ -297,12 +297,12 @@ Status SchemaScanNode::get_next(RuntimeState* state, RowBatch* row_batch,
|
||||
}
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status SchemaScanNode::close(RuntimeState* state) {
|
||||
if (is_closed()) {
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::CLOSE));
|
||||
SCOPED_TIMER(_runtime_profile->total_time_counter());
|
||||
@ -326,7 +326,7 @@ void SchemaScanNode::debug_string(int indentation_level, stringstream* out) cons
|
||||
}
|
||||
|
||||
Status SchemaScanNode::set_scan_ranges(const vector<TScanRangeParams>& scan_ranges) {
|
||||
return Status::OK;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user