This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 3e55152ec13 [Refactor](exec) refactor schema scanner del unless code
(#41540)
3e55152ec13 is described below
commit 3e55152ec13308674bc811f5f7dbe856c5136ac8
Author: HappenLee <[email protected]>
AuthorDate: Fri Oct 11 14:04:47 2024 +0800
[Refactor](exec) refactor schema scanner del unless code (#41540)
## Proposed changes
refactor schema scanner del unless code
<!--Describe your changes.-->
---
be/src/exec/schema_scanner.cpp | 23 +---------
be/src/exec/schema_scanner.h | 12 +++---
.../schema_scanner/schema_statistics_scanner.cpp | 50 ----------------------
.../schema_scanner/schema_statistics_scanner.h | 35 ---------------
be/test/vec/exec/parquet/parquet_thrift_test.cpp | 1 -
5 files changed, 6 insertions(+), 115 deletions(-)
diff --git a/be/src/exec/schema_scanner.cpp b/be/src/exec/schema_scanner.cpp
index 90140e748f5..dead83e3d86 100644
--- a/be/src/exec/schema_scanner.cpp
+++ b/be/src/exec/schema_scanner.cpp
@@ -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) {}
@@ -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) {
@@ -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();
@@ -426,21 +409,18 @@ 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;
}
case TYPE_BOOLEAN: {
reinterpret_cast<vectorized::ColumnVector<vectorized::UInt8>*>(col_ptr)->insert_value(
cell.boolVal);
- nullable_column->get_null_map_data().emplace_back(0);
break;
}
@@ -449,7 +429,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;
}
@@ -461,7 +440,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: {
@@ -470,6 +448,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();
}
diff --git a/be/src/exec/schema_scanner.h b/be/src/exec/schema_scanner.h
index da61d58b943..440912bff1d 100644
--- a/be/src/exec/schema_scanner.h
+++ b/be/src/exec/schema_scanner.h
@@ -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>
@@ -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;
@@ -94,8 +92,8 @@ public:
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.
@@ -103,7 +101,7 @@ public:
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);
diff --git a/be/src/exec/schema_scanner/schema_statistics_scanner.cpp
b/be/src/exec/schema_scanner/schema_statistics_scanner.cpp
deleted file mode 100644
index f4f3d5dba83..00000000000
--- a/be/src/exec/schema_scanner/schema_statistics_scanner.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include "exec/schema_scanner/schema_statistics_scanner.h"
-
-#include <stdint.h>
-
-#include "runtime/define_primitive_type.h"
-#include "vec/common/string_ref.h"
-
-namespace doris {
-
-std::vector<SchemaScanner::ColumnDesc>
SchemaStatisticsScanner::_s_cols_statistics = {
- // name, type, size, is_null
- {"TABLE_CATALOG", TYPE_VARCHAR, sizeof(StringRef), true},
- {"TABLE_SCHEMA", TYPE_VARCHAR, sizeof(StringRef), false},
- {"TABLE_NAME", TYPE_VARCHAR, sizeof(StringRef), false},
- {"NON_UNIQUE", TYPE_BIGINT, sizeof(int64_t), false},
- {"INDEX_SCHEMA", TYPE_VARCHAR, sizeof(StringRef), false},
- {"INDEX_NAME", TYPE_VARCHAR, sizeof(StringRef), false},
- {"SEQ_IN_INDEX", TYPE_BIGINT, sizeof(int64_t), false},
- {"COLUMN_NAME", TYPE_VARCHAR, sizeof(StringRef), false},
- {"COLLATION", TYPE_VARCHAR, sizeof(StringRef), true},
- {"CARDINALITY", TYPE_BIGINT, sizeof(int64_t), true},
- {"SUB_PART", TYPE_BIGINT, sizeof(int64_t), true},
- {"PACKED", TYPE_VARCHAR, sizeof(StringRef), true},
- {"NULLABLE", TYPE_VARCHAR, sizeof(StringRef), false},
- {"INDEX_TYPE", TYPE_VARCHAR, sizeof(StringRef), false},
- {"COMMENT", TYPE_VARCHAR, sizeof(StringRef), true},
-};
-
-SchemaStatisticsScanner::SchemaStatisticsScanner() :
SchemaScanner(_s_cols_statistics) {}
-
-SchemaStatisticsScanner::~SchemaStatisticsScanner() {}
-
-} // namespace doris
diff --git a/be/src/exec/schema_scanner/schema_statistics_scanner.h
b/be/src/exec/schema_scanner/schema_statistics_scanner.h
deleted file mode 100644
index 1a756512abf..00000000000
--- a/be/src/exec/schema_scanner/schema_statistics_scanner.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#pragma once
-
-#include <vector>
-
-#include "exec/schema_scanner.h"
-
-namespace doris {
-class SchemaStatisticsScanner : public SchemaScanner {
- ENABLE_FACTORY_CREATOR(SchemaStatisticsScanner);
-
-public:
- SchemaStatisticsScanner();
- ~SchemaStatisticsScanner() override;
-
-private:
- static std::vector<SchemaScanner::ColumnDesc> _s_cols_statistics;
-};
-} // namespace doris
diff --git a/be/test/vec/exec/parquet/parquet_thrift_test.cpp
b/be/test/vec/exec/parquet/parquet_thrift_test.cpp
index 132de072127..fe2221bf8d3 100644
--- a/be/test/vec/exec/parquet/parquet_thrift_test.cpp
+++ b/be/test/vec/exec/parquet/parquet_thrift_test.cpp
@@ -361,7 +361,6 @@ static void
create_block(std::unique_ptr<vectorized::Block>& block) {
{"date_col", TYPE_DATEV2, sizeof(uint32_t), true},
{"date_v2_col", TYPE_DATEV2, sizeof(uint32_t), true},
{"timestamp_v2_col", TYPE_DATETIMEV2, sizeof(int128_t), true, 18,
0}};
- SchemaScanner schema_scanner(column_descs);
ObjectPool object_pool;
doris::TupleDescriptor* tuple_desc = create_tuple_desc(&object_pool,
column_descs);
auto tuple_slots = tuple_desc->slots();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]