Skip to content

Commit

Permalink
Handle recursively normalized data and small tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Owens committed Jan 14, 2025
1 parent b737e8e commit d322e75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 6 additions & 5 deletions cpp/arcticdb/entity/read_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ inline ReadResult create_python_read_result(
// integer protobuf fields default to zero if they are not present on the wire, it is impossible to tell from
// the normalization metadata alone if the data was written with an empty index, or with a very old range index.
// We therefore patch the normalization metadata here in this case
auto norm_meta = std::move(result.desc_.mutable_proto().mutable_normalization());
auto norm_meta = result.desc_.mutable_proto().mutable_normalization();
if (norm_meta->has_df() || norm_meta->has_series()) {
auto common = norm_meta->has_df() ? norm_meta->mutable_df()->mutable_common() : norm_meta->mutable_series()->mutable_common();
if (common->has_index()) {
auto index = common->mutable_index();
if (!index->is_physically_stored() && index->start() == 0 && index->step() == 0) {
if (result.desc_.index().type() == IndexDescriptor::Type::ROWCOUNT) {
index->set_step(1);
}
if (result.desc_.index().type() == IndexDescriptor::Type::ROWCOUNT &&
!index->is_physically_stored()
&& index->start() == 0 &&
index->step() == 0) {
index->set_step(1);
}
}
}
Expand Down
9 changes: 1 addition & 8 deletions cpp/arcticdb/version/version_store_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,7 @@ inline std::vector<std::variant<ReadResult, DataError>> frame_to_read_result(std
std::vector<std::variant<ReadResult, DataError>> read_results;
read_results.reserve(keys_frame_and_descriptors.size());
for (auto& read_version_output : keys_frame_and_descriptors) {
const auto& desc_proto = read_version_output.frame_and_descriptor_.desc_.proto();
read_results.emplace_back(ReadResult(
read_version_output.versioned_item_,
PythonOutputFrame{read_version_output.frame_and_descriptor_.frame_, read_version_output.frame_and_descriptor_.buffers_},
desc_proto.normalization(),
desc_proto.user_meta(),
desc_proto.multi_key_meta(),
std::vector<AtomKey>{}));
read_results.emplace_back(create_python_read_result(read_version_output.versioned_item_, std::move(read_version_output.frame_and_descriptor_)));
}
return read_results;
}
Expand Down

0 comments on commit d322e75

Please sign in to comment.