Skip to content

Commit 1bb7ebc

Browse files
committed
add output matchers to tableTransform; add fixmes
1 parent 89ab223 commit 1bb7ebc

3 files changed

Lines changed: 16 additions & 36 deletions

File tree

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -614,34 +614,6 @@ struct TableTransform {
614614
return std::vector{soa::tableRef2InputSpec<sources[Is]>()...};
615615
}(std::make_index_sequence<sources.size()>());
616616
OutputSpec outputSpec = soa::tableRef2OutputSpec<Ref>();
617-
618-
template <soa::TableRef R>
619-
static auto base_spec()
620-
{
621-
return soa::tableRef2InputSpec<R>();
622-
}
623-
624-
static auto base_specs()
625-
{
626-
return []<size_t... Is>(std::index_sequence<Is...>) {
627-
return std::array{base_spec<sources[Is]>()...};
628-
}(std::make_index_sequence<sources.size()>{});
629-
}
630-
631-
static constexpr auto spec()
632-
{
633-
return soa::tableRef2OutputSpec<Ref>();
634-
}
635-
636-
static constexpr auto output()
637-
{
638-
return soa::tableRef2Output<Ref>();
639-
}
640-
641-
static constexpr auto ref()
642-
{
643-
return soa::tableRef2OutputRef<Ref>();
644-
}
645617
};
646618

647619
/// This helper struct allows you to declare extended tables which should be

Framework/Core/include/Framework/AnalysisManagers.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,12 @@ const char* controlOption()
159159
}
160160

161161
template <typename T>
162-
concept with_base_table = requires { T::base_specs(); };
162+
concept with_required_inputs = requires(T t) { t.requiredInputs.size(); };
163163

164-
template <with_base_table T>
165-
bool requestInputs(std::vector<InputSpec>& inputs, T const& /*entity*/)
164+
template <with_required_inputs T>
165+
bool requestInputs(std::vector<InputSpec>& inputs, T const& entity)
166166
{
167-
auto base_specs = T::base_specs();
168-
for (auto base_spec : base_specs) {
167+
for (auto base_spec : entity.requiredInputs) {
169168
base_spec.metadata.push_back(ConfigParamSpec{std::string{controlOption<T>()}, VariantType::Bool, true, {"\"\""}});
170169
DataSpecUtils::updateInputList(inputs, std::forward<InputSpec>(base_spec));
171170
}
@@ -388,21 +387,24 @@ bool finalizeOutput(ProcessingContext& context, T& producesGroup)
388387
template <is_spawns T>
389388
bool finalizeOutput(ProcessingContext& context, T& spawns)
390389
{
391-
context.outputs().adopt(spawns.output(), spawns.asArrowTable());
390+
auto matcher = DataSpecUtils::asConcreteDataMatcher(spawns.outputSpec);
391+
context.outputs().adopt(Output{matcher.origin, matcher.description, matcher.subSpec}, spawns.asArrowTable());
392392
return true;
393393
}
394394

395395
template <is_builds T>
396396
bool finalizeOutput(ProcessingContext& context, T& builds)
397397
{
398-
context.outputs().adopt(builds.output(), builds.asArrowTable());
398+
auto matcher = DataSpecUtils::asConcreteDataMatcher(builds.outputSpec);
399+
context.outputs().adopt(Output{matcher.origin, matcher.description, matcher.subSpec}, builds.asArrowTable());
399400
return true;
400401
}
401402

402403
template <is_defines T>
403404
bool finalizeOutput(ProcessingContext& context, T& defines)
404405
{
405-
context.outputs().adopt(defines.output(), defines.asArrowTable());
406+
auto matcher = DataSpecUtils::asConcreteDataMatcher(defines.outputSpec);
407+
context.outputs().adopt(Output{matcher.origin, matcher.description, matcher.subSpec}, defines.asArrowTable());
406408
return true;
407409
}
408410

Framework/Core/include/Framework/AnalysisTask.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,12 @@ DataProcessorSpec adaptAnalysisTask(ConfigContext const& ctx, Args&&... args)
574574
requiredServices.insert(requiredServices.end(), arrowServices.begin(), arrowServices.end());
575575
homogeneous_apply_refs_sized<numElements>([&requiredServices](auto& element) { return analysis_task_parsers::addService(requiredServices, element); }, *task.get());
576576

577+
/// FIXME: In order to replace origins consistently, there are following things that need to be touched
578+
/// 1. inputs and outputs, including their metadata
579+
/// 2. inputInfos, that contain matchers for extracting arguments of process functions
580+
/// 3. bindingKeys/bindingKeysUnsorted, that contain matchers to extract tables used to calculate slicing (created in init)
581+
/// 4. Produces/Spawns/Defines/Builds contain matchers for required inputs and created outputs that need to be modified
582+
577583
auto algo = AlgorithmSpec::InitCallback{[task = task, expressionInfos, inputInfos](InitContext& ic) mutable {
578584
Cache bindingsKeys;
579585
Cache bindingsKeysUnsorted;

0 commit comments

Comments
 (0)