Skip to content

Commit 80082d5

Browse files
authored
Merge pull request #112 from alibuild/alibot-cleanup-14808
2 parents bac0d59 + 6125de3 commit 80082d5

File tree

3 files changed

+27
-29
lines changed

3 files changed

+27
-29
lines changed

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
#include "Framework/Traits.h"
2727

2828
#include <string>
29-
namespace o2::framework {
29+
namespace o2::framework
30+
{
3031
std::string serializeProjectors(std::vector<framework::expressions::Projector>& projectors);
3132
std::string serializeSchema(std::shared_ptr<arrow::Schema>& schema);
32-
}
33+
} // namespace o2::framework
3334

3435
namespace o2::soa
3536
{

Framework/Core/src/AODReaderHelpers.cxx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ auto make_spawn(InputSpec const& input, ProcessingContext& pc)
138138
return o2::framework::spawner<D>(extractOriginals<sources.size(), sources>(pc), input.binding.c_str(), projectors.data(), projector, schema);
139139
}
140140

141-
struct Maker
142-
{
141+
struct Maker {
143142
std::string binding;
144143
std::vector<std::string> labels;
145144
std::vector<std::shared_ptr<gandiva::Expression>> expressions;
@@ -169,7 +168,6 @@ struct Maker
169168

170169
return spawnerHelper(fullTable, schema, binding.c_str(), schema->num_fields(), projector);
171170
}
172-
173171
};
174172

175173
struct Spawnable {
@@ -185,17 +183,17 @@ struct Spawnable {
185183
header::DataHeader::SubSpecificationType version;
186184

187185
Spawnable(InputSpec const& spec)
188-
: binding{spec.binding}
186+
: binding{spec.binding}
189187
{
190188
auto&& [origin_, description_, version_] = DataSpecUtils::asConcreteDataMatcher(spec);
191189
origin = origin_;
192190
description = description_;
193191
version = version_;
194-
auto loc = std::find_if(spec.metadata.begin(), spec.metadata.end(), [](ConfigParamSpec const& cps){ return cps.name.compare("projectors") == 0; });
192+
auto loc = std::find_if(spec.metadata.begin(), spec.metadata.end(), [](ConfigParamSpec const& cps) { return cps.name.compare("projectors") == 0; });
195193
std::stringstream iws(loc->defaultValue.get<std::string>());
196194
projectors = ExpressionJSONHelpers::read(iws);
197195

198-
loc = std::find_if(spec.metadata.begin(), spec.metadata.end(), [](ConfigParamSpec const& cps){ return cps.name.compare("schema") == 0; });
196+
loc = std::find_if(spec.metadata.begin(), spec.metadata.end(), [](ConfigParamSpec const& cps) { return cps.name.compare("schema") == 0; });
199197
iws.clear();
200198
iws.str(loc->defaultValue.get<std::string>());
201199
outputSchema = ArrowJSONHelpers::read(iws);
@@ -209,14 +207,14 @@ struct Spawnable {
209207
std::vector<std::shared_ptr<arrow::Field>> fields;
210208
for (auto& p : projectors) {
211209
expressions::walk(p.node.get(),
212-
[&fields](expressions::Node* n) mutable {
213-
if (n->self.index() == 1) {
214-
auto& b = std::get<expressions::BindingNode>(n->self);
215-
if ( std::find_if(fields.begin(), fields.end(), [&b](std::shared_ptr<arrow::Field> const& field){ return field->name() == b.name; }) == fields.end() ) {
216-
fields.emplace_back(std::make_shared<arrow::Field>(b.name, expressions::concreteArrowType(b.type)));
217-
}
218-
}
219-
});
210+
[&fields](expressions::Node* n) mutable {
211+
if (n->self.index() == 1) {
212+
auto& b = std::get<expressions::BindingNode>(n->self);
213+
if (std::find_if(fields.begin(), fields.end(), [&b](std::shared_ptr<arrow::Field> const& field) { return field->name() == b.name; }) == fields.end()) {
214+
fields.emplace_back(std::make_shared<arrow::Field>(b.name, expressions::concreteArrowType(b.type)));
215+
}
216+
}
217+
});
220218
}
221219
inputSchema = std::make_shared<arrow::Schema>(fields);
222220

@@ -227,8 +225,7 @@ struct Spawnable {
227225
expressions::createExpressionTree(
228226
expressions::createOperations(p),
229227
inputSchema),
230-
outputSchema->field(i))
231-
);
228+
outputSchema->field(i)));
232229
++i;
233230
}
234231
}
@@ -248,10 +245,8 @@ struct Spawnable {
248245
outputSchema,
249246
origin,
250247
description,
251-
version
252-
};
248+
version};
253249
}
254-
255250
};
256251

257252
} // namespace

Framework/Core/src/ExpressionJSONHelpers.cxx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ void o2::framework::ExpressionJSONHelpers::write(std::ostream& o, std::vector<o2
635635
w.EndObject();
636636
}
637637

638-
namespace {
638+
namespace
639+
{
639640
struct SchemaReader : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, SchemaReader> {
640641
using Ch = rapidjson::UTF8<>::Ch;
641642
using SizeType = rapidjson::SizeType;
@@ -679,7 +680,7 @@ struct SchemaReader : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, Sch
679680
{
680681
debug << "Ending array" << std::endl;
681682
if (states.top() == State::IN_LIST) {
682-
//finalize schema
683+
// finalize schema
683684
schema = std::make_shared<arrow::Schema>(fields);
684685
states.pop();
685686
return true;
@@ -773,13 +774,13 @@ struct SchemaReader : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, Sch
773774
return false;
774775
}
775776

776-
bool Int(int i) {
777+
bool Int(int i)
778+
{
777779
debug << "Int(" << i << ")" << std::endl;
778780
return Uint(i);
779781
}
780-
781782
};
782-
}
783+
} // namespace
783784

784785
std::shared_ptr<arrow::Schema> o2::framework::ArrowJSONHelpers::read(std::istream& s)
785786
{
@@ -789,13 +790,14 @@ std::shared_ptr<arrow::Schema> o2::framework::ArrowJSONHelpers::read(std::istrea
789790

790791
bool ok = reader.Parse(isw, sreader);
791792

792-
if(!ok) {
793+
if (!ok) {
793794
throw framework::runtime_error_f("Cannot parse serialized Expression, error: %s at offset: %d", rapidjson::GetParseError_En(reader.GetParseErrorCode()), reader.GetErrorOffset());
794795
}
795796
return sreader.schema;
796797
}
797798

798-
namespace {
799+
namespace
800+
{
799801
void writeSchema(rapidjson::Writer<rapidjson::OStreamWrapper>& w, arrow::Schema* schema)
800802
{
801803
for (auto& f : schema->fields()) {
@@ -807,7 +809,7 @@ void writeSchema(rapidjson::Writer<rapidjson::OStreamWrapper>& w, arrow::Schema*
807809
w.EndObject();
808810
}
809811
}
810-
}
812+
} // namespace
811813

812814
void o2::framework::ArrowJSONHelpers::write(std::ostream& o, std::shared_ptr<arrow::Schema>& schema)
813815
{

0 commit comments

Comments
 (0)