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

Function MaskFirstNImpl

be/src/exprs/mask-functions-ir.cc:249–260  ·  view source on GitHub ↗

Mask the first 'mask_char_count' chars of the given string. Ported from org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskFirstN.

Source from the content-addressed store, hash-verified

247/// Mask the first 'mask_char_count' chars of the given string. Ported from
248/// org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskFirstN.
249IR_ALWAYS_INLINE static inline StringVal MaskFirstNImpl(FunctionContext* ctx,
250 const StringVal& val, int mask_char_count, int masked_upper_char,
251 int masked_lower_char, int masked_digit_char, int masked_other_char) {
252 if (mask_char_count <= 0 || val.is_null || val.len == 0) return val;
253 if (mask_char_count > val.len) mask_char_count = val.len;
254 if (!ctx->impl()->GetConstFnAttr(FunctionContextImpl::UTF8_MODE)) {
255 return MaskSubStr(ctx, val, 0, mask_char_count, masked_upper_char, masked_lower_char,
256 masked_digit_char, masked_other_char);
257 }
258 return MaskSubStrUtf8(ctx, val, 0, mask_char_count, masked_upper_char,
259 masked_lower_char, masked_digit_char, masked_other_char);
260}
261
262/// Mask the last 'mask_char_count' chars of the given string. Ported from
263/// org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskLastN.

Callers 1

MaskFirstNMethod · 0.85

Calls 6

MaskSubStrFunction · 0.85
MaskSubStrUtf8Function · 0.85
GetNumDigitsFunction · 0.85
MaskShowLastNImplFunction · 0.85
GetConstFnAttrMethod · 0.80
implMethod · 0.80

Tested by

no test coverage detected