Commit be25a587 authored by Alessio Netti's avatar Alessio Netti

Analytics: using tolerance parameter in PersystSQL for fuzzy queries

parent 409c9140
...@@ -145,6 +145,7 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) { ...@@ -145,6 +145,7 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
// Clearing the buffer, if already allocated // Clearing the buffer, if already allocated
_buffer.clear(); _buffer.clear();
size_t elCtr = 0; size_t elCtr = 0;
uint64_t tolerance_ms = (uint64_t)_interval * 3 / 2;
uint64_t my_timestamp = getTimestamp() - _go_back_ns; uint64_t my_timestamp = getTimestamp() - _go_back_ns;
// Job units are hierarchical, and thus we iterate over all sub-units associated to each single node // Job units are hierarchical, and thus we iterate over all sub-units associated to each single node
std::vector<std::string> vectorOfSensorNames; std::vector<std::string> vectorOfSensorNames;
...@@ -166,7 +167,7 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) { ...@@ -166,7 +167,7 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
LOG(debug) << "PerSystSql Operator: No names found for vectorOfSensorNames "; LOG(debug) << "PerSystSql Operator: No names found for vectorOfSensorNames ";
return; return;
} }
if (!_queryEngine.querySensor(vectorOfSensorNames, my_timestamp, my_timestamp, _buffer, false)) { if (!_queryEngine.querySensor(vectorOfSensorNames, my_timestamp, my_timestamp, _buffer, false, tolerance_ms * 1000000)) {
LOG(debug)<< "PerSystSql Operator " << _name << " cannot read vector sensor " << (*vectorOfSensorNames.begin()) << "!"; LOG(debug)<< "PerSystSql Operator " << _name << " cannot read vector sensor " << (*vectorOfSensorNames.begin()) << "!";
} }
uint64_t measurement_ts = 0; uint64_t measurement_ts = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment