src/StreamletAttributeFinder.h
branchv_0
changeset 70 018e2609f5bb
parent 62 a467e8cbd16b
child 96 c34106244a54
--- a/src/StreamletAttributeFinder.h	Tue Jan 28 23:35:25 2020 +0100
+++ b/src/StreamletAttributeFinder.h	Wed Jan 29 00:58:37 2020 +0100
@@ -82,6 +82,16 @@
 		}
 	}
 
+	void writeAttribute(RelationalWriter* writer, TypeId typeId, SubProcess::Message* m) {
+		if (m->parameters[1] == L"true") {
+			if (typeId == TypeId::BOOLEAN) writer->writeAttribute(L"false");
+			else if (typeId == TypeId::INTEGER)writer->writeAttribute(L"0");
+			else writer->writeAttribute(L""); // TODO: write acruall null values (when supported)
+		} else {
+			writer->writeAttribute(m->parameters[0]);
+		}
+	}
+
 protected:
 
 	void startFile(const fs::path& file, const string& fileRaw, bool exists) override {
@@ -98,7 +108,7 @@
 		if (field.group == RequestedField::GROUP_STREAMLET) {
 			for (auto metadata : cachedMetadata[field.id]) {
 				SubProcess::Message m = subProcesses[field.id]->read();
-				if (m.code == StreamletMsg::OUTPUT_ATTRIBUTE) writer->writeAttribute(m.parameters[0]);
+				if (m.code == StreamletMsg::OUTPUT_ATTRIBUTE) writeAttribute(writer, metadata.typeId, &m);
 				else throw RelpipeWriterException(L"Protocol violation from exec sub-process while reading: „" + metadata.attributeName + L"“. Expected OUTPUT_ATTRIBUTE but got: " + m.toString());
 			}