You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/07/22 16:02:31 UTC

[doris] branch dev-1.1.1 updated: [hotfix](dev-1.1.1) allow nullable column insert data from non-nullable column (#11138)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.1.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/dev-1.1.1 by this push:
     new 9e3c2e00b9 [hotfix](dev-1.1.1) allow nullable column insert data from non-nullable column (#11138)
9e3c2e00b9 is described below

commit 9e3c2e00b9ca00ad5d17b8de9ee066341594909a
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Sat Jul 23 00:02:26 2022 +0800

    [hotfix](dev-1.1.1) allow nullable column insert data from non-nullable column (#11138)
---
 be/src/vec/columns/column_nullable.cpp | 38 ++++++++++++++++++++++++++--------
 be/src/vec/columns/column_nullable.h   |  2 ++
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/be/src/vec/columns/column_nullable.cpp b/be/src/vec/columns/column_nullable.cpp
index d84dce6c42..41a58f063f 100644
--- a/be/src/vec/columns/column_nullable.cpp
+++ b/be/src/vec/columns/column_nullable.cpp
@@ -115,10 +115,10 @@ StringRef ColumnNullable::serialize_value_into_arena(size_t n, Arena& arena,
     return StringRef(nested_ref.data - s, nested_ref.size + s);
 }
 
-    void ColumnNullable::insert_join_null_data() {
-        get_nested_column().insert_default();
-        get_null_map_data().push_back(JOIN_NULL_HINT);
-    }
+void ColumnNullable::insert_join_null_data() {
+    get_nested_column().insert_default();
+    get_null_map_data().push_back(JOIN_NULL_HINT);
+}
 
 const char* ColumnNullable::deserialize_and_insert_from_arena(const char* pos) {
     UInt8 val = *reinterpret_cast<const UInt8*>(pos);
@@ -135,15 +135,24 @@ const char* ColumnNullable::deserialize_and_insert_from_arena(const char* pos) {
 }
 
 void ColumnNullable::insert_range_from(const IColumn& src, size_t start, size_t length) {
+    if (!src.is_nullable()) {
+        return insert_range_from_not_nullable(src, start, length);
+    }
     const ColumnNullable& nullable_col = assert_cast<const ColumnNullable&>(src);
     get_null_map_column().insert_range_from(*nullable_col.null_map, start, length);
     get_nested_column().insert_range_from(*nullable_col.nested_column, start, length);
 }
 
-void ColumnNullable::insert_indices_from(const IColumn& src, const int* indices_begin, const int* indices_end) {
+void ColumnNullable::insert_indices_from(const IColumn& src, const int* indices_begin,
+                                         const int* indices_end) {
+    if (!src.is_nullable()) {
+        return insert_indices_from_not_nullable(src, indices_begin, indices_end);
+    }
     const ColumnNullable& src_concrete = assert_cast<const ColumnNullable&>(src);
-    get_nested_column().insert_indices_from(src_concrete.get_nested_column(), indices_begin, indices_end);
-    get_null_map_column().insert_indices_from(src_concrete.get_null_map_column(), indices_begin, indices_end);
+    get_nested_column().insert_indices_from(src_concrete.get_nested_column(), indices_begin,
+                                            indices_end);
+    get_null_map_column().insert_indices_from(src_concrete.get_null_map_column(), indices_begin,
+                                              indices_end);
 }
 
 void ColumnNullable::insert(const Field& x) {
@@ -157,6 +166,9 @@ void ColumnNullable::insert(const Field& x) {
 }
 
 void ColumnNullable::insert_from(const IColumn& src, size_t n) {
+    if (!src.is_nullable()) {
+        return insert_from_not_nullable(src, n);
+    }
     const ColumnNullable& src_concrete = assert_cast<const ColumnNullable&>(src);
     get_nested_column().insert_from(src_concrete.get_nested_column(), n);
     get_null_map_data().push_back(src_concrete.get_null_map_data()[n]);
@@ -180,6 +192,12 @@ void ColumnNullable::insert_many_from_not_nullable(const IColumn& src, size_t po
     }
 }
 
+void ColumnNullable::insert_indices_from_not_nullable(const IColumn& src, const int* indices_begin,
+                                                      const int* indices_end) {
+    get_nested_column().insert_indices_from(src, indices_begin, indices_end);
+    get_null_map_data().resize_fill(get_null_map_data().size() + indices_end - indices_begin, 0);
+}
+
 void ColumnNullable::pop_back(size_t n) {
     get_nested_column().pop_back(n);
     get_null_map_column().pop_back(n);
@@ -195,8 +213,10 @@ Status ColumnNullable::filter_by_selector(const uint16_t* sel, size_t sel_size,
     const ColumnNullable* nullable_col_ptr = reinterpret_cast<const ColumnNullable*>(col_ptr);
     ColumnPtr nest_col_ptr = nullable_col_ptr->nested_column;
     ColumnPtr null_map_ptr = nullable_col_ptr->null_map;
-    RETURN_IF_ERROR(get_nested_column().filter_by_selector(sel, sel_size, const_cast<doris::vectorized::IColumn*>(nest_col_ptr.get())));
-    RETURN_IF_ERROR(get_null_map_column().filter_by_selector(sel, sel_size, const_cast<doris::vectorized::IColumn*>(null_map_ptr.get())));
+    RETURN_IF_ERROR(get_nested_column().filter_by_selector(
+            sel, sel_size, const_cast<doris::vectorized::IColumn*>(nest_col_ptr.get())));
+    RETURN_IF_ERROR(get_null_map_column().filter_by_selector(
+            sel, sel_size, const_cast<doris::vectorized::IColumn*>(null_map_ptr.get())));
     return Status::OK();
 }
 
diff --git a/be/src/vec/columns/column_nullable.h b/be/src/vec/columns/column_nullable.h
index c5b8ba3f1d..5bbab17520 100644
--- a/be/src/vec/columns/column_nullable.h
+++ b/be/src/vec/columns/column_nullable.h
@@ -94,6 +94,8 @@ public:
     void insert_from_not_nullable(const IColumn& src, size_t n);
     void insert_range_from_not_nullable(const IColumn& src, size_t start, size_t length);
     void insert_many_from_not_nullable(const IColumn& src, size_t position, size_t length);
+    void insert_indices_from_not_nullable(const IColumn& src, const int* indices_begin,
+                                          const int* indices_end);
 
     void insert_many_fix_len_data(const char* pos, size_t num) override {
         get_null_map_column().fill(0, num);


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