On Wed, Jan 15, 2020 at 2:58 PM Paul Rogers <par0328@yahoo.com.invalid>
wrote:
> ...
>
> For example, Ted, you mention lack of nullability on structure members.
> But, Drill represents structures as MAPs, and MAPs can have nullable
> members. So, there is likely more to your request than the short summary
> suggests. Perhaps you can help us understand this a bit more.
>
This was quite a while ago.
I was reading JSON data with substructures of variable form.
I think, however, that this impression is old news. I just tried it and it
works the way I wanted.
Here is my data:
{"top":"a","nest":{"u":1, "v":"other"}}
{"top":"b","nest":{"v":"this", "w":"that"}}
And here are some queries that behave just the way that I wanted:
apache drill> *select* * *from* dfs.root.`/Users/tdunning/x.json`;
+-----+-------------------------+
| *top* | * nest * |
+-----+-------------------------+
| a | {"u":1,"v":"other"} |
| b | {"v":"this","w":"that"} |
+-----+-------------------------+
2 rows selected (0.079 seconds)
apache drill> *select* nest *from* dfs.root.`/Users/tdunning/x.json`;
+-------------------------+
| * nest * |
+-------------------------+
| {"u":1,"v":"other"} |
| {"v":"this","w":"that"} |
+-------------------------+
2 rows selected (0.114 seconds)
apache drill> *select* nest.u *from* dfs.root.`/Users/tdunning/x.json`;
Error: VALIDATION ERROR: From line 1, column 8 to line 1, column 11: Table
'nest' not found
[Error Id: b2100faf-adf7-453e-957f-56726b96e06f ] (state=,code=0)
apache drill> *select* columns.nest.u *from* dfs.root.
`/Users/tdunning/x.json`;
Error: VALIDATION ERROR: From line 1, column 8 to line 1, column 14: Table
'columns' not found
[Error Id: a793e6bd-c2ed-477a-9f23-70d67b2b85df ] (state=,code=0)
apache drill> *select* x.nest.u *from* dfs.root.`/Users/tdunning/x.json` x;
+--------+
| *EXPR$0* |
+--------+
| 1 |
| null |
+--------+
2 rows selected (0.126 seconds)
apache drill>
|