| 1 | From 8cb8808b3ceccf4ab3ac542739ef490abe7e76b3 Mon Sep 17 00:00:00 2001
|
| 2 | Message-ID: <8cb8808b3ceccf4ab3ac542739ef490abe7e76b3.1743597010.git.ngraves@ngraves.fr>
|
| 3 | From: Nicolas Graves <[email protected]>
|
| 4 | Date: Wed, 2 Apr 2025 14:29:40 +0200
|
| 5 | Subject: [PATCH] Fix tsl map use
|
| 6 |
|
| 7 | ---
|
| 8 | packages/vaex-core/src/hash_string.hpp | 25 ++++++++++++++++---------
|
| 9 | 1 file changed, 16 insertions(+), 9 deletions(-)
|
| 10 |
|
| 11 | diff --git a/packages/vaex-core/src/hash_string.hpp b/packages/vaex-core/src/hash_string.hpp
|
| 12 | index d3b60199..0ed69d1c 100644
|
| 13 | |
| 14 | |
| 15 | @@ -39,13 +39,15 @@ class hash_base : public hash_common<Derived, T, hashmap<T, int64_t>> {
|
| 16 | for (int i = 0; i < nmaps; i++) {
|
| 17 | string_arrays.emplace_back(std::make_shared<StringList64>());
|
| 18 | StringList64 *strings = string_arrays[i].get();
|
| 19 | - // equal_to<string_ref>& eq = this->maps[i].key_eq();
|
| 20 | - this->maps[i].m_ht.strings_equals = strings;
|
| 21 | - this->maps[i].m_ht.strings_hash = strings;
|
| 22 | + equal_to<key_type> eq;
|
| 23 | + eq.strings_equals = strings;
|
| 24 | + hash<key_type> h;
|
| 25 | + h.strings_hash = strings;
|
| 26 | + this->maps[i] = hashmap_type(8, h, eq);
|
| 27 | }
|
| 28 | };
|
| 29 |
|
| 30 | - virtual std::string _get(hashmap_type &map, typename hashmap_type::key_type key) override { return map.m_ht.strings_equals->get(key.index); };
|
| 31 | + virtual std::string _get(hashmap_type &map, typename hashmap_type::key_type key) override { return string_arrays[0]->get(key.index); };
|
| 32 |
|
| 33 | size_t bytes_used() const {
|
| 34 | int64_t buffer_size = 0; // collect buffer size
|
| 35 | @@ -391,9 +393,12 @@ class ordered_set : public hash_base<ordered_set<T>, T, T, V> {
|
| 36 | template <class SL>
|
| 37 | static ordered_set *create(std::shared_ptr<SL> keys, int64_t null_value, int64_t nan_count, int64_t null_count, std::string *fingerprint) {
|
| 38 | ordered_set *set = new ordered_set(1);
|
| 39 | - set->maps[0].m_ht.strings_equals = keys.get();
|
| 40 | - set->maps[0].m_ht.strings_hash = keys.get();
|
| 41 | set->string_arrays[0] = keys;
|
| 42 | + equal_to<key_type> eq;
|
| 43 | + eq.strings_equals = keys.get();
|
| 44 | + hash<key_type> h;
|
| 45 | + h.strings_hash = keys.get();
|
| 46 | + set->maps[0] = hashmap_type(keys->length, h, eq);
|
| 47 | {
|
| 48 | size_t size = keys->length;
|
| 49 | set->maps[0].reserve(size);
|
| 50 | @@ -701,9 +706,11 @@ class index_hash : public hash_base<index_hash<T>, T, T, V> {
|
| 51 | // string_arrays_overflow.emplace_back(std::make_shared<StringList64>());
|
| 52 | // for each key in overflow, it should be present in the main string array
|
| 53 | StringList64 *strings = this->string_arrays[i].get();
|
| 54 | - // equal_to<string_ref>& eq = this->maps[i].key_eq();
|
| 55 | - overflows[i].m_ht.strings_equals = strings;
|
| 56 | - overflows[i].m_ht.strings_hash = strings;
|
| 57 | + equal_to<key_type> eq;
|
| 58 | + eq.strings_equals = strings;
|
| 59 | + hash<key_type> h;
|
| 60 | + h.strings_hash = strings;
|
| 61 | + overflows[i] = overflow_type(8, h, eq);
|
| 62 | }
|
| 63 | }
|
| 64 |
|
| 65 | --
|
| 66 | 2.49.0
|
| 67 |
|