Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions redisgraph_bulk_loader/entity_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def typed_prop_to_binary(prop_val, prop_type):
prop_val = prop_val.strip()

# TODO allow ID type specification
if prop_type == Type.ID or prop_type == Type.LONG:
if prop_type == Type.LONG:
try:
numeric_prop = int(prop_val)
return struct.pack(format_str + "q", Type.LONG.value, numeric_prop)
Expand All @@ -75,7 +75,7 @@ def typed_prop_to_binary(prop_val, prop_type):
if prop_type == Type.LONG:
raise SchemaError("Could not parse '%s' as a long" % prop_val)

elif prop_type == Type.ID or prop_type == Type.DOUBLE:
elif prop_type == Type.DOUBLE:
try:
numeric_prop = float(prop_val)
if not math.isnan(numeric_prop) and not math.isinf(numeric_prop): # Don't accept non-finite values.
Expand All @@ -94,7 +94,7 @@ def typed_prop_to_binary(prop_val, prop_type):
else:
raise SchemaError("Could not parse '%s' as a boolean" % prop_val)

elif prop_type == Type.STRING:
elif prop_type== Type.ID or prop_type == Type.STRING:
# If we've reached this point, the property is a string
encoded_str = str.encode(prop_val) # struct.pack requires bytes objects as arguments
# Encoding len+1 adds a null terminator to the string
Expand Down Expand Up @@ -146,7 +146,10 @@ def inferred_prop_to_binary(prop_val):

# If the property string is bracket-interpolated, it is an array.
if prop_val[0] == '[' and prop_val[-1] == ']':
return array_prop_to_binary(format_str, prop_val)
try:
return array_prop_to_binary(format_str, prop_val)
except:
pass

# If we've reached this point, the property is a string.
encoded_str = str.encode(prop_val) # struct.pack requires bytes objects as arguments
Expand Down
2 changes: 2 additions & 0 deletions redisgraph_bulk_loader/relation_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class RelationType(EntityFile):
def __init__(self, query_buffer, infile, type_str, config):
super(RelationType, self).__init__(infile, type_str, config)
self.query_buffer = query_buffer
self.start_namespace = None
self.end_namespace = None

def process_schemaless_header(self, header):
if self.column_count < 2:
Expand Down