> SELECT array(1, 2) a UNION ALL SELECT NULL;
Error: Error while compiling statement: FAILED: SemanticException Schema of 
both sides of union should match: Column a is of type array<int> on first table 
and type void on second table. Cannot tell the position of null AST. 
(state=42000,code=40000)


Might be a bug in the union validation


> SELECT CAST (NULL as array<int>);
Error: Error while compiling statement: FAILED: ParseException line 1:21 cannot 
recognize input near 'array' '<' 'int' in primitive type specification 
(state=42000,code=40000)?


Looks like parsing of CAST only allows primitive types at the moment


May be worth filing Jiras on both of these


________________________________
From: Paras Sethia <paras.set...@gmail.com>
Sent: Thursday, February 02, 2017 9:13 PM
To: user@hive.apache.org
Subject: Usage of complex types

Hi,

I am trying a few queries in Hive using complex data types:

> SELECT array(1, 2) a UNION ALL SELECT NULL;
Error: Error while compiling statement: FAILED: SemanticException Schema of 
both sides of union should match: Column a is of type array<int> on first table 
and type void on second table. Cannot tell the position of null AST. 
(state=42000,code=40000)

> SELECT CAST (NULL as array<int>);
Error: Error while compiling statement: FAILED: ParseException line 1:21 cannot 
recognize input near 'array' '<' 'int' in primitive type specification 
(state=42000,code=40000)

Queries with similar structure using simple data types give no errors.
Is this a bug in Hive or an error on my part with the query? Any help to fix 
the errors is appreciated.

Thanks,
Paras

PS: I am using Hive 1.2.1 on HDP 2.5.3

Reply via email to