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 ab7b45a9e2 [Bug](map) support replicate for column map and remove some 
unused code #23356
ab7b45a9e2 is described below

commit ab7b45a9e29ab161d32c13b601643d5570881450
Author: Pxl <pxl...@qq.com>
AuthorDate: Wed Aug 23 15:06:04 2023 +0800

    [Bug](map) support replicate for column map and remove some unused code 
#23356
---
 .../aggregate_function_nothing.h                   | 75 ----------------------
 be/src/vec/columns/column.h                        |  5 +-
 be/src/vec/columns/column_dictionary.h             |  4 ++
 be/src/vec/columns/column_fixed_length_object.h    |  4 ++
 be/src/vec/columns/column_map.cpp                  | 10 +++
 be/src/vec/columns/column_map.h                    |  1 +
 be/src/vec/columns/column_nothing.h                | 48 --------------
 be/src/vec/columns/column_object.h                 |  4 ++
 be/src/vec/columns/predicate_column.h              |  4 ++
 be/src/vec/data_types/data_type_nothing.cpp        |  8 +--
 10 files changed, 31 insertions(+), 132 deletions(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_nothing.h 
b/be/src/vec/aggregate_functions/aggregate_function_nothing.h
deleted file mode 100644
index 0c48dcc52b..0000000000
--- a/be/src/vec/aggregate_functions/aggregate_function_nothing.h
+++ /dev/null
@@ -1,75 +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.
-// This file is copied from
-// 
https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionNothing.h
-// and modified by Doris
-
-#pragma once
-
-#include "vec/aggregate_functions/aggregate_function.h"
-#include "vec/columns/column.h"
-#include "vec/data_types/data_type_nothing.h"
-#include "vec/data_types/data_type_nullable.h"
-#include "vec/io/io_helper.h"
-
-namespace doris::vectorized {
-
-/** Aggregate function that takes arbitrary number of arbitrary arguments and 
does nothing.
-  */
-class AggregateFunctionNothing final : public 
IAggregateFunctionHelper<AggregateFunctionNothing> {
-public:
-    AggregateFunctionNothing(const DataTypes& arguments)
-            : IAggregateFunctionHelper<AggregateFunctionNothing>(arguments) {}
-
-    String get_name() const override { return "nothing"; }
-
-    DataTypePtr get_return_type() const override {
-        return 
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeNothing>());
-    }
-
-    void create(AggregateDataPtr) const override {}
-
-    void destroy(AggregateDataPtr) const noexcept override {}
-
-    bool has_trivial_destructor() const override { return true; }
-
-    size_t size_of_data() const override { return 0; }
-
-    size_t align_of_data() const override { return 1; }
-
-    void add(AggregateDataPtr, const IColumn**, size_t, Arena*) const override 
{}
-
-    void reset(AggregateDataPtr place) const override {}
-
-    void merge(AggregateDataPtr, ConstAggregateDataPtr, Arena*) const override 
{}
-
-    void serialize(ConstAggregateDataPtr, BufferWritable& buf) const override 
{}
-
-    void deserialize(AggregateDataPtr, BufferReadable& buf, Arena*) const 
override {}
-
-    void insert_result_into(ConstAggregateDataPtr, IColumn& to) const override 
{
-        to.insert_default();
-    }
-
-    void deserialize_and_merge(AggregateDataPtr __restrict place, 
AggregateDataPtr __restrict rhs,
-                               BufferReadable& buf, Arena* arena) const 
override {}
-
-    void deserialize_and_merge_from_column(AggregateDataPtr __restrict place, 
const IColumn& column,
-                                           Arena* arena) const override {}
-};
-
-} // namespace doris::vectorized
diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h
index 84d035946d..4bf4660927 100644
--- a/be/src/vec/columns/column.h
+++ b/be/src/vec/columns/column.h
@@ -488,9 +488,7 @@ public:
       * If `begin` and `count_sz` specified, it means elements in range 
[`begin`, `begin` + `count_sz`) will be replicated.
       * If `count_sz` is -1, `begin` must be 0.
       */
-    virtual void replicate(const uint32_t* indexs, size_t target_size, 
IColumn& column) const {
-        LOG(FATAL) << "not support";
-    }
+    virtual void replicate(const uint32_t* indexs, size_t target_size, 
IColumn& column) const = 0;
 
     /// Appends one field multiple times. Can be optimized in inherited 
classes.
     virtual void insert_many(const Field& field, size_t length) {
@@ -674,7 +672,6 @@ public:
     virtual bool is_column_map() const { return false; }
 
     /// If the only value column can contain is NULL.
-    /// Does not imply type of object, because it can be 
ColumnNullable(ColumnNothing) or ColumnConst(ColumnNullable(ColumnNothing))
     virtual bool only_null() const { return false; }
 
     /// Can be inside ColumnNullable.
diff --git a/be/src/vec/columns/column_dictionary.h 
b/be/src/vec/columns/column_dictionary.h
index 63538aa998..e89bc64868 100644
--- a/be/src/vec/columns/column_dictionary.h
+++ b/be/src/vec/columns/column_dictionary.h
@@ -304,6 +304,10 @@ public:
         return _rowset_segment_id;
     }
 
+    void replicate(const uint32_t* indexs, size_t target_size, IColumn& 
column) const override {
+        LOG(FATAL) << "not support";
+    }
+
     bool is_dict_sorted() const { return _dict_sorted; }
 
     bool is_dict_empty() const { return _dict.empty(); }
diff --git a/be/src/vec/columns/column_fixed_length_object.h 
b/be/src/vec/columns/column_fixed_length_object.h
index 25c44da769..05b0aea9f9 100644
--- a/be/src/vec/columns/column_fixed_length_object.h
+++ b/be/src/vec/columns/column_fixed_length_object.h
@@ -195,6 +195,10 @@ public:
         LOG(FATAL) << "get_permutation not supported";
     }
 
+    void replicate(const uint32_t* indexs, size_t target_size, IColumn& 
column) const override {
+        LOG(FATAL) << "not support";
+    }
+
     TypeIndex get_data_type() const override { LOG(FATAL) << "get_data_type 
not supported"; }
 
     ColumnPtr index(const IColumn& indexes, size_t limit) const override {
diff --git a/be/src/vec/columns/column_map.cpp 
b/be/src/vec/columns/column_map.cpp
index 1b460e1235..cca9415ef0 100644
--- a/be/src/vec/columns/column_map.cpp
+++ b/be/src/vec/columns/column_map.cpp
@@ -466,6 +466,16 @@ ColumnPtr ColumnMap::replicate(const Offsets& offsets) 
const {
     return res;
 }
 
+void ColumnMap::replicate(const uint32_t* indexs, size_t target_size, IColumn& 
column) const {
+    auto& res = reinterpret_cast<ColumnMap&>(column);
+
+    // Make a temp column array for reusing its replicate function
+    ColumnArray::create(keys_column->assume_mutable(), 
offsets_column->assume_mutable())
+            ->replicate(indexs, target_size, 
res.keys_column->assume_mutable_ref());
+    ColumnArray::create(values_column->assume_mutable(), 
offsets_column->assume_mutable())
+            ->replicate(indexs, target_size, 
res.values_column->assume_mutable_ref());
+}
+
 void ColumnMap::reserve(size_t n) {
     get_offsets().reserve(n);
     keys_column->reserve(n);
diff --git a/be/src/vec/columns/column_map.h b/be/src/vec/columns/column_map.h
index 91c9eb0177..9d4f1f9270 100644
--- a/be/src/vec/columns/column_map.h
+++ b/be/src/vec/columns/column_map.h
@@ -117,6 +117,7 @@ public:
     Status filter_by_selector(const uint16_t* sel, size_t sel_size, IColumn* 
col_ptr) override;
     ColumnPtr permute(const Permutation& perm, size_t limit) const override;
     ColumnPtr replicate(const Offsets& offsets) const override;
+    void replicate(const uint32_t* indexs, size_t target_size, IColumn& 
column) const override;
     MutableColumns scatter(ColumnIndex num_columns, const Selector& selector) 
const override {
         return scatter_impl<ColumnMap>(num_columns, selector);
     }
diff --git a/be/src/vec/columns/column_nothing.h 
b/be/src/vec/columns/column_nothing.h
deleted file mode 100644
index 16ab5d171f..0000000000
--- a/be/src/vec/columns/column_nothing.h
+++ /dev/null
@@ -1,48 +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.
-// This file is copied from
-// 
https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/ColumnNothing.h
-// and modified by Doris
-
-#pragma once
-
-#include "vec/columns/column_dummy.h"
-
-namespace doris::vectorized {
-
-class ColumnNothing final : public COWHelper<IColumnDummy, ColumnNothing> {
-private:
-    friend class COWHelper<IColumnDummy, ColumnNothing>;
-
-    ColumnNothing(size_t s_) { s = s_; }
-
-    ColumnNothing(const ColumnNothing&) = default;
-
-public:
-    const char* get_family_name() const override { return "Nothing"; }
-    MutableColumnPtr clone_dummy(size_t s_) const override { return 
ColumnNothing::create(s_); }
-
-    bool can_be_inside_nullable() const override { return true; }
-
-    bool structure_equals(const IColumn& rhs) const override {
-        return typeid(rhs) == typeid(ColumnNothing);
-    }
-
-    TypeIndex get_data_type() const override { return TypeIndex::Nothing; }
-};
-
-} // namespace doris::vectorized
diff --git a/be/src/vec/columns/column_object.h 
b/be/src/vec/columns/column_object.h
index f8991092b2..4febce3b52 100644
--- a/be/src/vec/columns/column_object.h
+++ b/be/src/vec/columns/column_object.h
@@ -379,6 +379,10 @@ public:
         LOG(FATAL) << "should not call the method in column object";
     }
 
+    void replicate(const uint32_t* indexs, size_t target_size, IColumn& 
column) const override {
+        LOG(FATAL) << "not support";
+    }
+
     template <typename Func>
     ColumnPtr apply_for_subcolumns(Func&& func, std::string_view func_name) 
const;
 
diff --git a/be/src/vec/columns/predicate_column.h 
b/be/src/vec/columns/predicate_column.h
index f9acd7af63..fd7548c9f5 100644
--- a/be/src/vec/columns/predicate_column.h
+++ b/be/src/vec/columns/predicate_column.h
@@ -389,6 +389,10 @@ public:
         LOG(FATAL) << "get field not supported in PredicateColumnType";
     }
 
+    void replicate(const uint32_t* indexs, size_t target_size, IColumn& 
column) const override {
+        LOG(FATAL) << "not support";
+    }
+
     // it's impossible to use ComplexType as key , so we don't have to 
implement them
     [[noreturn]] StringRef serialize_value_into_arena(size_t n, Arena& arena,
                                                       char const*& begin) 
const override {
diff --git a/be/src/vec/data_types/data_type_nothing.cpp 
b/be/src/vec/data_types/data_type_nothing.cpp
index 09f3421507..ccc2015580 100644
--- a/be/src/vec/data_types/data_type_nothing.cpp
+++ b/be/src/vec/data_types/data_type_nothing.cpp
@@ -22,21 +22,19 @@
 
 #include <typeinfo>
 
-#include "vec/columns/column_nothing.h"
-
 namespace doris::vectorized {
 
 MutableColumnPtr DataTypeNothing::create_column() const {
-    return ColumnNothing::create(0);
+    LOG(FATAL) << "not support";
 }
 
 char* DataTypeNothing::serialize(const IColumn& column, char* buf, int 
be_exec_version) const {
-    return buf;
+    LOG(FATAL) << "not support";
 }
 
 const char* DataTypeNothing::deserialize(const char* buf, IColumn* column,
                                          int be_exec_version) const {
-    return buf;
+    LOG(FATAL) << "not support";
 }
 
 bool DataTypeNothing::equals(const IDataType& rhs) const {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to