That seems to be what I am looking for, however, when I do
convert_from(flatten(kvgen(allias.`column`)), 'json')  I get an error
"Missing function implementation (convert_fromjson, "map required")  when I
do "convert_to(flatten(kvgen()), 'json') then I get what appears to be hex
encoded data... (Just long strings of hex, I wonder if Squirrel is doing
that too)


On Mon, Oct 12, 2015 at 2:57 PM, Jason Altekruse <[email protected]>
wrote:

> We don't implement casts on array or map, but we do have a convert function
> that will convert a complex structure to json.
>
> You can invoke it like this:     convert_from( map_or_list_column_name,
> 'JSON')
>
> This will return the data serialized into JSON in a varchar column.
>
> On Mon, Oct 12, 2015 at 12:27 PM, John Omernik <[email protected]> wrote:
>
> > Is there an easy way in drill to convert from an ARRAY or MAP to a string
> > representation of the same? I know this is an odd question, but I
> realized
> > I just was spinning my wheels because I thought I was doing something
> wrong
> > with JSON and KVGEN and FLATTEN but in reality, it was working fine, I
> just
> > didn't see it because SQL Squirrel kept returning "<Unknown Type (2,002)>
> > instead of the results of the function.
> >
> > I guess, if I could take the output from FLATTEN(KVGEN()) and wrap it in
> a
> > "CAST(FLATTEN(KVGEN()))" then at least I could continue exploration.
> >
> > I know that it is a workaround for the limitations of Squirrel, but I'd
> be
> > interested in other's thoughts on that, is there a tweak to squirrel that
> > would allow that to work properly, or just casting it as needed. (Note I
> > tried CAST as STRING  and CASTS as VARCHAR with not much success.
> >
>

Reply via email to