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

Method DsThetaExclude

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

Source from the content-addressed store, hash-verified

174}
175
176StringVal DataSketchesFunctions::DsThetaExclude(FunctionContext* ctx,
177 const StringVal& serialized_sketch1, const StringVal& serialized_sketch2) {
178 // Note, A and B refer to the two input sketches in the order A-not-B.
179 // if A is null return null.
180 // if A is not null, B is null return copyA.
181 // other return A-not-B.
182 if (!serialized_sketch1.is_null && serialized_sketch1.len > 0) {
183 if (serialized_sketch2.is_null || serialized_sketch2.len == 0) {
184 return StringVal::CopyFrom(ctx, serialized_sketch1.ptr, serialized_sketch1.len);
185 }
186 // A and B are not null, call a_not_b.compute()
187 datasketches::theta_a_not_b a_not_b;
188 try {
189 auto bytes = a_not_b.compute(
190 datasketches::compact_theta_sketch::deserialize(serialized_sketch1.ptr,
191 serialized_sketch1.len),
192 datasketches::compact_theta_sketch::deserialize(serialized_sketch2.ptr,
193 serialized_sketch2.len)
194 ).serialize();
195 StringVal result(ctx, bytes.size());
196 memcpy(result.ptr, bytes.data(), bytes.size());
197 return result;
198 } catch (const std::exception& e) {
199 LogSketchDeserializationError(ctx, e);
200 }
201 }
202 return StringVal::null();
203}
204
205StringVal DataSketchesFunctions::DsThetaUnionF(FunctionContext* ctx,
206 const StringVal& first_serialized_sketch, const StringVal& second_serialized_sketch) {

Callers

nothing calls this directly

Calls 5

deserializeFunction · 0.85
serializeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected