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

Support for complex types #121

Open
john-bodley opened this issue May 16, 2017 · 7 comments · May be fixed by #328
Open

Support for complex types #121

john-bodley opened this issue May 16, 2017 · 7 comments · May be fixed by #328

Comments

@john-bodley
Copy link

john-bodley commented May 16, 2017

I was wondering why PyHive doesn't support complex types like ARRAY, MAP, STRUCT, etc?

@jingw
Copy link
Contributor

jingw commented Jul 8, 2017

Not sure what you're requesting. Complex types work:
https://github.com/dropbox/PyHive/blob/master/pyhive/tests/test_hive.py#L41

Are you asking for support for parsing the result strings into something nicer?

@john-bodley
Copy link
Author

Apologies @jingw I meant for Presto. I was looking at sqlalchemy_presto.py and didn't notice any, but per the Presto equivalent link you provided it seems like they are mentioned in test_presto.py.

@josephfrancis
Copy link

@jingw We are also seeing this with hive, querying a struct in hive returns as a string. https://github.com/dropbox/PyHive/blob/master/pyhive/sqlalchemy_hive.py#L98
Was trying to use it through superset's sqllab and found that we cant query fields inside a struct.

@josephfrancis
Copy link

@jingw I'm interested in getting this working at the very least for presto. I'm happy to make a PR if you have any suggestions on how best to represent the complex types in the current response format.

@jingw
Copy link
Contributor

jingw commented Aug 9, 2017

If you meant Presto, that currently returns a struct as a list:
https://github.com/dropbox/PyHive/blob/master/pyhive/tests/test_presto.py#L76

If you meant Hive, that returns strings:
https://github.com/dropbox/PyHive/blob/master/pyhive/tests/test_hive.py#L65
We could add a flag parse_complex_types to the connection object (default false for compatibility) and have it return something similar to Presto. Sadly the return format isn't JSON compatible, but it looks like ast.literal_eval could be good enough. Need to check on what happens with fancier types like unicode characters and binary.

I'm not sure what you meant by linking to sqlalchemy_presto.py#L137

@ofekby ofekby linked a pull request Apr 20, 2020 that will close this issue
@kakipipi23
Copy link

There is a PR pending, waiting for over a week. Much frustrating.

@panoptikum
Copy link

This is quite a limitation for us. Any chance that hive returns a struct as list or similar?

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

Successfully merging a pull request may close this issue.

5 participants