Mask the last 'mask_char_count' chars of the given string. Ported from org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskLastN.
| 262 | /// Mask the last 'mask_char_count' chars of the given string. Ported from |
| 263 | /// org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskLastN. |
| 264 | IR_ALWAYS_INLINE static inline StringVal MaskLastNImpl(FunctionContext* ctx, |
| 265 | const StringVal& val, int mask_char_count, int masked_upper_char, |
| 266 | int masked_lower_char, int masked_digit_char, int masked_other_char) { |
| 267 | if (mask_char_count <= 0 || val.is_null || val.len == 0) return val; |
| 268 | if (mask_char_count > val.len) mask_char_count = val.len; |
| 269 | if (!ctx->impl()->GetConstFnAttr(FunctionContextImpl::UTF8_MODE)) { |
| 270 | return MaskSubStr(ctx, val, val.len - mask_char_count, val.len, masked_upper_char, |
| 271 | masked_lower_char, masked_digit_char, masked_other_char); |
| 272 | } |
| 273 | int start = GetUtf8CodePointCount(ctx, val) - mask_char_count; |
| 274 | if (start < 0) start = 0; |
| 275 | return MaskSubStrUtf8(ctx, val, start, val.len, masked_upper_char, masked_lower_char, |
| 276 | masked_digit_char, masked_other_char); |
| 277 | } |
| 278 | |
| 279 | /// Mask the whole given string. Ported from |
| 280 | /// org.apache.hadoop.hive.ql.udf.generic.GenericUDFMask. |
no test coverage detected