datasketches-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
compact_array_of_strings_tuple_sketch< Allocator > Class Template Reference

Extended class of compact_tuple_sketch for array of strings. More...

#include <array_of_strings_sketch.hpp>

Inheritance diagram for compact_array_of_strings_tuple_sketch< Allocator >:
compact_tuple_sketch< Summary, Allocator > tuple_sketch< Summary, Allocator >

Public Member Functions

template<typename Sketch >
 compact_array_of_strings_tuple_sketch (const Sketch &sketch, bool ordered=true)
 Copy constructor.
 
template<typename SerDe = serde<Summary>>
void serialize (std::ostream &os, const SerDe &sd=SerDe()) const
 This method serializes the sketch into a given stream in a binary form.
 
template<typename SerDe = serde<Summary>>
vector_bytes serialize (unsigned header_size_bytes=0, const SerDe &sd=SerDe()) const
 This method serializes the sketch as a vector of bytes.
 
- Public Member Functions inherited from compact_tuple_sketch< Summary, Allocator >
 compact_tuple_sketch (const Base &other, bool ordered)
 Copy constructor.
 
 compact_tuple_sketch (const compact_tuple_sketch &other)=default
 Copy constructor.
 
 compact_tuple_sketch (compact_tuple_sketch &&) noexcept
 Move constructor.
 
compact_tuple_sketchoperator= (const compact_tuple_sketch &other)=default
 Copy assignment.
 
compact_tuple_sketchoperator= (compact_tuple_sketch &&other)=default
 Move assignment.
 
 compact_tuple_sketch (const theta_sketch_alloc< AllocU64 > &other, const Summary &summary, bool ordered=true)
 Constructor from Theta sketch.
 
virtual Allocator get_allocator () const
 
virtual bool is_empty () const
 
virtual bool is_ordered () const
 
virtual uint64_t get_theta64 () const
 
virtual uint32_t get_num_retained () const
 
virtual uint16_t get_seed_hash () const
 
template<typename Predicate >
compact_tuple_sketch filter (const Predicate &predicate) const
 Produces a Compact Tuple sketch from this sketch by applying a given predicate to each entry.
 
template<typename SerDe = serde<Summary>>
void serialize (std::ostream &os, const SerDe &sd=SerDe()) const
 This method serializes the sketch into a given stream in a binary form.
 
template<typename SerDe = serde<Summary>>
vector_bytes serialize (unsigned header_size_bytes=0, const SerDe &sd=SerDe()) const
 This method serializes the sketch as a vector of bytes.
 
virtual iterator begin ()
 Iterator over entries in this sketch.
 
virtual iterator end ()
 Iterator pointing past the valid range.
 
virtual const_iterator begin () const
 Const iterator over entries in this sketch.
 
virtual const_iterator end () const
 Const iterator pointing past the valid range.
 
- Public Member Functions inherited from tuple_sketch< Summary, Allocator >
double get_estimate () const
 
double get_lower_bound (uint8_t num_std_devs, uint32_t num_subset_entries) const
 Returns the approximate lower error bound given a number of standard deviations over an arbitrary number of items stored in the sketch.
 
double get_lower_bound (uint8_t num_std_devs) const
 Returns the approximate lower error bound given a number of standard deviations.
 
double get_upper_bound (uint8_t num_std_devs, uint32_t num_subset_entries) const
 Returns the approximate upper error bound given a number of standard deviations over an arbitrary number of items stored in the sketch.
 
double get_upper_bound (uint8_t num_std_devs) const
 Returns the approximate upper error bound given a number of standard deviations.
 
bool is_estimation_mode () const
 
double get_theta () const
 
string< Allocator > to_string (bool print_items=false) const
 Provides a human-readable summary of this sketch as a string.
 

Static Public Member Functions

template<typename SerDe = default_array_of_strings_serde<Allocator>>
static compact_array_of_strings_tuple_sketch deserialize (std::istream &is, uint64_t seed=DEFAULT_SEED, const SerDe &sd=SerDe(), const Allocator &allocator=Allocator())
 This method deserializes a sketch from a given stream.
 
template<typename SerDe = default_array_of_strings_serde<Allocator>>
static compact_array_of_strings_tuple_sketch deserialize (const void *bytes, size_t size, uint64_t seed=DEFAULT_SEED, const SerDe &sd=SerDe(), const Allocator &allocator=Allocator())
 This method deserializes a sketch from a given array of bytes.
 
- Static Public Member Functions inherited from compact_tuple_sketch< Summary, Allocator >
template<typename Sketch , typename Predicate >
static compact_tuple_sketch filter (const Sketch &sketch, const Predicate &predicate)
 Produces a Compact Tuple sketch from a given sketch (Update or Compact) by applying a given predicate to each entry.
 
template<typename SerDe = serde<Summary>>
static compact_tuple_sketch deserialize (std::istream &is, uint64_t seed=DEFAULT_SEED, const SerDe &sd=SerDe(), const Allocator &allocator=Allocator())
 This method deserializes a sketch from a given stream.
 
template<typename SerDe = serde<Summary>>
static compact_tuple_sketch deserialize (const void *bytes, size_t size, uint64_t seed=DEFAULT_SEED, const SerDe &sd=SerDe(), const Allocator &allocator=Allocator())
 This method deserializes a sketch from a given array of bytes.
 

Additional Inherited Members

- Protected Member Functions inherited from compact_tuple_sketch< Summary, Allocator >
template<typename SerDe , typename SS = Summary, typename std::enable_if< std::is_arithmetic< SS >::value, int >::type = 0>
size_t get_serialized_size_summaries_bytes (const SerDe &sd) const
 Computes size needed to serialize summaries in the sketch.
 
template<typename SerDe , typename SS = Summary, typename std::enable_if<!std::is_arithmetic< SS >::value, int >::type = 0>
size_t get_serialized_size_summaries_bytes (const SerDe &sd) const
 Computes size needed to serialize summaries in the sketch.
 

Detailed Description

template<typename Allocator = std::allocator<array_of_strings>>
class datasketches::compact_array_of_strings_tuple_sketch< Allocator >

Extended class of compact_tuple_sketch for array of strings.

Requirements:

UTF-8 compatibility: Serialized sketches are intended to be language and platform independent. Other implementations (Java, Go, Rust) enforce UTF-8 encoding for strings. This C++ implementation does not validate UTF-8; it is the caller's responsibility to ensure all strings are valid UTF-8 before calling update(). Non-UTF-8 strings may serialize successfully but will fail to deserialize in other language implementations.

Constructor & Destructor Documentation

◆ compact_array_of_strings_tuple_sketch()

template<typename Allocator >
template<typename Sketch >
compact_array_of_strings_tuple_sketch ( const Sketch &  sketch,
bool  ordered = true 
)

Copy constructor.

Constructs a compact sketch from another sketch (update or compact)

Parameters
othersketch to be constructed from
orderedif true make the resulting sketch ordered

Member Function Documentation

◆ deserialize() [1/2]

template<typename Allocator = std::allocator<array_of_strings>>
template<typename SerDe = default_array_of_strings_serde<Allocator>>
static compact_array_of_strings_tuple_sketch deserialize ( std::istream &  is,
uint64_t  seed = DEFAULT_SEED,
const SerDe &  sd = SerDe(),
const Allocator &  allocator = Allocator() 
)
static

This method deserializes a sketch from a given stream.

Parameters
isinput stream
seedthe seed for the hash function that was used to create the sketch
sdinstance of a SerDe
allocatorinstance of an Allocator
Returns
an instance of the sketch

◆ deserialize() [2/2]

template<typename Allocator = std::allocator<array_of_strings>>
template<typename SerDe = default_array_of_strings_serde<Allocator>>
static compact_array_of_strings_tuple_sketch deserialize ( const void *  bytes,
size_t  size,
uint64_t  seed = DEFAULT_SEED,
const SerDe &  sd = SerDe(),
const Allocator &  allocator = Allocator() 
)
static

This method deserializes a sketch from a given array of bytes.

Parameters
bytespointer to the array of bytes
sizethe size of the array
seedthe seed for the hash function that was used to create the sketch
sdinstance of a SerDe
allocatorinstance of an Allocator
Returns
an instance of the sketch

◆ serialize() [1/2]

template<typename Allocator = std::allocator<array_of_strings>>
template<typename SerDe = serde<Summary>>
void serialize ( std::ostream &  os,
const SerDe &  sd = SerDe() 
) const

This method serializes the sketch into a given stream in a binary form.

Parameters
osoutput stream
sdinstance of a SerDe

◆ serialize() [2/2]

template<typename Allocator = std::allocator<array_of_strings>>
template<typename SerDe = serde<Summary>>
vector_bytes serialize ( unsigned  header_size_bytes = 0,
const SerDe &  sd = SerDe() 
) const

This method serializes the sketch as a vector of bytes.

An optional header can be reserved in front of the sketch. It is a blank space of a given size. This header is used in Datasketches PostgreSQL extension.

Parameters
header_size_bytesspace to reserve in front of the sketch
sdinstance of a SerDe
Returns
serialized sketch as a vector of bytes

The documentation for this class was generated from the following files: