| 335 | } |
| 336 | |
| 337 | StringVal DataSketchesFunctions::DsKllStringify( FunctionContext* ctx, |
| 338 | const StringVal& serialized_sketch) { |
| 339 | if (serialized_sketch.is_null || serialized_sketch.len == 0) return StringVal::null(); |
| 340 | try { |
| 341 | auto sketch = datasketches::kll_sketch<float>::deserialize(serialized_sketch.ptr, |
| 342 | serialized_sketch.len); |
| 343 | string str = sketch.to_string(false, false); |
| 344 | StringVal dst(ctx, str.size()); |
| 345 | memcpy(dst.ptr, str.c_str(), str.size()); |
| 346 | return dst; |
| 347 | } catch (const std::exception& e) { |
| 348 | LogSketchDeserializationError(ctx, e); |
| 349 | return StringVal::null(); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | } |
nothing calls this directly
no test coverage detected