Skip to content

Commit 8cb5d06

Browse files
committed
dont load 'nan' as a string
1 parent 74b43f5 commit 8cb5d06

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

CommonData/column.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ void Column::dbLoadOldIndex(int index)
116116
_ints.clear();
117117
labelsClear();
118118
db().labelsClear(_id);
119+
120+
for(int row=0; row<_strs.size() && row < _dbls.size(); row++)
121+
{
122+
Log::log() << "_strs["<< row << "] == " << _strs[row] << " and _dbls["<< row << "] == " << _dbls[row] << std::endl;
123+
124+
double dbl;
125+
126+
if(ColumnUtils::getDoubleValue(_strs[row], dbl, false) && ((std::isnan(dbl) && std::isnan(_dbls[row])) || _dbls[row] == dbl))
127+
_strs[row] = "";
128+
}
129+
119130
}
120131
else
121132
{

CommonData/databaseinterface.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,9 @@ void DatabaseInterface::columnGetBasicInfo(int columnId, std::string &name, std:
14231423

14241424
colType = colTypeStr.empty() ? columnType::unknown : columnTypeFromString(colTypeStr);
14251425

1426+
if(colType == columnType::nominalText)
1427+
colType = columnType::nominal;
1428+
14261429
Json::Reader().parse(emptyValuesStr, emptyValuesJson);
14271430
};
14281431

CommonData/dataset.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,12 @@ void DataSet::dbLoad(int index, std::function<void(float)> progressCallback, Ver
524524

525525
_columns[i]->dbLoadOldIndex(i);
526526

527-
progressCallback(0.2 + (i * colProgressMult * 0.8));
527+
progressCallback(0.2 + (i * colProgressMult * 0.6));
528528
}
529-
}
530-
531529

532-
533-
534-
535-
530+
db().dataSetCreateTable(this);
531+
db().dataSetBatchedValuesUpdate(this, _columns, [&](float p){ progressCallback(0.8 + (p * 0.2)); });
532+
}
536533
}
537534

538535
void DataSet::upgradeEmptyValsFrom018To019(const Json::Value & emptyVals)

0 commit comments

Comments
 (0)