Skip to content

Commit 7a3f378

Browse files
committed
fixup! DPL Analysis: return span directly if the CCDB column is declared as a span
1 parent 845571c commit 7a3f378

File tree

1 file changed

+41
-44
lines changed
  • Framework/Core/include/Framework

1 file changed

+41
-44
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,50 +2452,47 @@ consteval static std::string_view namespace_prefix()
24522452
}; \
24532453
[[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
24542454

2455-
#define DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, _Label_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2456-
struct _Name_ : o2::soa::Column<std::span<std::byte>, _Name_> { \
2457-
static constexpr const char* mLabel = _Label_; \
2458-
static constexpr const char* query = _CCDBQuery_; \
2459-
static constexpr const uint32_t hash = crc32(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2460-
using base = o2::soa::Column<std::span<std::byte>, _Name_>; \
2461-
using type = std::span<std::byte>; \
2462-
using column_t = _Name_; \
2463-
_Name_(arrow::ChunkedArray const* column) \
2464-
: o2::soa::Column<std::span<std::byte>, _Name_>(o2::soa::ColumnIterator<std::span<std::byte>>(column)) \
2465-
{ \
2466-
} \
2467-
\
2468-
_Name_() = default; \
2469-
_Name_(_Name_ const& other) = default; \
2470-
_Name_& operator=(_Name_ const& other) = default; \
2471-
\
2472-
decltype(auto) _Getter_() const \
2473-
requires(!std::same_as<_ConcreteType_, std::span<std::byte>>) \
2474-
{ \
2475-
static std::byte* payload = nullptr; \
2476-
static _ConcreteType_* deserialised = nullptr; \
2477-
static TClass* c = TClass::GetClass(#_ConcreteType_); \
2478-
auto span = *mColumnIterator; \
2479-
if (payload != (std::byte*)span.data()) { \
2480-
payload = (std::byte*)span.data(); \
2481-
delete deserialised; \
2482-
TBufferFile f(TBufferFile::EMode::kRead, span.size(), (char*)span.data(), kFALSE); \
2483-
deserialised = (_ConcreteType_*)soa::extractCCDBPayload((char*)payload, span.size(), c, "ccdb_object"); \
2484-
} \
2485-
return *deserialised; \
2486-
} \
2487-
\
2488-
decltype(auto) _Getter_() const \
2489-
requires(std::same_as<_ConcreteType_, std::span<std::byte>>) \
2490-
{ \
2491-
return *mColumnIterator; \
2492-
} \
2493-
\
2494-
decltype(auto) \
2495-
get() const \
2496-
{ \
2497-
return _Getter_(); \
2498-
} \
2455+
#define DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, _Label_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2456+
struct _Name_ : o2::soa::Column<std::span<std::byte>, _Name_> { \
2457+
static constexpr const char* mLabel = _Label_; \
2458+
static constexpr const char* query = _CCDBQuery_; \
2459+
static constexpr const uint32_t hash = crc32(namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2460+
using base = o2::soa::Column<std::span<std::byte>, _Name_>; \
2461+
using type = std::span<std::byte>; \
2462+
using column_t = _Name_; \
2463+
_Name_(arrow::ChunkedArray const* column) \
2464+
: o2::soa::Column<std::span<std::byte>, _Name_>(o2::soa::ColumnIterator<std::span<std::byte>>(column)) \
2465+
{ \
2466+
} \
2467+
\
2468+
_Name_() = default; \
2469+
_Name_(_Name_ const& other) = default; \
2470+
_Name_& operator=(_Name_ const& other) = default; \
2471+
\
2472+
decltype(auto) _Getter_() const \
2473+
{ \
2474+
if constexpr (std::same_as<_ConcreteType_, std::span<std::byte>>) { \
2475+
return *mColumnIterator; \
2476+
} else { \
2477+
static std::byte* payload = nullptr; \
2478+
static _ConcreteType_* deserialised = nullptr; \
2479+
static TClass* c = TClass::GetClass(#_ConcreteType_); \
2480+
auto span = *mColumnIterator; \
2481+
if (payload != (std::byte*)span.data()) { \
2482+
payload = (std::byte*)span.data(); \
2483+
delete deserialised; \
2484+
TBufferFile f(TBufferFile::EMode::kRead, span.size(), (char*)span.data(), kFALSE); \
2485+
deserialised = (_ConcreteType_*)soa::extractCCDBPayload((char*)payload, span.size(), c, "ccdb_object"); \
2486+
} \
2487+
return *deserialised; \
2488+
} \
2489+
} \
2490+
\
2491+
decltype(auto) \
2492+
get() const \
2493+
{ \
2494+
return _Getter_(); \
2495+
} \
24992496
};
25002497

25012498
#define DECLARE_SOA_CCDB_COLUMN(_Name_, _Getter_, _ConcreteType_, _CCDBQuery_) \

0 commit comments

Comments
 (0)