@@ -87,7 +87,7 @@ struct WritingCursor<soa::Table<ORIGIN, PC...>> {
8787 template <typename T>
8888 static decltype (auto ) extract(T const & arg)
8989 {
90- if constexpr (soa::is_soa_iterator_v<T> ) {
90+ if constexpr (requires (T t) { t. globalIndex (); } ) {
9191 return arg.globalIndex ();
9292 } else {
9393 static_assert (!framework::has_type<T>(framework::pack<PC...>{}), " Argument type mismatch" );
@@ -104,6 +104,7 @@ struct WritingCursor<soa::Table<ORIGIN, PC...>> {
104104
105105// / Helper to define output for a Table
106106template <typename T>
107+ requires soa::is_table<T> || soa::is_iterator<T>
107108struct OutputForTable {
108109 using table_t = T;
109110 using metadata = typename aod::MetadataTrait<table_t >::metadata;
@@ -243,16 +244,15 @@ namespace
243244template <typename T, typename Key>
244245inline std::shared_ptr<arrow::ChunkedArray> getIndexToKey (arrow::Table* table)
245246{
246- using IC = framework::pack_element_t <framework::has_type_at_conditional <soa::is_binding_compatible, Key>(typename T::external_index_columns_t {}), typename T::external_index_columns_t >;
247- return table->column (framework::has_type_at <IC>(typename T::persistent_columns_t {}));
247+ using IC = framework::pack_element_t <framework::has_type_at_conditional_v <soa::is_binding_compatible, Key>(typename T::external_index_columns_t {}), typename T::external_index_columns_t >;
248+ return table->column (framework::has_type_at_v <IC>(typename T::persistent_columns_t {}));
248249}
249250
250- template <typename C>
251+ template <soa::is_column C>
251252struct ColumnTrait {
252- static_assert (framework::is_base_of_template_v<o2::soa::Column, C>, " Not a column type!" );
253253 using column_t = C;
254254
255- static constexpr auto listSize ()
255+ static consteval auto listSize ()
256256 {
257257 if constexpr (std::is_same_v<typename C::type, std::vector<int >>) {
258258 return -1 ;
@@ -483,14 +483,14 @@ struct Service {
483483 }
484484};
485485
486- template <typename T>
487- auto getTableFromFilter (const T& table, soa::SelectionVector&& selection)
486+ auto getTableFromFilter (soa::is_filtered_table auto const & table, soa::SelectionVector&& selection)
488487{
489- if constexpr (soa::is_soa_filtered_v<std::decay_t <T>>) {
490- return std::make_unique<o2::soa::Filtered<T>>(std::vector{table}, std::forward<soa::SelectionVector>(selection));
491- } else {
492- return std::make_unique<o2::soa::Filtered<T>>(std::vector{table.asArrowTable ()}, std::forward<soa::SelectionVector>(selection));
493- }
488+ return std::make_unique<o2::soa::Filtered<std::decay_t <decltype (table)>>>(std::vector{table}, std::forward<soa::SelectionVector>(selection));
489+ }
490+
491+ auto getTableFromFilter (soa::is_not_filtered_table auto const & table, soa::SelectionVector&& selection)
492+ {
493+ return std::make_unique<o2::soa::Filtered<std::decay_t <decltype (table)>>>(std::vector{table.asArrowTable ()}, std::forward<soa::SelectionVector>(selection));
494494}
495495
496496void initializePartitionCaches (std::set<uint32_t > const & hashes, std::shared_ptr<arrow::Schema> const & schema, expressions::Filter const & filter, gandiva::NodePtr& tree, gandiva::FilterPtr& gfilter);
@@ -611,20 +611,18 @@ struct Partition {
611611namespace o2 ::soa
612612{
613613// / On-the-fly adding of expression columns
614- template <typename T, typename ... Cs>
614+ template <soa::is_table T, soa::is_spawnable_column ... Cs>
615615auto Extend (T const & table)
616616{
617- static_assert ((soa::is_type_spawnable_v<Cs> && ...), " You can only extend a table with expression columns" );
618617 using output_t = Join<T, soa::Table<o2::framework::OriginEnc{" JOIN" }, Cs...>>;
619618 return output_t {{o2::framework::spawner<o2::framework::OriginEnc{" JOIN" }>(framework::pack<Cs...>{}, {table.asArrowTable ()}, " dynamicExtension" ), table.asArrowTable ()}, 0 };
620619}
621620
622621// / Template function to attach dynamic columns on-the-fly (e.g. inside
623622// / process() function). Dynamic columns need to be compatible with the table.
624- template <typename T, typename ... Cs>
623+ template <soa::is_table T, soa::is_dynamic_column ... Cs>
625624auto Attach (T const & table)
626625{
627- static_assert ((framework::is_base_of_template_v<o2::soa::DynamicColumn, Cs> && ...), " You can only attach dynamic columns" );
628626 using output_t = Join<T, o2::soa::Table<o2::framework::OriginEnc{" JOIN" }, Cs...>>;
629627 return output_t {{table.asArrowTable ()}, table.offset ()};
630628}
0 commit comments