equal
deleted
inserted
replaced
69 InferTypesHandler(shared_ptr<writer::RelationalWriter> relationalWriter, Configuration configuration) : relationalWriter(relationalWriter), configuration(configuration) { |
69 InferTypesHandler(shared_ptr<writer::RelationalWriter> relationalWriter, Configuration configuration) : relationalWriter(relationalWriter), configuration(configuration) { |
70 } |
70 } |
71 |
71 |
72 void startRelation(string_t name, vector<AttributeMetadata> attributes) override { |
72 void startRelation(string_t name, vector<AttributeMetadata> attributes) override { |
73 // TODO: move this logic to relpipe-lib-infertypes and share with certain modules like relpipe-in-csv |
73 // TODO: move this logic to relpipe-lib-infertypes and share with certain modules like relpipe-in-csv |
|
74 currentMode.reset(); |
74 for (RelationConfiguration rc : configuration.relationConfigurations) { |
75 for (RelationConfiguration rc : configuration.relationConfigurations) { |
75 if (std::regex_match(name, rc.relationPattern)) { |
76 if (std::regex_match(name, rc.relationPattern)) { |
76 if (rc.mode == MODE::METADATA || rc.mode == MODE::AUTO && MetadataMode::willInfer(attributes)) currentMode.reset(new MetadataMode(relationalWriter)); |
77 if (rc.mode == MODE::METADATA || rc.mode == MODE::AUTO && MetadataMode::willInfer(attributes)) currentMode.reset(new MetadataMode(relationalWriter)); |
77 else if (rc.mode == MODE::DATA) currentMode.reset(new DataMode(relationalWriter)); |
78 else if (rc.mode == MODE::DATA) currentMode.reset(new DataMode(relationalWriter)); |
78 else throw std::logic_error("Unsupported mode: " + std::to_string((int) rc.mode)); |
79 else throw std::logic_error("Unsupported mode: " + std::to_string((int) rc.mode)); |