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

eldenmoon pushed a commit to branch variant
in repository https://gitbox.apache.org/repos/asf/doris.git

commit fb4c8a519d1ab7657bd10cf255004c12448637d1
Author: eldenmoon <[email protected]>
AuthorDate: Wed Aug 16 11:16:56 2023 +0800

    support unique table and modify some log
---
 be/src/vec/columns/column_object.cpp          |  1 -
 be/src/vec/data_types/data_type_object.cpp    |  8 ++++++--
 be/src/vec/data_types/get_least_supertype.cpp | 26 +++++++++++++-------------
 be/src/vec/functions/function_case.h          |  2 ++
 be/src/vec/utils/template_helpers.hpp         |  2 ++
 5 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/be/src/vec/columns/column_object.cpp 
b/be/src/vec/columns/column_object.cpp
index b904b7a6ae..c794f3cd20 100644
--- a/be/src/vec/columns/column_object.cpp
+++ b/be/src/vec/columns/column_object.cpp
@@ -1252,7 +1252,6 @@ size_t ColumnObject::filter(const Filter& filter) {
 }
 
 void ColumnObject::clear() {
-    DCHECK(is_finalized());
     for (auto& entry : subcolumns) {
         for (auto& part : entry->data.data) {
             part->clear();
diff --git a/be/src/vec/data_types/data_type_object.cpp 
b/be/src/vec/data_types/data_type_object.cpp
index cf8426afbc..bfe071475f 100644
--- a/be/src/vec/data_types/data_type_object.cpp
+++ b/be/src/vec/data_types/data_type_object.cpp
@@ -56,7 +56,9 @@ bool DataTypeObject::equals(const IDataType& rhs) const {
 int64_t DataTypeObject::get_uncompressed_serialized_bytes(const IColumn& 
column,
                                                           int be_exec_version) 
const {
     const auto& column_object = assert_cast<const ColumnObject&>(column);
-    assert(column_object.is_finalized());
+    if (!column_object.is_finalized()) {
+        const_cast<ColumnObject&>(column_object).finalize();
+    }
 
     const auto& subcolumns = column_object.get_subcolumns();
     size_t size = 0;
@@ -82,7 +84,9 @@ int64_t 
DataTypeObject::get_uncompressed_serialized_bytes(const IColumn& column,
 
 char* DataTypeObject::serialize(const IColumn& column, char* buf, int 
be_exec_version) const {
     const auto& column_object = assert_cast<const ColumnObject&>(column);
-    assert(column_object.is_finalized());
+    if (!column_object.is_finalized()) {
+        const_cast<ColumnObject&>(column_object).finalize();
+    }
 #ifndef NDEBUG
     // DCHECK size
     column_object.check_consistency();
diff --git a/be/src/vec/data_types/get_least_supertype.cpp 
b/be/src/vec/data_types/get_least_supertype.cpp
index 588ce2406a..709e165830 100644
--- a/be/src/vec/data_types/get_least_supertype.cpp
+++ b/be/src/vec/data_types/get_least_supertype.cpp
@@ -161,9 +161,9 @@ void get_numeric_type(const TypeIndexSet& types, 
DataTypePtr* type) {
                 *type = std::make_shared<DataTypeFloat64>();
                 return;
             } else {
-                LOG(INFO) << " because some of them are integers and some are 
floating point "
-                             "but there is no floating point type, that can 
exactly represent "
-                             "all required integers";
+                VLOG_DEBUG << " because some of them are integers and some are 
floating point "
+                              "but there is no floating point type, that can 
exactly represent "
+                              "all required integers";
                 *type = nullptr;
                 return throw_or_return<on_error>(
                         types, doris::ErrorCode::INVALID_ARGUMENT,
@@ -189,9 +189,9 @@ void get_numeric_type(const TypeIndexSet& types, 
DataTypePtr* type) {
                 *type = std::make_shared<DataTypeInt64>();
                 return;
             } else {
-                LOG(INFO) << " because some of them are signed integers and 
some are unsigned "
-                             "integers, but there is no signed integer type, 
that can exactly "
-                             "represent all required unsigned integer values";
+                VLOG_DEBUG << " because some of them are signed integers and 
some are unsigned "
+                              "integers, but there is no signed integer type, 
that can exactly "
+                              "represent all required unsigned integer values";
                 return throw_or_return<on_error>(
                         types, doris::ErrorCode::INVALID_ARGUMENT,
                         " because some of them are signed integers and some 
are unsigned "
@@ -345,8 +345,8 @@ void get_least_supertype(const DataTypes& types, 
DataTypePtr* type) {
         if (have_date || have_datetime) {
             bool all_date_or_datetime = type_ids.size() == (have_date + 
have_datetime);
             if (!all_date_or_datetime) {
-                LOG(INFO) << get_exception_message_prefix(types)
-                          << " because some of them are Date/DateTime and some 
of them are not";
+                VLOG_DEBUG << get_exception_message_prefix(types)
+                           << " because some of them are Date/DateTime and 
some of them are not";
                 return throw_or_return<on_error>(
                         types, doris::ErrorCode::INVALID_ARGUMENT,
                         " because some of them are Date/DateTime and some of 
them are not", type);
@@ -415,8 +415,8 @@ void get_least_supertype(const DataTypes& types, 
DataTypePtr* type) {
             }
 
             if (num_supported != type_ids.size()) {
-                LOG(INFO) << get_exception_message_prefix(types)
-                          << " because some of them have no lossless 
convertion to Decimal";
+                VLOG_DEBUG << get_exception_message_prefix(types)
+                           << " because some of them have no lossless 
convertion to Decimal";
                 return throw_or_return<on_error>(
                         types, doris::ErrorCode::INVALID_ARGUMENT,
                         " because some of them have no lossless convertion to 
Decimal", type);
@@ -439,9 +439,9 @@ void get_least_supertype(const DataTypes& types, 
DataTypePtr* type) {
             }
 
             if (min_precision > DataTypeDecimal<Decimal128>::max_precision()) {
-                LOG(INFO) << fmt::format("{} because the least supertype is 
Decimal({},{})",
-                                         get_exception_message_prefix(types), 
min_precision,
-                                         max_scale);
+                VLOG_DEBUG << fmt::format("{} because the least supertype is 
Decimal({},{})",
+                                          get_exception_message_prefix(types), 
min_precision,
+                                          max_scale);
                 return throw_or_return<on_error>(
                         types, doris::ErrorCode::INVALID_ARGUMENT,
                         fmt::format(" because some of them have no lossless "
diff --git a/be/src/vec/functions/function_case.h 
b/be/src/vec/functions/function_case.h
index 944d61ac43..683c611083 100644
--- a/be/src/vec/functions/function_case.h
+++ b/be/src/vec/functions/function_case.h
@@ -50,6 +50,7 @@ class ColumnArray;
 class ColumnMap;
 class ColumnString;
 class ColumnStruct;
+class ColumnObject;
 } // namespace vectorized
 } // namespace doris
 
@@ -266,6 +267,7 @@ public:
                       std::is_same_v<ColumnType, ColumnArray> ||
                       std::is_same_v<ColumnType, ColumnMap> ||
                       std::is_same_v<ColumnType, ColumnStruct> ||
+                      std::is_same_v<ColumnType, ColumnObject> ||
                       std::is_same_v<ColumnType, ColumnHLL>) {
             // result_column and all then_column is not nullable.
             // can't simd when type is string.
diff --git a/be/src/vec/utils/template_helpers.hpp 
b/be/src/vec/utils/template_helpers.hpp
index e0e3cd1d21..03c0eb5156 100644
--- a/be/src/vec/utils/template_helpers.hpp
+++ b/be/src/vec/utils/template_helpers.hpp
@@ -26,6 +26,7 @@
 #include "vec/columns/column_complex.h"
 #include "vec/columns/column_map.h"
 #include "vec/columns/column_struct.h"
+#include "vec/columns/column_object.h"
 #include "vec/columns/columns_number.h"
 #include "vec/data_types/data_type.h"
 #include "vec/functions/function.h"
@@ -60,6 +61,7 @@
     M(Array, ColumnArray)              \
     M(Map, ColumnMap)                  \
     M(Struct, ColumnStruct)            \
+    M(VARIANT, ColumnObject)           \
     M(BitMap, ColumnBitmap)            \
     M(HLL, ColumnHLL)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to