dib-lab / kProcessor

kProcessor: kmers processing framework.
https://kprocessor.readthedocs.io
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

`kProcessor::indexPriorityQueue()` does not fill/save the `namesMap`. #97

Open mr-eyes opened 2 years ago

mr-eyes commented 2 years ago

This issue is related to #92

So, I figured out how to retrieve the namesMap of a multiColumn kDataFrame. The only thing is that indexPriorityQueue() function does not fill the column namesMap in the following line (I might be wrong, though)

https://github.com/dib-lab/kProcessor/blob/871d32087367f8a885746e22af0bc0868c5c4492/include/kProcessor/defaultColumn.hpp#L796-L797

The way I am retrieving the namesMap is similar to a usecase

// After loading KF
auto names_map = ((deduplicatedColumn<StringColorColumn>*)KF->columns["color"])->values->namesMap;

The error I got if tried to iterate over names_map:

[1]    16945 segmentation fault 

Further backtrace: (happens as well if changed the namesMap from flat_hash_map to unordered_map)

#0  phmap::priv::raw_hash_set<phmap::priv::FlatHashMapPolicy<unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::begin (this=0x555555bc89f0)
    at /home/mabuelanin/dib-dev/try_kp2/lib/kProcessor/ThirdParty/kmerDecoder/lib/parallel-hashmap/parallel_hashmap/phmap.h:1162
        it = {ctrl_ = 0x4 <error: Cannot access memory at address 0x4>, {slot_ = 0x555555bc65c0}}
        it = <optimized out>
#1  main (argc=<optimized out>, argv=<optimized out>) at /home/mabuelanin/dib-dev/try_kp2/iterate_over_indexP.cpp:43
        name = <optimized out>
        __for_range = @0x555555bc89f0: {<phmap::priv::raw_hash_map<phmap::priv::FlatHashMapPolicy<unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >> = {<phmap::priv::raw_hash_set<phmap::priv::FlatHashMapPolicy<unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >> = {ctrl_ = 0x4 <error: Cannot access memory at address 0x4>, slots_ = 0x555555bc65c0, size_ = 8, 
              capacity_ = 93824999000688, infoz_ = {<No data fields>}, 
              settings_ = {<phmap::priv::internal_compressed_tuple::CompressedTupleImpl<phmap::priv::CompressedTuple<unsigned long, phmap::--Type <RET> for more, q to quit, c to continue without paging--
Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, phmap::integer_sequence<unsigned long, 0, 1, 2, 3> >> = {<phmap::priv::internal_compressed_tuple::Storage<phmap::priv::CompressedTuple<unsigned long, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, 0, false>> = {
                    value = 93824999001200}, <phmap::priv::internal_compressed_tuple::Storage<phmap::priv::CompressedTuple<unsigned long, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, 1, true>> = {<phmap::Hash<unsigned int>> = {<phmap::phmap_unary_function<unsigned int, unsigned long>> = {<No data fields>}, <No data fields>}, <No data fields>}, <phmap::priv::internal_compressed_tuple::Storage<phmap::priv::CompressedTuple<unsigned long, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, 2, true>> = {<phmap::EqualTo<unsigned int>> = {<No data fields>}, <No data fields>}, <phmap::priv::internal_compressed_tuple::Storage<phmap::priv::CompressedTuple<unsigned long, phmap::Hash<unsigned int>, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, 3, true>> = {<std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<__gnu_cxx::new_allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, <No data fields>}
--Type <RET> for more, q to quit, c to continue without paging--
        __for_begin = <optimized out>
        __for_end = <optimized out>
        KF = <optimized out>
        it = {origin = 0x555555bc5ed0, iterator = 0x555555bc87a0}