Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Remove implicit cast to size_t #634

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion omniscidb/QueryEngine/OutputBufferInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int64_t get_agg_initial_val(hdk::ir::AggType agg,
CHECK(!(type->isString() || type->isExtDictionary()) ||
(agg == hdk::ir::AggType::kSingleValue || agg == hdk::ir::AggType::kSample));
const auto byte_width =
enable_compaction
enable_compaction && type->size() > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised this didn't cause errors earlier - is it possible for enable_compaction to ever be true here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Varlen aggregate type is used for TopK aggregate only. And in the code below we simply don't use byte_width for the TopK case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Varlen aggregate should also work for SAMPLE(varlen_type), though in that case the aggregation was a hack (we would just place the rowid of the chosen row in the aggregate slot)

? compact_byte_width(static_cast<unsigned>(get_bit_width(type) >> 3),
unsigned(min_byte_width_to_compact))
: sizeof(int64_t);
Expand Down
2 changes: 1 addition & 1 deletion omniscidb/Shared/SqlTypesLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ inline uint64_t exp_to_scale(const unsigned exp) {
}

inline size_t get_bit_width(const hdk::ir::Type* type) {
size_t res = type->isString() ? 32 : type->canonicalSize() * 8;
int res = type->isString() ? 32 : type->canonicalSize() * 8;
if (res < 0) {
throw std::runtime_error("Unexpected type: " + type->toString());
}
Expand Down