# HG changeset patch # User František Kučera # Date 1545073589 -3600 # Node ID 9d528c98912d1649fcbd12a3f25708c8790abcd6 # Parent 9ec1290b4a9d5ef392dbec44c243420800ef0a76 cut can also do DROP of whole relation: just use regex that matches no attributes like $^ diff -r 9ec1290b4a9d -r 9d528c98912d src/CutHandler.h --- 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 attributes) override { + currentRecord.resize(attributes.size()); // TODO: move to a reusable method (or use same metadata on both reader and writer side?) vector 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); }