Ah, I see that this can't be done with an array as there is no type common to all union indexes. Perhaps a struct with one field per indexed type?
On Wed, 23 Nov 2016 at 17:29, Elliot West <[email protected]> wrote: > Can anyone recommend a good approach for interrogating uniontype values in > HQL? I note that the documentation states that the support for such types > is limited to 'look-at-only' which I assume to mean that I may only dump > out the value in its entirety, and extract sub-elements. Using the example > below, is there anyway I can get to field 'b' of union index 3 to extract > only the value 5? > > {0:1} > {1:2.0} > {2:["three","four"]} > {3:{"a":5,"b":"five"}} > > > If not possible with HQL, would it be possible to implement a UDF that can > explode the type into something more navigable, like an array, struct, or > map? > > Example when exploded as array: > > > [1,null,null,null] > [null,2.0,null,null] > [null,null,["three","four"],null] > [null,null,null,{"a":5,"b":"five"}] > > Has anyone done this? > > Thanks, > > Elliot. > >
