Texera / texera

Collaborative Machine-Learning-Centric Data Analytics Using Workflows
https://texera.github.io
Apache License 2.0
160 stars 68 forks source link

Fix result of workflow with visualization operators is always blank when mongodb is on #2732

Closed mengw15 closed 1 month ago

mengw15 commented 1 month ago

Issue number: #2729


Cause: the sink manager type for visualizer operators is still "edu.uci.ics.texera.workflow.operators.sink.storage.MemoryStorage" even if the mode is set to mongodb. This results in the inability to access sinkMgr.getAllFields() as expected for MongoDB storage.


Fix: Ensure that the "fields" array obtained from "val fields = sinkMgr.getAllFields()" is not empty. If fields is not empty, this indicates that the MongoDB storage is correctly accessed and contains valid data. Here is the implemented fix:

Check if fields is not empty: Only proceed with updating tableFields if fields is not empty and has the required length of at least 3.

Update tableFields: If fields meets the criteria, update tableFields with the relevant field mappings.

Compute statistics: Ensure tableFields contains the necessary fields before computing statistics for categorical, date, and numeric fields.