Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batchimporter does not alllow symbol for keys on relationships #104

Closed
dnagir opened this issue Dec 14, 2011 · 1 comment
Closed

Batchimporter does not alllow symbol for keys on relationships #104

dnagir opened this issue Dec 14, 2011 · 1 comment
Labels
Milestone

Comments

@dnagir
Copy link
Contributor

dnagir commented Dec 14, 2011

Also, the database is in a corrupt state after the error.

Failure:

jruby-1.6.3 :001 > require 'rubygems'
 => true 
jruby-1.6.3 :002 > require 'neo4j'
 => true 
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
 => #<Neo4j::Batch::Inserter:0xd713fe @rule_inserter=#<Neo4j::Batch::RuleInserter:0x4936f3 @inserter=#<Neo4j::Batch::Inserter:0xd713fe ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x118abfe>> 
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
 => 1 
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
 => 2 
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, :since => '2009') # NOTE: using symbol :since
NativeException: java.lang.ClassCastException: org.jruby.RubySymbol cannot be cast to java.lang.String
    from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:419:in `createPropertyChain'
    from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:198:in `createRelationship'
    from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
    from (irb):6:in `evaluate'
    from org/jruby/RubyKernel.java:1088:in `eval'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
    from org/jruby/RubyKernel.java:1419:in `loop'
    from org/jruby/RubyKernel.java:1191:in `catch'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
    from org/jruby/RubyKernel.java:1191:in `catch'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
    from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
jruby-1.6.3 :007 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009') # changed from using a symbol to using a string
NativeException: org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Record[0] not in use
    from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:229:in `getRecord'
    from org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java:96:in `getRecord'
    from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:210:in `connectRelationship'
    from org/neo4j/kernel/impl/batchinsert/BatchInserterImpl.java:195:in `createRelationship'
    from /home/martin/.rvm/gems/jruby-1.6.3@neo/gems/neo4j-1.1.4-java/lib/neo4j/batch/inserter.rb:71:in `create_rel'
    from (irb):7:in `evaluate'
    from org/jruby/RubyKernel.java:1088:in `eval'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
    from org/jruby/RubyKernel.java:1419:in `loop'
    from org/jruby/RubyKernel.java:1191:in `catch'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
    from org/jruby/RubyKernel.java:1191:in `catch'
    from /home/martin/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
    from /home/martin/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'

Success:

jruby-1.6.3 :001 > require 'rubygems'
 => true 
jruby-1.6.3 :002 > require 'neo4j'
 => true 
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
 => #<Neo4j::Batch::Inserter:0x15b15ab @rule_inserter=#<Neo4j::Batch::RuleInserter:0x1635aad @inserter=#<Neo4j::Batch::Inserter:0x15b15ab ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x186b11c>> 
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
 => 1 
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
 => 2 
jruby-1.6.3 :006 > inserter.create_rel(:friends, node_a, node_c, 'since' => '2009')
 => nil 
jruby-1.6.3 :007 > inserter.shutdown
 => nil

http://neo4j.lighthouseapp.com/projects/15548/tickets/178-batchimporter-does-not-alllow-symbol-for-keys-on-relationships

@dnagir
Copy link
Contributor Author

dnagir commented Dec 14, 2011

Martin Kleppmann

August 11th, 2011 @ 08:18 PM
BTW, in both examples this is starting from a completely blank database (I deleted the Neo4j database directory before each irb session.

@dnagir dnagir closed this as completed in a4e0f12 Jan 12, 2012
dnagir pushed a commit to dnagir/neo4j that referenced this issue Jan 13, 2012
allow to use symbols in batch inserter. Closes neo4jrb#104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant