drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Matta <cma...@mapr.com>
Subject Re: Querying nested JSON
Date Wed, 29 Oct 2014 17:36:27 GMT
Daniel,

It doesn’t look like geoLocationInfo is a list/array, it seems like it’s an
object? That notation is for lists only.

This works for me:

0: jdbc:drill:zk=sen11:5181,sen12:5181> select
t.`geoLocationInfo`.`region` from maprfs.cmatta.`test` t;
+------------+
|   EXPR$0   |
+------------+
| 40         |
+------------+

​

Chris Matta
cmatta@mapr.com
215-701-3146

On Wed, Oct 29, 2014 at 1:24 PM, Daniel Haviv <danielrulez@gmail.com> wrote:

> Hi,
> I have the following JSON:
>
>
> {"geoLocationInfo":{"region":"40","mobile_operator":"TRUEINTTH","ip_routing_type":"","connection_type":"","ip":"
> 171.96.247.102
> ","country":"TH","city":"bangkok","is_cache":false,"postal_code":"10540","carrier":"True
>
> Internet","longitude":100.71670532226562,"latitude":13.600006103515625,"is_longlat_from_req":false},"markup":"html","publisher_id":84,"bs_width":0,"request_type":0,"impression_id":"14144917224026328287047648533877","app_name":null,"mode":"Live","handling_time":0,"source_ip":"23.110.21.118","age":null,"device_id_hash":"none","gender":null,"user_id":null,"deviceIdType":"na","adformat":"txt","selected_campaigns":"||","request_date":1414491722402,"site_id":"1344","deviceInfo":{"device_os":"Android","is_tablet":true,"is_opera":false,"screen_width":1024,"user_agent":"Mozilla\/5.0
> (Linux; U; Android 4.2.2; th-th; SM-T110 Build\/JDQ39)
> AppleWebKit\/534.30 (KHTML, like Gecko) Version\/4.0
>
> Safari\/534.30","is_touch_screen":true,"device_matching_result":"exact_match","model_name":"SM-T110","brand_name":"Samsung","screen_height":600},"udid":null,"request_source":"mobapp","referrer":null,"adspaces":"default","request_id":"6328287047648533877","customParams":{},"app_id":null,"headerParams":{},"categories":["politics","alcohol","betting","mobile_content","dating","ringtones","general"],"computer_id":12,"bs_height":0}
>
> I'm trying to access the region property of the geoLocationInfo nested
> json using the following query:
> 0: jdbc:drill:> select geoLocationInfo[0].region from
> hdfs.source.`requests.json`;
>
> but I'm hitting a wall:
> Query failed: Failure while running fragment. The current reader
> doesn't support getting next information.
> [2055ef8c-d600-4754-b5e0-3f03787e0bf4]
>
> Error: exception while executing query: Failure while trying to get
> next result batch. (state=,code=0)
>
> Am I doing something wrong?
>
> Thanks,
> Daniel
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message