Skip to content

Commit

Permalink
Add support for complex types to histogram Presto function (facebooki…
Browse files Browse the repository at this point in the history
…ncubator#10297)

Summary:
Pull Request resolved: facebookincubator#10297

Add support for complex types and UNKNOWN to histogram aggregate function.

Reviewed By: amitkdutta

Differential Revision: D58973456

fbshipit-source-id: 1153bd629290951a78ddea8244ea3bf47a1e78b4
  • Loading branch information
mbasmanova authored and facebook-github-bot committed Jun 25, 2024
1 parent cee2627 commit dc834b7
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 73 deletions.
12 changes: 9 additions & 3 deletions velox/exec/AddressableNonNullValueList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,22 @@ AddressableNonNullValueList::Entry AddressableNonNullValueList::append(
const DecodedVector& decoded,
vector_size_t index,
HashStringAllocator* allocator) {
return append(*decoded.base(), decoded.index(index), allocator);
}

AddressableNonNullValueList::Entry AddressableNonNullValueList::append(
const BaseVector& vector,
vector_size_t index,
HashStringAllocator* allocator) {
auto stream = initStream(allocator);

const auto hash = decoded.base()->hashValueAt(decoded.index(index));
const auto hash = vector.hashValueAt(index);

const auto originalSize = stream.size();

// Write value.
exec::ContainerRowSerdeOptions options{};
exec::ContainerRowSerde::serialize(
*decoded.base(), decoded.index(index), stream, options);
exec::ContainerRowSerde::serialize(vector, index, stream, options);
++size_;

auto startAndFinish = allocator->finishWrite(stream, 1024);
Expand Down
6 changes: 6 additions & 0 deletions velox/exec/AddressableNonNullValueList.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class AddressableNonNullValueList {
vector_size_t index,
HashStringAllocator* allocator);

/// Same as above, but takes BaseVector.
Entry append(
const BaseVector& vector,
vector_size_t index,
HashStringAllocator* allocator);

/// Append a non-null serialized value to the end of the list.
/// Returns position that can be used to access the value later.
HashStringAllocator::Position appendSerialized(
Expand Down
Loading

0 comments on commit dc834b7

Please sign in to comment.