Skip to content

Commit

Permalink
avoid checks for empty sets in the select action:
Browse files Browse the repository at this point in the history
 - Updated check conditions in MetadataMatcher
 - Changed the contruction of the matcher in the Selec action
  • Loading branch information
MircoValentiniECMWF committed Oct 30, 2024
1 parent 72d8909 commit 28f98ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/multio/action/select/Select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace multio::action {

//--------------------------------------------------------------------------------------------------

Select::Select(const ComponentConfiguration& compConf) : ChainedAction{compConf}, selectors_{compConf.parsedConfig()} {}
Select::Select(const ComponentConfiguration& compConf) : ChainedAction{compConf}, selectors_{MatchReduce::construct( compConf.parsedConfig())} {}

void Select::executeImpl(Message msg) {
if (matches(msg)) {
Expand Down
13 changes: 7 additions & 6 deletions src/multio/message/MetadataMatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ bool MatchKeys::matches(const Metadata& md) const {
break;
}
if (kv.second.find(searchKey->second) == kv.second.end()) {
if (enforceSameKeyTypes_) {
if (kv.second.size() == 0) {
std::ostringstream oss;
oss << "[enforce-same-key-type] Matcher for key \"" << kv.first << "\" is an empty set";
throw MetadataException(oss.str());
}
if (enforceSameKeyTypes_ && kv.second.size() > 0 ) {
// Note: NEMO needs the possibiity to use empty sets!!!
//if (kv.second.size() == 0) {
// std::ostringstream oss;
// oss << "[enforce-same-key-type] Matcher for key \"" << kv.first << "\" is an empty set";
// throw MetadataException(oss.str());
//}

if (kv.second.begin()->index() != searchKey->second.index()) {
std::ostringstream oss;
Expand Down

0 comments on commit 28f98ad

Please sign in to comment.