0

donutTest.json (在我的本地系统 /home/dev 中):

{
   "id":"0001",
   "type":"donut",
   "name":"Cake",

   "batter":{
            "id":"1001",
            "type":"Regular"
           },

   "topping":[
             { "id":"5001", "type":"None"},
             { "id":"5002", "type":"Glazed"}  
             ]
 }

此查询工作正常。

 select topping[0].id as topping_id, topping[3].type as topping_type from dfs.`/home/dev/donutTest.json`;

但是当我尝试时:

select batter.id as batter_id, batter.type as batter_type from dfs.`/home/dev/donutTest.json`;

它显示错误。

找不到表“击球手”

topping[0]并且batter两者都是嵌入式文档仍然错误。

4

1 回答 1

1

尝试使用表别名,然后在 select 语句中引用它。

select donut.batter.id as batter_id, donut.batter.type as batter_type from dfs.`/home/dev/donutTest.json` as donut;

这样,Drill 可以引用实际的表别名,然后是下面的嵌套结构。

于 2015-08-26T16:20:52.427 回答