@@ -153,7 +153,8 @@ public void addRow(KdbDict row) throws TableSchemaMismatchException {
153
153
}
154
154
155
155
/**
156
- * Adds a row to a table based on an {@link HashMap} representation of the row (i.e. a kdb dictionary)
156
+ * Adds a row to a table based on an {@link HashMap} representation of the row (i.e. a kdb dictionary). Any list
157
+ * values are converted to arrays and any enumeration values are converted to strings.
157
158
* @param row The new row to add
158
159
* @throws TableSchemaMismatchException If there are any missing columns from the new row
159
160
*/
@@ -165,18 +166,18 @@ public void addRow(Map<String, Object> row) throws TableSchemaMismatchException
165
166
if (! row .keySet ().containsAll (data .keySet ()))
166
167
throw new TableSchemaMismatchException ("Missing columns in row to add" );
167
168
168
- for (String key : row .keySet ()) {
169
- if (! data .containsKey (key ))
170
- data .put (key , new ArrayList <Object >());
169
+ for (Entry < String , Object > entry : row .entrySet ()) {
170
+ if (! data .containsKey (entry . getKey () ))
171
+ data .put (entry . getKey () , new ArrayList <Object >());
171
172
172
- Object rowValue = row . get ( key );
173
+ Object rowValue = entry . getValue ( );
173
174
174
175
if (rowValue instanceof List <?>)
175
176
rowValue = ((List <?>) rowValue ).toArray ();
176
177
else if (rowValue instanceof Enum )
177
178
rowValue = ((Enum <?>) rowValue ).toString ();
178
179
179
- data .get (key ).add (rowValue );
180
+ data .get (entry . getKey () ).add (rowValue );
180
181
}
181
182
182
183
this .rowCount ++;
0 commit comments