Skip to content

Commit

Permalink
[Refactor](exec) refactor schema scanner del unless code
Browse files Browse the repository at this point in the history
  • Loading branch information
HappenLee committed Oct 9, 2024
1 parent 4602068 commit 40bdc60
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 113 deletions.
22 changes: 1 addition & 21 deletions be/src/exec/schema_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@
namespace doris {
class ObjectPool;

SchemaScanner::SchemaScanner(const std::vector<ColumnDesc>& columns)
: _is_init(false), _columns(columns), _schema_table_type(TSchemaTableType::SCH_INVALID) {}

SchemaScanner::SchemaScanner(const std::vector<ColumnDesc>& columns, TSchemaTableType::type type)
: _is_init(false), _columns(columns), _schema_table_type(type) {}

Expand Down Expand Up @@ -125,7 +122,6 @@ Status SchemaScanner::get_next_block_async(RuntimeState* state) {
return;
}
SCOPED_ATTACH_TASK(state);
_dependency->block();
_async_thread_running = true;
_finish_dependency->block();
if (!_opened) {
Expand All @@ -150,19 +146,6 @@ Status SchemaScanner::get_next_block_async(RuntimeState* state) {
return Status::OK();
}

Status SchemaScanner::get_next_block_internal(vectorized::Block* block, bool* eos) {
if (!_is_init) {
return Status::InternalError("used before initialized.");
}

if (nullptr == block || nullptr == eos) {
return Status::InternalError("input pointer is nullptr.");
}

*eos = true;
return Status::OK();
}

Status SchemaScanner::init(SchemaScannerParam* param, ObjectPool* pool) {
if (_is_init) {
return Status::OK();
Expand Down Expand Up @@ -426,14 +409,12 @@ Status SchemaScanner::insert_block_column(TCell cell, int col_index, vectorized:
case TYPE_BIGINT: {
reinterpret_cast<vectorized::ColumnVector<vectorized::Int64>*>(col_ptr)->insert_value(
cell.longVal);
nullable_column->get_null_map_data().emplace_back(0);
break;
}

case TYPE_INT: {
reinterpret_cast<vectorized::ColumnVector<vectorized::Int32>*>(col_ptr)->insert_value(
cell.intVal);
nullable_column->get_null_map_data().emplace_back(0);
break;
}

Expand All @@ -449,7 +430,6 @@ Status SchemaScanner::insert_block_column(TCell cell, int col_index, vectorized:
case TYPE_CHAR: {
reinterpret_cast<vectorized::ColumnString*>(col_ptr)->insert_data(cell.stringVal.data(),
cell.stringVal.size());
nullable_column->get_null_map_data().emplace_back(0);
break;
}

Expand All @@ -461,7 +441,6 @@ Status SchemaScanner::insert_block_column(TCell cell, int col_index, vectorized:
auto data = datas[0];
reinterpret_cast<vectorized::ColumnVector<vectorized::Int64>*>(col_ptr)->insert_data(
reinterpret_cast<char*>(data), 0);
nullable_column->get_null_map_data().emplace_back(0);
break;
}
default: {
Expand All @@ -470,6 +449,7 @@ Status SchemaScanner::insert_block_column(TCell cell, int col_index, vectorized:
return Status::InternalError(ss.str());
}
}
nullable_column->get_null_map_data().emplace_back(0);
return Status::OK();
}

Expand Down
12 changes: 5 additions & 7 deletions be/src/exec/schema_scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

#include <gen_cpp/Data_types.h>
#include <gen_cpp/Descriptors_types.h>
#include <stddef.h>
#include <stdint.h>

#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
Expand Down Expand Up @@ -82,8 +82,6 @@ struct SchemaScannerParam {

// virtual scanner for all schema table
class SchemaScanner {
ENABLE_FACTORY_CREATOR(SchemaScanner);

public:
struct ColumnDesc {
const char* name = nullptr;
Expand All @@ -94,16 +92,16 @@ class SchemaScanner {
int precision = -1;
int scale = -1;
};
SchemaScanner(const std::vector<ColumnDesc>& columns);
SchemaScanner(const std::vector<ColumnDesc>& columns, TSchemaTableType::type type);
SchemaScanner(const std::vector<ColumnDesc>& columns,
TSchemaTableType::type type = TSchemaTableType::SCH_INVALID);
virtual ~SchemaScanner();

// init object need information, schema etc.
virtual Status init(SchemaScannerParam* param, ObjectPool* pool);
Status get_next_block(RuntimeState* state, vectorized::Block* block, bool* eos);
// Start to work
virtual Status start(RuntimeState* state);
virtual Status get_next_block_internal(vectorized::Block* block, bool* eos);
virtual Status get_next_block_internal(vectorized::Block* block, bool* eos) = 0;
const std::vector<ColumnDesc>& get_column_desc() const { return _columns; }
// factory function
static std::unique_ptr<SchemaScanner> create(TSchemaTableType::type type);
Expand Down
50 changes: 0 additions & 50 deletions be/src/exec/schema_scanner/schema_statistics_scanner.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions be/src/exec/schema_scanner/schema_statistics_scanner.h

This file was deleted.

0 comments on commit 40bdc60

Please sign in to comment.