| 100 | } |
| 101 | |
| 102 | StringVal 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 | |
| 118 | BigIntVal DataSketchesFunctions::DsCpcEstimate( |
| 119 | FunctionContext* ctx, const StringVal& serialized_sketch) { |
nothing calls this directly
no test coverage detected