MCPcopy Create free account
hub / github.com/apache/impala / DsHllStringify

Method DsHllStringify

be/src/exprs/datasketches-functions-ir.cc:102–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102StringVal DataSketchesFunctions::DsHllStringify(FunctionContext* ctx,
103 const StringVal& serialized_sketch) {
104 if (serialized_sketch.is_null || serialized_sketch.len == 0) return StringVal::null();
105 try {
106 auto sketch = datasketches::hll_sketch::deserialize(serialized_sketch.ptr,
107 serialized_sketch.len);
108 string str = sketch.to_string(true, false, false, false);
109 StringVal dst(ctx, str.size());
110 memcpy(dst.ptr, str.c_str(), str.size());
111 return dst;
112 } catch (const std::exception& e) {
113 LogSketchDeserializationError(ctx, e);
114 return StringVal::null();
115 }
116}
117
118BigIntVal DataSketchesFunctions::DsCpcEstimate(
119 FunctionContext* ctx, const StringVal& serialized_sketch) {

Callers

nothing calls this directly

Calls 4

deserializeFunction · 0.85
to_stringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected