Skip to content

Commit 1b0f1d8

Browse files
committed
missing categories are correctly saved in binary
1 parent 43d5d8e commit 1b0f1d8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

core/src/processing/data/Table.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,12 @@ protected void saveBinary(OutputStream os) throws IOException {
11651165
output.writeDouble(row.getDouble(col));
11661166
break;
11671167
case CATEGORY:
1168-
output.writeInt(columnCategories[col].index(row.getString(col)));
1168+
String peace = row.getString(col);
1169+
if (peace.equals(missingString)) {
1170+
output.writeInt(missingCategory);
1171+
} else {
1172+
output.writeInt(columnCategories[col].index(peace));
1173+
}
11691174
break;
11701175
}
11711176
}
@@ -4140,7 +4145,12 @@ protected void convertRow(DataOutputStream output, String[] pieces) throws IOExc
41404145
}
41414146
break;
41424147
case CATEGORY:
4143-
output.writeInt(columnCategories[col].index(pieces[col]));
4148+
String peace = pieces[col];
4149+
if (peace.equals(missingString)) {
4150+
output.writeInt(missingCategory);
4151+
} else {
4152+
output.writeInt(columnCategories[col].index(peace));
4153+
}
41444154
break;
41454155
}
41464156
}

0 commit comments

Comments
 (0)