cut can also do DROP of whole relation: just use regex that matches no attributes like $^
--- a/src/CutHandler.h Thu Dec 13 01:28:55 2018 +0100
+++ b/src/CutHandler.h Mon Dec 17 20:06:29 2018 +0100
@@ -70,6 +70,7 @@
}
void startRelation(string_t name, vector<AttributeMetadata> attributes) override {
+ currentRecord.resize(attributes.size());
// TODO: move to a reusable method (or use same metadata on both reader and writer side?)
vector<writer::AttributeMetadata> allWriterMetadata;
for (AttributeMetadata readerMetadata : attributes) {
@@ -87,13 +88,12 @@
}
}
- if (currentAttributeMapping.empty()) throw cli::RelpipeCLIException(L"No attribute matches. Relation must have at least one attribute.", cli::CLI::EXIT_CODE_BAD_SYNTAX); // TODO: review exit code
+ if (currentAttributeMapping.empty()) return; // No attribute matches → DROP whole relation
for (integer_t i : currentAttributeMapping) writerMetadata.push_back(allWriterMetadata[i]);
} else {
writerMetadata = allWriterMetadata;
}
- currentRecord.resize(allWriterMetadata.size());
relationalWriter->startRelation(name, writerMetadata, true);
}