MCPcopy Create free account
hub / github.com/apache/cloudberry / mda_get_offset_values

Function mda_get_offset_values

src/backend/utils/adt/arrayutils.c:174–187  ·  view source on GitHub ↗

* From products of whole-array dimensions and spans of a sub-array, * compute offset distances needed to step through subarray within array * * We assume caller has validated dimensions, so overflow is impossible */

Source from the content-addressed store, hash-verified

172 * We assume caller has validated dimensions, so overflow is impossible
173 */
174void
175mda_get_offset_values(int n, int *dist, const int *prod, const int *span)
176{
177 int i,
178 j;
179
180 dist[n - 1] = 0;
181 for (j = n - 2; j >= 0; j--)
182 {
183 dist[j] = prod[j] - 1;
184 for (i = j + 1; i < n; i++)
185 dist[j] -= (span[i] - 1) * prod[i];
186 }
187}
188
189/*
190 * Generates the tuple that is lexicographically one greater than the current

Callers 3

array_slice_sizeFunction · 0.85
array_extract_sliceFunction · 0.85
array_insert_sliceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected