Skip to content

Commit

Permalink
Merge pull request ClickHouse#65062 from HarryLeeIBM/hlee-s390x-group…
Browse files Browse the repository at this point in the history
…by-fix

Fix broken multi-column aggregation on s390x
  • Loading branch information
yakov-olkhovskiy authored Jun 23, 2024
2 parents 322ab9f + c63ceb3 commit d152876
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/Interpreters/AggregationCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ void fillFixedBatch(size_t keys_size, const ColumnRawPtrs & key_columns, const S
/// Note: here we violate strict aliasing.
/// It should be ok as log as we do not reffer to any value from `out` before filling.
const char * source = static_cast<const ColumnFixedSizeHelper *>(column)->getRawDataBegin<sizeof(T)>();
size_t offset_to = offset;
if constexpr (std::endian::native == std::endian::big)
offset_to = sizeof(Key) - sizeof(T) - offset;
T * dest = reinterpret_cast<T *>(reinterpret_cast<char *>(out.data()) + offset_to);
T * dest = reinterpret_cast<T *>(reinterpret_cast<char *>(out.data()) + offset);
fillFixedBatch<T, sizeof(Key) / sizeof(T)>(num_rows, reinterpret_cast<const T *>(source), dest); /// NOLINT(bugprone-sizeof-expression)
offset += sizeof(T);
}
Expand Down
5 changes: 1 addition & 4 deletions src/Interpreters/AggregationMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,7 @@ void AggregationMethodKeysFixed<TData, has_nullable_keys, has_low_cardinality,co
else
{
size_t size = key_sizes[i];
size_t offset_to = pos;
if constexpr (std::endian::native == std::endian::big)
offset_to = sizeof(Key) - size - pos;
observed_column->insertData(reinterpret_cast<const char *>(&key) + offset_to, size);
observed_column->insertData(reinterpret_cast<const char *>(&key) + pos, size);
pos += size;
}
}
Expand Down

0 comments on commit d152876

Please sign in to comment.