@@ -235,100 +235,6 @@ static inline UInt128 ALWAYS_INLINE hash128(
235235 return key;
236236}
237237
238-
239- // / Copy keys to the pool. Then put into pool StringRefs to them and return the pointer to the first.
240- static inline StringRef * ALWAYS_INLINE placeKeysInPool (size_t keys_size, StringRefs & keys, Arena & pool)
241- {
242- for (size_t j = 0 ; j < keys_size; ++j)
243- {
244- char * place = pool.alloc (keys[j].size );
245- memcpy (place, keys[j].data , keys[j].size ); // / TODO padding in Arena and memcpySmall
246- keys[j].data = place;
247- }
248-
249- // / Place the StringRefs on the newly copied keys in the pool.
250- char * res = pool.alloc (keys_size * sizeof (StringRef));
251- memcpy (res, keys.data (), keys_size * sizeof (StringRef));
252-
253- return reinterpret_cast <StringRef *>(res);
254- }
255-
256- /*
257- /// Copy keys to the pool. Then put into pool StringRefs to them and return the pointer to the first.
258- static inline StringRef * ALWAYS_INLINE extractKeysAndPlaceInPool(
259- size_t i,
260- size_t keys_size,
261- const ColumnRawPtrs & key_columns,
262- StringRefs & keys,
263- Arena & pool)
264- {
265- for (size_t j = 0; j < keys_size; ++j)
266- {
267- keys[j] = key_columns[j]->getDataAtWithTerminatingZero(i);
268- char * place = pool.alloc(keys[j].size);
269- memcpy(place, keys[j].data, keys[j].size);
270- keys[j].data = place;
271- }
272-
273- /// Place the StringRefs on the newly copied keys in the pool.
274- char * res = pool.alloc(keys_size * sizeof(StringRef));
275- memcpy(res, keys.data(), keys_size * sizeof(StringRef));
276-
277- return reinterpret_cast<StringRef *>(res);
278- }
279-
280-
281- /// Copy the specified keys to a continuous memory chunk of a pool.
282- /// Subsequently append StringRef objects referring to each key.
283- ///
284- /// [key1][key2]...[keyN][ref1][ref2]...[refN]
285- /// ^ ^ : | |
286- /// +-----|--------:-----+ |
287- /// : +--------:-----------+
288- /// : :
289- /// <-------------->
290- /// (1)
291- ///
292- /// Return a StringRef object, referring to the area (1) of the memory
293- /// chunk that contains the keys. In other words, we ignore their StringRefs.
294- inline StringRef ALWAYS_INLINE extractKeysAndPlaceInPoolContiguous(
295- size_t i,
296- size_t keys_size,
297- const ColumnRawPtrs & key_columns,
298- StringRefs & keys,
299- const TiDB::TiDBCollators & collators,
300- std::vector<std::string> & sort_key_containers,
301- Arena & pool)
302- {
303- size_t sum_keys_size = 0;
304- for (size_t j = 0; j < keys_size; ++j)
305- {
306- keys[j] = key_columns[j]->getDataAtWithTerminatingZero(i);
307- if (!collators.empty() && collators[j] != nullptr)
308- {
309- // todo check if need to handle the terminating zero
310- keys[j] = collators[j]->sortKey(keys[j].data, keys[j].size - 1, sort_key_containers[j]);
311- }
312- sum_keys_size += keys[j].size;
313- }
314-
315- char * res = pool.alloc(sum_keys_size + keys_size * sizeof(StringRef));
316- char * place = res;
317-
318- for (size_t j = 0; j < keys_size; ++j)
319- {
320- memcpy(place, keys[j].data, keys[j].size);
321- keys[j].data = place;
322- place += keys[j].size;
323- }
324-
325- /// Place the StringRefs on the newly copied keys in the pool.
326- memcpy(place, keys.data(), keys_size * sizeof(StringRef));
327-
328- return {res, sum_keys_size};
329- }
330- */
331-
332238/* * Serialize keys into a continuous chunk of memory.
333239 */
334240static inline StringRef ALWAYS_INLINE serializeKeysToPoolContiguous (
0 commit comments