Skip to content

Commit

Permalink
Skip NULL-valued properties in bulk loader (#1108)
Browse files Browse the repository at this point in the history
* Skip NULL-valued properties in bulk loader

* Address PR comment, add missing logic in edge procesing
  • Loading branch information
jeffreylovitz committed May 24, 2020
1 parent 1657cc6 commit b62e802
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bulk_insert/bulk_insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ static inline SIValue _BulkInsert_ReadProperty(const char *data, size_t *data_id
TYPE t = data[*data_idx];
*data_idx += 1;
if(t == BI_NULL) {
// TODO This property will currently get entered with a NULL key.
// Update so that the entire key-value pair is omitted from the node
v = SI_NullVal();
} else if(t == BI_BOOL) {
bool b = data[*data_idx];
Expand Down Expand Up @@ -108,6 +106,9 @@ int _BulkInsert_ProcessNodeFile(RedisModuleCtx *ctx, GraphContext *gc, const cha
Graph_CreateNode(gc->g, label_id, &n);
for(unsigned int i = 0; i < prop_count; i++) {
SIValue value = _BulkInsert_ReadProperty(data, &data_idx);
// Cypher does not support NULL as a property value.
// If we encounter one here, simply skip it.
if(SI_TYPE(value) == T_NULL) continue;
GraphEntity_AddProperty((GraphEntity *)&n, prop_indicies[i], value);
}
}
Expand Down Expand Up @@ -144,6 +145,9 @@ int _BulkInsert_ProcessRelationFile(RedisModuleCtx *ctx, GraphContext *gc, const
// Process and add relation properties
for(unsigned int i = 0; i < prop_count; i ++) {
SIValue value = _BulkInsert_ReadProperty(data, &data_idx);
// Cypher does not support NULL as a property value.
// If we encounter one here, simply skip it.
if(SI_TYPE(value) == T_NULL) continue;
GraphEntity_AddProperty((GraphEntity *)&e, prop_indicies[i], value);
}
}
Expand Down

0 comments on commit b62e802

Please sign in to comment.