You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Patrick Grandjean <p....@gmail.com> on 2015/05/21 14:43:15 UTC

Querying nested data

I am following the "Getting Started" guide. I could initialize drill in
embedded mode and execute a query on the sample employee.json, which
returned what was expected.

I then tried querying a more complex JSON with more nested data, by using
sales_transactions.json:

0: jdbc:drill:zk=local> select customer_transactions[0].product_name from
cp.`sales_transactions.json`;
Error: DATA_READ ERROR: You tried to write a BigInt type when you are using
a ValueWriter of type NullableFloat8WriterImpl.

File  /sales_transactions.json
Record  129
Line  129
Column  728
Field  store_sales
Fragment 0:0

[Error Id: 15b6c541-d35e-421b-b307-32d32cc4ce6c on
debian.localdomain.local:31010] (state=,code=0)

Could you please let me know what I am doing wrong?

Using the lastest drill 1.0

Patrick.

Re: Querying nested data

Posted by Patrick Grandjean <p....@gmail.com>.
Thank you Abhishek! It works now.

On Thu, May 21, 2015 at 10:04 AM, Abhishek Girish <abhishek.girish@gmail.com
> wrote:

> Hey Patrick,
>
> It looks like there was a scheme change across records. Going by the error
> message, it looks like Drill first encountered a value of type float8 and
> expected the remainder of records to also have values of type float8 for
> that field. But it then encountered a value of type BigInt.
>
> Can you try switching on JSON All Text Mode and rerun the query? This would
> treat all values at Strings and you could then use casts to convert
> specific fields to the corresponding data types, if required.
>        > alter session set `store.json.all_text_mode` = true;
>
> Regards,
> Abhishek
>
> On Thursday, May 21, 2015, Patrick Grandjean <p....@gmail.com>
> wrote:
>
> > I am following the "Getting Started" guide. I could initialize drill in
> > embedded mode and execute a query on the sample employee.json, which
> > returned what was expected.
> >
> > I then tried querying a more complex JSON with more nested data, by using
> > sales_transactions.json:
> >
> > 0: jdbc:drill:zk=local> select customer_transactions[0].product_name from
> > cp.`sales_transactions.json`;
> > Error: DATA_READ ERROR: You tried to write a BigInt type when you are
> using
> > a ValueWriter of type NullableFloat8WriterImpl.
> >
> > File  /sales_transactions.json
> > Record  129
> > Line  129
> > Column  728
> > Field  store_sales
> > Fragment 0:0
> >
> > [Error Id: 15b6c541-d35e-421b-b307-32d32cc4ce6c on
> > debian.localdomain.local:31010] (state=,code=0)
> >
> > Could you please let me know what I am doing wrong?
> >
> > Using the lastest drill 1.0
> >
> > Patrick.
> >
>

Re: Querying nested data

Posted by Abhishek Girish <ab...@gmail.com>.
Hey Patrick,

It looks like there was a scheme change across records. Going by the error
message, it looks like Drill first encountered a value of type float8 and
expected the remainder of records to also have values of type float8 for
that field. But it then encountered a value of type BigInt.

Can you try switching on JSON All Text Mode and rerun the query? This would
treat all values at Strings and you could then use casts to convert
specific fields to the corresponding data types, if required.
       > alter session set `store.json.all_text_mode` = true;

Regards,
Abhishek

On Thursday, May 21, 2015, Patrick Grandjean <p....@gmail.com>
wrote:

> I am following the "Getting Started" guide. I could initialize drill in
> embedded mode and execute a query on the sample employee.json, which
> returned what was expected.
>
> I then tried querying a more complex JSON with more nested data, by using
> sales_transactions.json:
>
> 0: jdbc:drill:zk=local> select customer_transactions[0].product_name from
> cp.`sales_transactions.json`;
> Error: DATA_READ ERROR: You tried to write a BigInt type when you are using
> a ValueWriter of type NullableFloat8WriterImpl.
>
> File  /sales_transactions.json
> Record  129
> Line  129
> Column  728
> Field  store_sales
> Fragment 0:0
>
> [Error Id: 15b6c541-d35e-421b-b307-32d32cc4ce6c on
> debian.localdomain.local:31010] (state=,code=0)
>
> Could you please let me know what I am doing wrong?
>
> Using the lastest drill 1.0
>
> Patrick.
>