Skip to content

Commit 927cde4

Browse files
committed
Avoid calculating indexing columns
1 parent 4d5a07f commit 927cde4

File tree

1 file changed

+12
-6
lines changed
  • Framework/Core/include/Framework

1 file changed

+12
-6
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,31 +1024,37 @@ concept can_bind = requires(T&& t) {
10241024
{ t.B::mColumnIterator };
10251025
};
10261026

1027+
template <typename... C>
1028+
concept WithIndexColumns = (is_indexing_column<C> || ...);
1029+
10271030
template <typename D, typename O, typename IP, typename... C>
10281031
struct TableIterator : IP, C... {
10291032
public:
10301033
using self_t = TableIterator<D, O, IP, C...>;
10311034
using policy_t = IP;
10321035
using all_columns = framework::pack<C...>;
10331036
using persistent_columns_t = framework::selected_pack<soa::is_persistent_column_t, C...>;
1034-
using indexing_columns_t = framework::selected_pack<is_indexing_t, C...>;
1035-
constexpr inline static bool has_index_v = framework::pack_size(indexing_columns_t{}) > 0;
10361037
using external_index_columns_t = framework::selected_pack<soa::is_external_index_t, C...>;
10371038
using internal_index_columns_t = framework::selected_pack<soa::is_self_index_t, C...>;
10381039
using bindings_pack_t = decltype([]<typename... Cs>(framework::pack<Cs...>) -> framework::pack<typename Cs::binding_t...> {}(external_index_columns_t{})); // decltype(extractBindings(external_index_columns_t{}));
10391040

10401041
TableIterator(arrow::ChunkedArray* columnData[sizeof...(C)], IP&& policy)
10411042
: IP{policy},
10421043
C(columnData[framework::has_type_at_v<C>(all_columns{})])...
1044+
{
1045+
bind();
1046+
}
1047+
1048+
TableIterator(arrow::ChunkedArray* columnData[sizeof...(C)], IP&& policy) requires (WithIndexColumns<C...>)
1049+
: IP{policy},
1050+
C(columnData[framework::has_type_at_v<C>(all_columns{})])...
10431051
{
10441052
bind();
10451053
// In case we have an index column might need to constrain the actual
10461054
// number of rows in the view to the range provided by the index.
10471055
// FIXME: we should really understand what happens to an index when we
10481056
// have a RowViewFiltered.
1049-
if constexpr (has_index_v) {
1050-
this->limitRange(this->rangeStart(), this->rangeEnd());
1051-
}
1057+
this->limitRange(this->rangeStart(), this->rangeEnd());
10521058
}
10531059

10541060
TableIterator() = default;
@@ -1192,7 +1198,7 @@ struct TableIterator : IP, C... {
11921198
[this]<typename T>(T*) -> void {},
11931199
};
11941200
(f(static_cast<C*>(nullptr)), ...);
1195-
if constexpr (has_index_v) {
1201+
if constexpr (WithIndexColumns<C...>) {
11961202
this->setIndices(this->getIndices());
11971203
this->setOffsets(this->getOffsets());
11981204
}

0 commit comments

Comments
 (0)