Note: This is in response to my post ""TypeError: Can't dup NilClass"
when using HyperRecord and Ruby" on the hypertable-user group. O
figured this is more of a evelopment issue.


Wow, actually these were two different beasts.

"Can't dup NilClass error" came from
ActiveRecord::Base.default_scoping. In base.rb it's default value is
set to [] but since it is defined as class_inheritable_accessor this
default value is invisible to ActiveRecord::HyperBase. I added a patch
for that in http://github.com/jonashuckestein/hyper_record . That
solution is only fighting the symptoms, though.

The second problem with the "You might have expected an instance of
Array." is a rails/ActiveRecord problem. Changing "config.time_zone =
'UTC'" to "config.active_record.default_timezone = :utc" in my
environment.rb resolved this issue.

I have no idea why all the hyper_record tests failed, though. They
still fail, even in Tyler's master branch at github. I set up a
minimal Ubuntu JeOS install with the hypertable 0.9.3.1 binary package
with only the hyper_record and thrift gems installed and they still
fail. Should I be worried?

There has been some recent activity in Tyler's master branch of
hyper_record. Are the updates in some way required to work with
Hypertable 0.9.3.1? I tried building a hyper-record 0.9.3 gem from
source but it didn't quite work. I'll try again, but only if I really
need those updates to work with hypertable 0.9.3+.

Cheers, Jonas


