Member since
02-28-2016
1
Post
0
Kudos Received
0
Solutions
02-28-2016
08:37 PM
Hi All, I have created an external table from an existing parquet file: +---------+------------------+-----------------------------+ | name | type | comment | +---------+------------------+-----------------------------+ | name | string | Inferred from Parquet file. | | address | struct< | Inferred from Parquet file. | | | street:string, | | | | city:string | | | | > | | +---------+------------------+-----------------------------+ Then I was trying to learn how schema evolution works and I created a new parquet file with a slightly different schema. New file now has an extra field in address called 'house_no'. Now if I executed a query involving address field, I woud get an error: Query: select address.house_no, address.street, address.city from existing_parquet ERROR: AnalysisException: Could not resolve column/field reference: 'address.house_no' Then I was trying to alter the table to accomadate the new field in address, but I coudn't figure out a way to do that. For instance, if I executed something like: ALTER TABLE existing_parquet ADD COLUMNS (address.house_no INTEGER); I'd get a syntax error: ERROR: AnalysisException: Syntax error in line 1: ...rquet ADD COLUMNS (address.house_no INTEGER) ^ Encountered: . Expected: ARRAY, BIGINT, BINARY, BOOLEAN, CHAR, DATE, DATETIME, DECIMAL, REAL, FLOAT, INTEGER, MAP, SMALLINT, STRING, STRUCT, TIMESTAMP, TINYINT, VARCHAR CAUSED BY: Exception: Syntax error So my question is is it possible to add a field to a complex type? If so how do I refer to the nested columns? Thanks Lloyd
... View more