Skip to content

Commit dc5465a

Browse files
committed
index builder info and serialization
1 parent 71a32ac commit dc5465a

File tree

6 files changed

+113
-2
lines changed

6 files changed

+113
-2
lines changed

Framework/AnalysisSupport/src/AODReaderHelpers.cxx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,38 @@ auto make_build(D metadata, InputSpec const& input, ProcessingContext& pc)
5757
extractOriginals<sources.size(), sources>(pc),
5858
index_pack_t{});
5959
}
60+
61+
struct Builder {
62+
63+
};
64+
65+
struct Buildable {
66+
std::string binding;
67+
68+
header::DataOrigin origin;
69+
header::DataDescription description;
70+
header::DataHeader::SubSpecificationType version;
71+
72+
Buildable(InputSpec const& spec)
73+
: binding{spec.binding}
74+
{
75+
auto&& [origin_, description_, version_] = DataSpecUtils::asConcreteDataMatcher(spec);
76+
origin = origin_;
77+
description = description_;
78+
version = version_;
79+
80+
// The following components are needed to build an index table
81+
// 1. the labels of the source tables to extract from inputRecord -> extracted from input metadata
82+
// 2. the mapping, in the order of the definition of columns, of the
83+
// position in each source table of an index column pointing to the Key
84+
// and the types of index to write (self, single-valued, slice or array)
85+
// the mapping has to be created at the point where the type information is available and
86+
// put into the input spec metadata as a vector of (type, label, pos)
87+
88+
}
89+
90+
};
91+
6092
} // namespace
6193

6294
AlgorithmSpec AODReaderHelpers::indexBuilderCallback(ConfigContext const& ctx)

Framework/Core/include/Framework/ASoA.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,11 @@ concept with_expression_pack = requires {
13071307
typename T::expression_pack_t{};
13081308
};
13091309

1310+
template <typename T>
1311+
concept with_index_pack = requires {
1312+
typename T::index_pack_t{};
1313+
};
1314+
13101315
template <size_t N1, std::array<TableRef, N1> os1, size_t N2, std::array<TableRef, N2> os2>
13111316
consteval bool is_compatible()
13121317
{

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ constexpr auto tableRef2Schema()
5454
{"\"\""}};
5555
}
5656

57+
enum struct IndexKind : unsigned {
58+
IdxSelf = 0,
59+
IdxSingle = 1,
60+
IdxSlice = 2,
61+
IdxArray = 3
62+
};
63+
64+
struct IndexRecord {
65+
std::string label;
66+
IndexKind kind;
67+
size_t pos;
68+
};
69+
5770
namespace
5871
{
5972
template <soa::with_sources T>
@@ -154,6 +167,20 @@ constexpr auto getExpressionMetadata() -> std::vector<framework::ConfigParamSpec
154167
return {};
155168
}
156169

170+
template <soa::with_index_pack T>
171+
constexpr auto getIndexMetadata() -> std::vector<framework::ConfigParamSpec>
172+
{
173+
174+
return {};
175+
}
176+
177+
template <typename T>
178+
requires(!soa::with_index_pack<T>)
179+
constexpr auto getIndexMetadata() -> std::vector<framework::ConfigParamSpec>
180+
{
181+
return {};
182+
}
183+
157184
} // namespace
158185

159186
template <TableRef R>

Framework/Core/include/Framework/IndexBuilderHelpers.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111

1212
#ifndef O2_FRAMEWORK_INDEXBUILDERHELPERS_H_
1313
#define O2_FRAMEWORK_INDEXBUILDERHELPERS_H_
14-
#include "arrow/array.h"
1514
#include <arrow/chunked_array.h>
1615
#include <arrow/builder.h>
1716
#include <arrow/memory_pool.h>
1817
#include <string>
1918
#include <memory>
20-
#include <type_traits>
2119

2220
namespace o2::framework
2321
{
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#include "IndexJSONHelpers.h"
13+
14+
namespace o2::framework {
15+
std::vector<o2::soa::IndexRecord> IndexJSONHelpers::read(std::istream& s)
16+
{
17+
18+
}
19+
20+
void IndexJSONHelpers::write(std::ostream& o, std::vector<o2::soa::IndexRecord>& irs)
21+
{
22+
23+
}
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
#ifndef INDEXJSONHELPERS_H
12+
#define INDEXJSONHELPERS_H
13+
14+
#include <Framework/AnalysisHelpers.h>
15+
16+
namespace o2::framework
17+
{
18+
struct IndexJSONHelpers {
19+
static std::vector<o2::soa::IndexRecord> read(std::istream& s);
20+
static void write(std::ostream& o, std::vector<o2::soa::IndexRecord>& irs);
21+
};
22+
23+
} // namespace o2::framework
24+
25+
#endif // INDEXJSONHELPERS_H

0 commit comments

Comments
 (0)