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 HIVE VIEW with LATERAL VIEW json_tuple without AS #7456

Open
findepi opened this issue Mar 30, 2021 · 0 comments
Open

Support HIVE VIEW with LATERAL VIEW json_tuple without AS #7456

findepi opened this issue Mar 30, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@findepi
Copy link
Member

findepi commented Mar 30, 2021

Follow up to #7242

Add support for "Unalias case" described here #7242 (comment)

Unalias case

SELECT * FROM t AS t LATERAL VIEW json_tuple(jsonstr, "name", "surname", "user_id") x;

+----------------------------------------------------+----------+-----------+-------+
|                     t.jsonstr                      |   x.c0   |   x.c1    | x.c2  |
+----------------------------------------------------+----------+-----------+-------+
| {"user_id": 1000, "name": "Mateusz", "surname": "Gajewski"} | Mateusz  | Gajewski  | 1000  |
+----------------------------------------------------+----------+-----------+-------+

This introduces a relation x with fields c0, c1 and c2.
As with any relation, the fields can be accssed using qualified or unqualified
names:

SELECT c0, x.c1 FROM t AS t LATERAL VIEW json_tuple(jsonstr, "name", "surname", "user_id") x;

+----------+-----------+
|    c0    |   x.c1    |
+----------+-----------+
| Mateusz  | Gajewski  |
+----------+-----------+

The unaliased case is easy to support -- we know number of columns statically,
so we can enumerate c0, c1, ... and fold that into the aliased case below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant