Skip to content

Commit 7ddffeb

Browse files
committed
fixup! rework index builder
1 parent 54fb57a commit 7ddffeb

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,29 +3262,29 @@ consteval auto getIndexTargets()
32623262
O2HASH(#_Name_ "CfgExtension"); \
32633263
DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_FULL(_Name_, #_Name_ "CfgExtension", _Table_, "AOD", "EX" _Description_, 0, __VA_ARGS__)
32643264

3265-
#define DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, _Origin_, _Version_, _Desc_, _Exclusive_, ...) \
3266-
O2HASH(#_Name_); \
3267-
O2HASH(_Desc_ "/" #_Version_); \
3268-
template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3269-
struct _Name_##MetadataFrom : o2::aod::TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, soa::Index<>, __VA_ARGS__> { \
3270-
static constexpr bool exclusive = _Exclusive_; \
3271-
using Key = _Key_; \
3272-
using index_pack_t = framework::pack<__VA_ARGS__>; \
3273-
static constexpr const auto sources = []<typename... Cs>(framework::pack<Cs...>) { \
3274-
constexpr auto a = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3275-
return o2::aod::filterForKey<a.size(), a, Key>(); \
3276-
}(framework::pack<__VA_ARGS__>{}); \
3277-
static_assert(sources.size() == framework::pack_size(index_pack_t{}), "One of the referred tables does not have index to Key"); \
3278-
}; \
3279-
using _Name_##Metadata = _Name_##MetadataFrom<o2::aod::Hash<_Origin_ ""_h>>; \
3280-
\
3281-
template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3282-
using _Name_##From = o2::soa::IndexTable<o2::aod::Hash<#_Name_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O, _Key_, __VA_ARGS__>; \
3283-
using _Name_ = _Name_##From<o2::aod::Hash<_Origin_ ""_h>>; \
3284-
\
3285-
template <> \
3286-
struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3287-
using metadata = _Name_##Metadata; \
3265+
#define DECLARE_SOA_INDEX_TABLE_FULL(_Name_, _Key_, _Origin_, _Version_, _Desc_, _Exclusive_, ...) \
3266+
O2HASH(#_Name_); \
3267+
O2HASH(_Desc_ "/" #_Version_); \
3268+
template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3269+
struct _Name_##MetadataFrom : o2::aod::TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, soa::Index<>, __VA_ARGS__> { \
3270+
static constexpr bool exclusive = _Exclusive_; \
3271+
using Key = _Key_; \
3272+
using index_pack_t = framework::pack<__VA_ARGS__>; \
3273+
static constexpr const auto sources = []<typename... Cs>(framework::pack<Cs...>) { \
3274+
constexpr auto a = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3275+
return o2::aod::filterForKey<a.size(), a, Key>(); \
3276+
}(framework::pack<__VA_ARGS__>{}); \
3277+
static_assert(sources.size() - Key::originals.size() + 1 == framework::pack_size(index_pack_t{}), "One of the referred tables does not have index to Key"); \
3278+
}; \
3279+
using _Name_##Metadata = _Name_##MetadataFrom<o2::aod::Hash<_Origin_ ""_h>>; \
3280+
\
3281+
template <typename O = o2::aod::Hash<_Origin_ ""_h>> \
3282+
using _Name_##From = o2::soa::IndexTable<o2::aod::Hash<#_Name_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O, _Key_, __VA_ARGS__>; \
3283+
using _Name_ = _Name_##From<o2::aod::Hash<_Origin_ ""_h>>; \
3284+
\
3285+
template <> \
3286+
struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3287+
using metadata = _Name_##Metadata; \
32883288
};
32893289

32903290
// Declare were each row is associated to a timestamp column of an _TimestampSource_

Framework/Core/src/AnalysisHelpers.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ std::vector<framework::IndexColumnBuilderNG> IndexBuilder::makeBuilders(std::vec
1919
std::vector<framework::IndexColumnBuilderNG> builders;
2020
auto pool = arrow::default_memory_pool();
2121
builders.emplace_back(IndexKind::IdxSelf, records[0].pos, pool);
22-
if (records[0].kind != soa::IndexKind::IdxSelf) {
22+
if (records[0].pos >= 0) {
2323
std::get<framework::SelfBuilder>(builders[0].builder).keyIndex = std::make_unique<framework::ChunkedArrayIterator>(tables[0]->column(records[0].pos));
2424
}
2525

@@ -33,10 +33,10 @@ std::vector<framework::IndexColumnBuilderNG> IndexBuilder::makeBuilders(std::vec
3333
void IndexBuilder::resetBuilders(std::vector<framework::IndexColumnBuilderNG>& builders, std::vector<std::shared_ptr<arrow::Table>>&& tables)
3434
{
3535
for (auto i = 0U; i < builders.size(); ++i) {
36-
builders[i].reset(tables[i]->column(builders[i].mColumnPos));
36+
builders[i].reset(builders[i].mColumnPos >= 0 ? tables[i]->column(builders[i].mColumnPos) : nullptr);
3737
}
3838

39-
if (std::get<framework::SelfBuilder>(builders[0].builder).keyIndex != nullptr) {
39+
if (builders[0].mColumnPos >= 0) {
4040
std::get<framework::SelfBuilder>(builders[0].builder).keyIndex = std::make_unique<framework::ChunkedArrayIterator>(tables[0]->column(builders[0].mColumnPos));
4141
}
4242
}

0 commit comments

Comments
 (0)