@@ -260,7 +260,7 @@ void ColumnObject::Subcolumn::insert(Field field, FieldInfo info) {
260
260
if (schema_util::is_conversion_required_between_integers (
261
261
base_type.idx , least_common_type.get_base_type_id ())) {
262
262
VLOG_DEBUG << " Conversion between " << getTypeName (base_type.idx ) << " and "
263
- << getTypeName (least_common_type.get_type_id ());
263
+ << getTypeName (least_common_type.get_base_type_id ());
264
264
DataTypePtr base_data_type;
265
265
TypeIndex base_data_type_id;
266
266
get_least_supertype_jsonb (
@@ -792,7 +792,8 @@ void ColumnObject::try_insert(const Field& field) {
792
792
}
793
793
for (auto & entry : subcolumns) {
794
794
if (old_size == entry->data .size ()) {
795
- bool inserted = try_insert_default_from_nested (entry);
795
+ bool inserted = UNLIKELY (entry->path .has_nested_part () &&
796
+ try_insert_default_from_nested (entry));
796
797
if (!inserted) {
797
798
entry->data .insert_default ();
798
799
}
@@ -838,7 +839,6 @@ bool ColumnObject::Subcolumn::is_null_at(size_t n) const {
838
839
}
839
840
ind -= part->size ();
840
841
}
841
-
842
842
throw doris::Exception (ErrorCode::OUT_OF_BOUND, " Index ({}) for getting field is out of range" ,
843
843
n);
844
844
}
@@ -873,7 +873,6 @@ void ColumnObject::Subcolumn::get(size_t n, Field& res) const {
873
873
874
874
ind -= part->size ();
875
875
}
876
-
877
876
throw doris::Exception (ErrorCode::OUT_OF_BOUND, " Index ({}) for getting field is out of range" ,
878
877
n);
879
878
}
@@ -894,20 +893,18 @@ void ColumnObject::Subcolumn::serialize_to_sparse_column(ColumnString* key, std:
894
893
row -= num_of_defaults_in_prefix;
895
894
for (size_t i = 0 ; i < data.size (); ++i) {
896
895
const auto & part = data[i];
897
- size_t current_column_size = part->size ();
896
+ const auto & nullable_col =
897
+ assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(*part);
898
+ size_t current_column_size = nullable_col.get_null_map_data ().size ();
898
899
if (row < current_column_size) {
899
900
// no need null in sparse column
900
- if (!assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(*part).is_null_at (
901
- row)) {
901
+ if (!nullable_col.is_null_at (row)) {
902
902
// insert key
903
903
key->insert_data (path.data (), path.size ());
904
904
905
905
// every subcolumn is always Nullable
906
906
auto nullable_serde =
907
907
std::static_pointer_cast<DataTypeNullableSerDe>(data_serdes[i]);
908
- auto & nullable_col =
909
- assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(*part);
910
-
911
908
// insert value
912
909
ColumnString::Chars& chars = value->get_chars ();
913
910
nullable_serde->get_nested_serde ()->write_one_cell_to_binary (
@@ -1343,7 +1340,6 @@ size_t ColumnObject::Subcolumn::serialize_text_json(size_t n, BufferWritable& ou
1343
1340
1344
1341
ind -= part->size ();
1345
1342
}
1346
-
1347
1343
throw doris::Exception (ErrorCode::OUT_OF_BOUND,
1348
1344
" Index ({}) for serializing JSON is out of range" , n);
1349
1345
}
@@ -1906,7 +1902,7 @@ Status ColumnObject::finalize(FinalizeMode mode) {
1906
1902
for (size_t i = 0 ; i < std::min (size_t (_max_subcolumns_count), sorted_by_size.size ());
1907
1903
++i) {
1908
1904
// if too many null values, then consider it as sparse column
1909
- if ((double )sorted_by_size[i].second < (double )num_rows * 0.95 ) {
1905
+ if ((double )sorted_by_size[i].second < (double )num_rows * 0.99 ) {
1910
1906
continue ;
1911
1907
}
1912
1908
selected_path.insert (sorted_by_size[i].first );
@@ -2035,6 +2031,7 @@ void ColumnObject::clear_column_data() {
2035
2031
(*std::move (part)).clear ();
2036
2032
}
2037
2033
entry->data .num_of_defaults_in_prefix = 0 ;
2034
+ entry->data .current_num_of_defaults = 0 ;
2038
2035
entry->data .num_rows = 0 ;
2039
2036
}
2040
2037
serialized_sparse_column->clear ();
0 commit comments