Posts: 26
Registered: ‎01-07-2016

Master views with complex types


I have a wide table with a lot of complex type from which I would like to create simpler views for end user convenience. Ideally these views would expose one or more structs unaltered from the more complex table that is backing the view. Operations, and renames could occur on the other scalar fields. See snippet below.


CREATE TABLE complex_table (
  scalar1 BIGINT,
  scalar2 BIGINT,
  struct1 STRUCT <f1: STRING, f2: BIGINT>,
  struct2 STRUCT <f1: STRING, f2: BIGINT>


CREATE VIEW simple_view AS SELECT scalar1*2 as my_field1, scalar2*4 as my_field2, struct1, struct2 FROM complex_table;


This is currently not possible since a view cannot include a struct column but have to expand the fields in the structs as scalars in order to use them. Could anyone comment on if this will hold true for all forseabale future or if intermediate results from inner selects would be allowed to contain structs the future?


Any alternative approaches are also welcome. The environment is Impala 2.3.0 in CDH5.5.1





Posts: 26
Registered: ‎01-07-2016

Re: Master views with complex types

After som digging I found IMPALA-2777.