On May 27, 4:00 pm, Jonas Huckestein <[email protected]>
wrote:
> Hi Guys,
>
> Whenever I try to instantiate a ActiveRecord::HyperBase subclass I get
> the following error:
>
> >> Pages.new
>
> TypeError: can't dup NilClass
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2184:in `dup'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2184:in `scoped_methods'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2188:in `current_scoped_methods'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2171:in `scoped?'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2439:in `send'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2439:in `initialize'
>         from /Library/Ruby/Gems/1.8/gems/hyper_record-0.2.8/lib/
> hyper_record.rb:32:in `initialize'
>
> I set up HyperRecord according to the instructions 
> athttp://code.google.com/p/hypertable/wiki/HyperRecord. I created a
> model called Page and a pages table. I inserted a page into the table
> using the hql console and when I run Page.all on the Rails console I
> get my object. When I try to set an attribute on the object or save
> it, I get this:
>
> >> page.save
>
> NoMethodError: You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.include?
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> attribute_methods.rb:142:in `create_time_zone_conversion_attribute?'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> attribute_methods.rb:75:in `define_attribute_methods'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> attribute_methods.rb:71:in `each'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> attribute_methods.rb:71:in `define_attribute_methods'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> attribute_methods.rb:242:in `method_missing'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2453:in `send'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> base.rb:2453:in `id'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> transactions.rb:206:in `rollback_active_record_state!'
>         from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/
> transactions.rb:196:in `save'
>         from (irb):4
>
> I didn't find any of those errors on the internet so I dug a little.
> The unit tests in /Library/Ruby/Gems/1.8/gems/hyper_record-0.2.8/
> don't run either. I get 7 failures and 4 errors. For the sake of
> readability I have attached the errors t the end of this mail.
>
> I noticed how a recent HyperRecord changelog entry says that a
> currently unreleased version of HyperRecord will be compatible with
> Hypertable 0.9.3.. I installed the newest Mac OS X binary v. 0.9.3.1
> of Hypertable and Thrift from source (with all default
> configuration).  "ht version" gives me the following output:
>
> Hypertable 0.9.3.1 (v0.9.3.1)
>   Hadoop: 0.20.2
>   BerkeleyDB: 4.8.26
>   Boost: 1_40
>   Thrift: Thrift version 0.2.0-exported
>   Javac: 1.6.0_17
>   GCC/G++: 4.2.1
>
> I even tried installing the hyper_record gem from the latest github
> sourcecode but the error remains. I'll try downgrading Hypertable now,
> but since that will take a bit and might not fix the problem I thought
> I'd ask here.
>
> Thanks in advance. You guys are great!
>
> Cheers, Jonas
>
> Here's the result of running the hyper_record unit tests:
>
> Loaded suite test/thrift_client_test
> Started
> .....FFFFF...............FEEFEE
> Finished in 50.520398 seconds.
>
>   1) Failure:
> test: get cell should return a single cell using hql_query.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:377:in `__bind_1274999516_737055'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:374:in `__bind_1274999516_737055'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: get cell should return a single cell using hql_query. '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>   2) Failure:
> test: get cells should return a list of cells using get_cells.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:460:in `__bind_1274999518_371706'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:455:in `__bind_1274999518_371706'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: get cells should return a list of cells using get_cells.
> '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>   3) Failure:
> test: get cells should return a list of cells using hql_query.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:440:in `__bind_1274999519_962690'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:437:in `__bind_1274999519_962690'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: get cells should return a list of cells using hql_query.
> '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>   4) Failure:
> test: get row should return a single row using get_row.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:417:in `__bind_1274999521_615933'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:414:in `__bind_1274999521_615933'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: get row should return a single row using get_row. '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>   5) Failure:
> test: get row should return a single row using hql_query.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:407:in `__bind_1274999523_262199'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:404:in `__bind_1274999523_262199'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: get row should return a single row using hql_query. '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>   6) Failure:
> test: set cell should insert a cell using hql_query.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:215:in `__bind_1274999548_994540'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:209:in `__bind_1274999548_994540'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: set cell should insert a cell using hql_query. '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>   7) Error:
> test: set cell should insert a cell using set_cell.
> (ThriftClientTest):
> Hypertable::ThriftGen::ClientException: virtual void
> Hypertable::ThriftBroker::ServerHandler::set_cell(Hypertable::ThriftGen::Mu 
> tator,
> const Hypertable::ThriftGen::Cell&): Hypertable::Exception: Invalid
> row key - cannot be zero length - HYPERTABLE bad key
>         at void Hypertable::Cell::sanity_check() const (/Users/doug/src/
> hypertable/src/cc/Hypertable/Lib/Cell.h:45)
>     ./lib/hypertable/gen-rb/client_service.rb:248:in `recv_set_cell'
>     ./lib/hypertable/gen-rb/client_service.rb:239:in `set_cell'
>     test/thrift_client_test.rb:228:in `__bind_1274999550_405564'
>     ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>     test/thrift_client_test.rb:222:in `__bind_1274999550_405564'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: set cell should insert a cell using set_cell. '
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run'
>
>   8) Error:
> test: set cell should work with mutator flush_interval.
> (ThriftClientTest):
> Hypertable::ThriftGen::ClientException: virtual void
> Hypertable::ThriftBroker::ServerHandler::set_cell(Hypertable::ThriftGen::Mu 
> tator,
> const Hypertable::ThriftGen::Cell&): Hypertable::Exception: Invalid
> row key - cannot be zero length - HYPERTABLE bad key
>         at void Hypertable::Cell::sanity_check() const (/Users/doug/src/
> hypertable/src/cc/Hypertable/Lib/Cell.h:45)
>     ./lib/hypertable/gen-rb/client_service.rb:248:in `recv_set_cell'
>     ./lib/hypertable/gen-rb/client_service.rb:239:in `set_cell'
>     test/thrift_client_test.rb:246:in `__bind_1274999551_850760'
>     ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>     test/thrift_client_test.rb:240:in `__bind_1274999551_850760'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: set cell should work with mutator flush_interval. '
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run'
>
>   9) Failure:
> test: set cells should insert cells using hql_query.
> (ThriftClientTest)
>     [test/thrift_client_test.rb:279:in `__bind_1274999553_253257'
>      ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>      test/thrift_client_test.rb:271:in `__bind_1274999553_253257'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>      /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: set cells should insert cells using hql_query. '
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>      /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run']:
> <"k1"> expected but was
> <nil>.
>
>  10) Error:
> test: set cells should insert cells using set_cells.
> (ThriftClientTest):
> Hypertable::ThriftGen::ClientException: virtual void
> Hypertable::ThriftBroker::ServerHandler::set_cells(Hypertable::ThriftGen::M 
> utator,
> const Hypertable::ThriftBroker::ThriftCells&): Hypertable::Exception:
> Invalid row key - cannot be zero length - HYPERTABLE bad key
>         at void Hypertable::Cell::sanity_check() const (/Users/doug/src/
> hypertable/src/cc/Hypertable/Lib/Cell.h:45)
>     ./lib/hypertable/gen-rb/client_service.rb:278:in `recv_set_cells'
>     ./lib/hypertable/gen-rb/client_service.rb:269:in `set_cells'
>     test/thrift_client_test.rb:311:in `__bind_1274999554_673892'
>     ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>     test/thrift_client_test.rb:294:in `__bind_1274999554_673892'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: set cells should insert cells using set_cells. '
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run'
>
>  11) Error:
> test: with mutator should yield a mutator object and close after
> block. (ThriftClientTest):
> Hypertable::ThriftGen::ClientException: virtual void
> Hypertable::ThriftBroker::ServerHandler::set_cells(Hypertable::ThriftGen::M 
> utator,
> const Hypertable::ThriftBroker::ThriftCells&): Hypertable::Exception:
> Invalid row key - cannot be zero length - HYPERTABLE bad key
>         at void Hypertable::Cell::sanity_check() const (/Users/doug/src/
> hypertable/src/cc/Hypertable/Lib/Cell.h:45)
>     ./lib/hypertable/gen-rb/client_service.rb:278:in `recv_set_cells'
>     ./lib/hypertable/gen-rb/client_service.rb:269:in `set_cells'
>     test/thrift_client_test.rb:349:in `__bind_1274999556_161817'
>     ./lib/hypertable/thrift_client.rb:42:in `with_mutator'
>     test/thrift_client_test.rb:344:in `__bind_1274999556_161817'
>     ./lib/hypertable/thrift_client.rb:89:in `with_thrift_client'
>     test/thrift_client_test.rb:340:in `__bind_1274999556_161817'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `call'
>     /Library/Ruby/Gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:
> 362:in `test: with mutator should yield a mutator object and close
> after block. '
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `__send__'
>     /Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/
> test_unit/ruby_version_186_and_above.rb:19:in `run'
>
> 31 tests, 84 assertions, 7 failures, 4 errors

-- 
You received this message because you are subscribed to the Google Groups 
"Hypertable Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hypertable-dev?hl=en.

Reply via email to