| 129 | } |
| 130 | |
| 131 | StringVal DataSketchesFunctions::DsCpcStringify( |
| 132 | FunctionContext* ctx, const StringVal& serialized_sketch) { |
| 133 | if (serialized_sketch.is_null || serialized_sketch.len == 0) return StringVal::null(); |
| 134 | try { |
| 135 | auto sketch = datasketches::cpc_sketch::deserialize(serialized_sketch.ptr, |
| 136 | serialized_sketch.len); |
| 137 | string str = sketch.to_string(); |
| 138 | StringVal dst(ctx, str.size()); |
| 139 | memcpy(dst.ptr, str.c_str(), str.size()); |
| 140 | return dst; |
| 141 | } catch (const std::exception& e) { |
| 142 | LogSketchDeserializationError(ctx, e); |
| 143 | return StringVal::null(); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | StringVal DataSketchesFunctions::DsCpcUnionF(FunctionContext* ctx, |
| 148 | const StringVal& first_serialized_sketch, const StringVal& second_serialized_sketch) { |
nothing calls this directly
no test coverage detected