MCPcopy Create free account
hub / github.com/bytedance/bolt / flattenArray

Function flattenArray

bolt/functions/lib/LambdaFunctionUtil.cpp:93–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91} // namespace
92
93ArrayVectorPtr flattenArray(
94 const SelectivityVector& rows,
95 const VectorPtr& vector,
96 DecodedVector& decodedVector) {
97 if (decodedVector.isIdentityMapping()) {
98 return std::dynamic_pointer_cast<ArrayVector>(vector);
99 }
100
101 auto newNumElements = countElements<ArrayVector>(rows, decodedVector);
102
103 BufferPtr newNulls;
104 BufferPtr elementIndices;
105 BufferPtr newSizes;
106 BufferPtr newOffsets;
107 flattenBuffers<ArrayVector>(
108 rows,
109 newNumElements,
110 decodedVector,
111 newNulls,
112 elementIndices,
113 newSizes,
114 newOffsets);
115
116 auto array = decodedVector.base()->as<ArrayVector>();
117 return std::make_shared<ArrayVector>(
118 array->pool(),
119 array->type(),
120 newNulls,
121 rows.end(),
122 newOffsets,
123 newSizes,
124 BaseVector::wrapInDictionary(
125 BufferPtr(nullptr),
126 elementIndices,
127 newNumElements,
128 array->elements()));
129}
130
131MapVectorPtr flattenMap(
132 const SelectivityVector& rows,

Callers 7

applyMethod · 0.85
flattenContainerMethod · 0.85
prepareInputArrayMethod · 0.85
applyMethod · 0.85
applyArrayTypedSetMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 6

wrapInDictionaryFunction · 0.85
isIdentityMappingMethod · 0.80
baseMethod · 0.45
poolMethod · 0.45
typeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected