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

Hive metastore types in global namespace #20

Open
JamesMcMahon opened this issue Apr 1, 2014 · 7 comments
Open

Hive metastore types in global namespace #20

JamesMcMahon opened this issue Apr 1, 2014 · 7 comments

Comments

@JamesMcMahon
Copy link

The classes defined in hive_metastore_types.rb are created directly in the global namespace, not in a specific module and they are prone to class name collisions because of this.

For example, in my project my Role model is conflicting with the Role class defined by rbhive. There are other very generic names in this file that could also cause collisions, like Type and Version.

Can you put these classes inside a module? Is there any workaround in the meantime?

@andytinycat
Copy link
Contributor

Yep, it's totally possible to namespace them; in fact, I thought I had namespaced all the autogenerated code. It requires regenerating the Thrift code.

I've been meaning to change the namespacing to be more logical - let me look at this and cut a new gem in the next day or so.

@JamesMcMahon
Copy link
Author

Thanks for the quick reply. I figured this was more complex than just wrapping the code in a module otherwise I would have sent a pull request.

For a workaround I'll just rename my model temporarily in my project's feature branch until you have the new gem out.

@anilpeechara
Copy link

Andy,
We are having the same problem with few classes. Did you get a chance to namespace them?

@r39132
Copy link

r39132 commented Jun 30, 2015

Andy!
Why not check in the IDL code so that someone else can fix this? We also need a fix and would happily patch and share, but without the .thrift files, we cannot regenerate the files. Any update on this?

@andytinycat
Copy link
Contributor

The IDL code is not owned by me or written by me. It's the property of the Hive project, and you can find the IDL files there if you want to take a crack at regenerating the classes. I've been too busy with other things to do this, as regenerating the code is pretty painful (Thrift is hard to install).

I will try to have a look at it today.

@r39132
Copy link

r39132 commented Jun 30, 2015

I tried yesterday. I did the following :

  1. Got the latest Thrift source and built it on my Mac (1.0.0-dev) - This worked with some hacks.
  2. Got the latest Hive source and built it, including code-generating Thrift IDL. This failed after serde and metastore thrift was built, so I was able to get the classes we depend on built and copied over to my local rbhive working directory
  3. I had to make some manual changes (e.g. converting "require" to "require_relative"). Unfortunately, though the Version issue is fixed in one class, I still found it was not fixed in hive_metastore_types.rb, hence some more work needs to be done on the hive side to fix the issue.

II would say it's worth someone else trying this to validate my findings.

@pointlessone
Copy link

Another rather generic class name I have problems with it Database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants