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

Function MaskSubStr

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

Mask the substring in range [start, end) of the given string value. Using rules in 'MaskTransform'. Indices are counted in bytes.

Source from the content-addressed store, hash-verified

94/// Mask the substring in range [start, end) of the given string value. Using rules in
95/// 'MaskTransform'. Indices are counted in bytes.
96static StringVal MaskSubStr(FunctionContext* ctx, const StringVal& val,
97 int start, int end, int masked_upper_char, int masked_lower_char,
98 int masked_digit_char, int masked_other_char) {
99 DCHECK_GE(start, 0);
100 DCHECK_LT(start, end);
101 DCHECK_LE(end, val.len);
102 StringVal result(ctx, val.len);
103 if (UNLIKELY(result.is_null)) return StringVal::null();
104 Ubsan::MemCpy(result.ptr, val.ptr, start);
105 if (end < val.len) Ubsan::MemCpy(result.ptr + end, val.ptr + end, val.len - end);
106 for (int i = start; i < end; ++i) {
107 result.ptr[i] = MaskTransform(val.ptr[i], masked_upper_char, masked_lower_char,
108 masked_digit_char, masked_other_char);
109 }
110 return result;
111}
112
113/// Checks whether the unicode code point is malformed, i.e. illegal or incomplete, and
114/// warns if it is. Returns true if any warning is added.

Callers 5

MaskShowFirstNImplFunction · 0.85
MaskShowLastNImplFunction · 0.85
MaskFirstNImplFunction · 0.85
MaskLastNImplFunction · 0.85
MaskImplFunction · 0.85

Calls 1

MaskTransformFunction · 0.85

Tested by

no test coverage detected