Column must not be empty. (column.size() !== 0)
| 978 | |
| 979 | /// Column must not be empty. (column.size() !== 0) |
| 980 | void MergeTreeDataPartWriterOnDisk::writeColumn( |
| 981 | const NameAndTypePair & name_and_type, |
| 982 | const IColumn & column, |
| 983 | WrittenOffsetColumns & offset_columns, |
| 984 | const Granules & granules, |
| 985 | bool need_finalize) |
| 986 | { |
| 987 | if (granules.empty()) |
| 988 | throw Exception( |
| 989 | ErrorCodes::LOGICAL_ERROR, |
| 990 | "Empty granules for column {}, current mark {}", |
| 991 | backQuoteIfNeed(name_and_type.name), |
| 992 | getCurrentMark()); |
| 993 | |
| 994 | const auto & [name, type] = name_and_type; |
| 995 | |
| 996 | // special code path for ByteMap data type in flatten model |
| 997 | if (column.size() > 0 && type->isByteMap()) |
| 998 | { |
| 999 | if (data_part->versions->enable_compact_map_data) |
| 1000 | writeCompactedByteMapColumn(name_and_type, column, offset_columns, granules); |
| 1001 | else |
| 1002 | writeUncompactedByteMapColumn(name_and_type, column, offset_columns, granules); |
| 1003 | return; |
| 1004 | } |
| 1005 | |
| 1006 | auto [it, inserted] = serialization_states.emplace(name, nullptr); |
| 1007 | |
| 1008 | if (inserted) |
| 1009 | { |
| 1010 | ISerialization::SerializeBinaryBulkSettings serialize_settings; |
| 1011 | serialize_settings.getter = createStreamGetter(name_and_type, offset_columns); |
| 1012 | serializations[name]->serializeBinaryBulkStatePrefix(column, serialize_settings, it->second); |
| 1013 | } |
| 1014 | |
| 1015 | const auto & global_settings = storage.getContext()->getSettingsRef(); |
| 1016 | ISerialization::SerializeBinaryBulkSettings serialize_settings; |
| 1017 | serialize_settings.getter = createStreamGetter(name_and_type, offset_columns); |
| 1018 | serialize_settings.low_cardinality_max_dictionary_size = global_settings.low_cardinality_max_dictionary_size; |
| 1019 | serialize_settings.low_cardinality_use_single_dictionary_for_part = global_settings.low_cardinality_use_single_dictionary_for_part != 0; |
| 1020 | |
| 1021 | for (const auto & granule : granules) |
| 1022 | { |
| 1023 | data_written = true; |
| 1024 | |
| 1025 | if (granule.mark_on_start) |
| 1026 | { |
| 1027 | if (last_non_written_marks.count(name)) |
| 1028 | throw Exception( |
| 1029 | ErrorCodes::LOGICAL_ERROR, |
| 1030 | "We have to add new mark for column, but already have non written mark. Current mark {}, total marks {}, offset {}", |
| 1031 | getCurrentMark(), |
| 1032 | index_granularity.getMarksCount(), |
| 1033 | getRowsWrittenInLastMark()); |
| 1034 | last_non_written_marks[name] = getCurrentMarksForColumn(name_and_type, offset_columns, serialize_settings.path); |
| 1035 | } |
| 1036 | else if (isMapImplicitKey(name) && !last_non_written_marks.count(name)) |
| 1037 | { |
no test coverage detected