Mask the given string except the first 'un_mask_char_count' chars. Ported from org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskShowFirstN.
| 213 | /// Mask the given string except the first 'un_mask_char_count' chars. Ported from |
| 214 | /// org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskShowFirstN. |
| 215 | IR_ALWAYS_INLINE static inline StringVal MaskShowFirstNImpl(FunctionContext* ctx, |
| 216 | const StringVal& val, int un_mask_char_count, int masked_upper_char, |
| 217 | int masked_lower_char, int masked_digit_char, int masked_other_char) { |
| 218 | // To be consistent with Hive, negative char_count is treated as 0. |
| 219 | if (un_mask_char_count < 0) un_mask_char_count = 0; |
| 220 | if (val.is_null || val.len == 0 || un_mask_char_count >= val.len) return val; |
| 221 | if (!ctx->impl()->GetConstFnAttr(FunctionContextImpl::UTF8_MODE)) { |
| 222 | return MaskSubStr(ctx, val, un_mask_char_count, val.len, masked_upper_char, |
| 223 | masked_lower_char, masked_digit_char, masked_other_char); |
| 224 | } |
| 225 | return MaskSubStrUtf8(ctx, val, un_mask_char_count, val.len, masked_upper_char, |
| 226 | masked_lower_char, masked_digit_char, masked_other_char); |
| 227 | } |
| 228 | |
| 229 | /// Mask the given string except the last 'un_mask_char_count' chars. Ported from |
| 230 | /// org.apache.hadoop.hive.ql.udf.generic.GenericUDFMaskShowLastN. |
no test coverage detected