cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Weird error

At this point this should probably be a bug report but here we go, further to the discussion started in the slack channel I have created a minimum reproducing example of the issue i am experiencing

from py2neo import Graph
import random
import string

G = Graph(host='localhost', username='neo4j', password='neo4j')

# function to create random binary array
binary_array = lambda: (''.join([random.choice(string.ascii_letters) for _ in range(100)])).encode('utf-8')

# fill the database with 10000 nodes 

G.run("""
UNWIND {all_data} as data
CREATE (:Test {data:data})""", all_data=[binary_array() for _ in range(10000)])

limit = 10

# Works
G.run("""
match (t:Test) with t limit {limit} return t.data as data
""", limit=limit).data()

# Works
G.run("""
match (t:Test) with t limit {limit} return collect(t.data) as data
""", limit=limit).data()

limit = 1000

# Works
G.run("""
match (t:Test) with t limit {limit} return t.data as data
""", limit=limit).data()

# AttributeError: 'bytearray' object has no attribute 'tobytes'
G.run("""
match (t:Test) with t limit {limit} return collect(t.data) as data
""", limit=limit).data()

So basically it seems that when returning a large set of data with collect() causes some sort of weird issue. I also tried with 10000 character strings and the results were the same

0 REPLIES 0