Thanks for your responses. Wrapping the records into an array makes sense.
However there still could be scenarios where the json string contains
multiple records without them being part of an array. What should be the
expected behavior in that case?

- Rahul

On Wed, Nov 19, 2014 at 12:51 PM, Jacques Nadeau <[email protected]> wrote:

> You'll need to add a comma if you want to do this as [ {}{} ] is not
> valid.  Only [ {}, {} ] is.
>
> On Wed, Nov 19, 2014 at 12:48 PM, Tomer Shiran <[email protected]> wrote:
>
> > If you wrap the two maps in an array [{...}{...}] then the convert should
> > work and you can decide whether to use the new flatten function to get
> two
> > separate top level records.
> >
> >
> >
> > > On Nov 20, 2014, at 5:50 AM, rahul challapalli <
> > [email protected]> wrote:
> > >
> > > Hi Drillers,
> > >
> > > I just wanted to understand what the expected behavior would be in the
> > > below scenario
> > >
> > > My dataset :
> > >
> > > 1|{"a":"b"}{"a":"c"}
> > >
> > > In the above dataset, I have 2 json records in the second column.
> However
> > > the below query just returns the first record as the output
> > >
> > > select convert_from(columns[1], 'JSON') from `convert.tbl`;
> > > +------------+
> > > |   EXPR$0   |
> > > +------------+
> > > | {"a":"b"}  |
> > > +------------+
> > >
> > > Should drill implicitly do a flatten sort of thing and return 2 rows,
> one
> > > for each json record?
> > >
> > > - Rahul
> >
>

Reply via email to